Giter Site home page Giter Site logo

tjheslin1 / dmspredictor Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 3.0 1.31 MB

Combat results predictor for DMs for Dungeons & Dragons 5th Edition

License: GNU General Public License v3.0

Scala 100.00%
dnd dnd-tools dnd5e dnd5e-tools dragons-5th-edition dungeons-and-dragons functional-programming scala simulation-game

dmspredictor's People

Contributors

scala-steward avatar tjheslin1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dmspredictor's Issues

Handle updating spell slots for newly concentrating spells

Whilst all ConditionSpell's require concentration, spells other than ConcentrationConditionSpell also require concentration. This spell type is specifically for apply Conditions.

  • Add new tests cases for concentrating in CoreAbilitiesSpec.
  • Add every spell type of a given SpellEffect to each CoreAbilitiesSpec test which tests updating of spell slots.
  • TODO: castSelfBuffSpell and castMultiTargetBuffSpell, referncing each other.
  • Update spellcasting abilities in CoreAbilities to set newlyConcentrating correctly:
  • It should be safe to set this to true for a type of spell with a mixture of concentration and non-concentration spells as it only enables checking for concentration.
  • Rename SpellEffect cases to added "Effect" as a suffix.
  • Rename ConcentrationConditionSpell to ConditionSpell.
  • castConditionSpell and castMultiTargetBuffSpell should follow the same pattern as castSelfBuffSpell in terms of updating spell slots.
  • Remaining TODOs

weaponModifier doesn't cater for Ranged weapons

Actions#weaponModifier should be:

  private def weaponModifier(weapon: Weapon, creature: Creature): Int = weapon.weaponType match {
    case Melee if weapon.finesse =>
      Math.max(mod(creature.stats.strength), mod(creature.stats.dexterity))
    case Melee  => mod(creature.stats.strength)
    case Ranged => mod(creature.stats.dexterity)
  }
  "resolveDamage" should {
  ...
  ...
    "add a players dexterity modifier for a Ranged weapon" in {

Bonus Action is always made after the creatures main action

A good example of this is a Ranger using the Hunters Mark spell. Currently it will cast this at the end of its first turn. It would benefit from casting it (as a bonus action) at the beginning of its first turn.

This will involve updating Move#takeMove.

The intended implementation is for the Creature to look for a suitable bonus action to use at the start of its turn. A new boolean value stored in all bonus action abilities (e.g. useBeforeAction: Boolean) would be checked to determine at what point this ability is used.

It is not intended for a Creature to suddenly use more bonus action abilities when it might be better for it to continue to utilise twoWeaponFighting.

New tests in MoveSpec should be sufficient as the behaviour of the abilities themselves will remain unaffected.

Add a toHitModifier to Monster

Monsters should have a to hit modifier added to their attack rolls. Akin to a Players proficiency bonus.

E.g Goblin has a Dexterity score of 14 (+2). It's bonus to hit on its attacks is +4, suggesting a bonus of plus 2.

This will function in the same way as proficiency bonus and should set Spellcasting Monster's spellCastingModifier.

Barbarian's rage never ends

Currently the Barbarian's number of turns left during it's rage is not decremented.

When this reaches 0 or when the Barbarian has started its turn without being damaged or having attacked, it should lose it's rage. For this a new flag, something like: rageSatisfied: Boolean will need to be added.

Abilities which replace creatures into turn order may disrupt the order during a turn.

Using ListOps#replace may affect the turn order.

E.g the result of Actions#resolveDamage returns the updatedTarget and updatedOthers separately. Joining them together doesn't respect the turn order, which is determined by Combatant.index.

Once a turn has finished the queue of Combatants is re ordered according to the initiative scores. This may be too late and could result in a Combatant losing their turn or gaining an extra turn.

Implementation of Focus for players to fight a preferred enemy.

Currently the implementations of Focus are: LowestFirst and RandomFocus.

A Cleric, for example, would favour focusing Undead enemies, being able to use their Turn Undead ability. Furthermore if the Undead has been Turned they could move onto another enemy.

In Move.scala the method:
def nextToFocus(combatantsToAttack: Queue[Combatant], focus: Focus): Option[Combatant]
would match on the new type and perform this logic.

This can be tested in isolation in MoveSpec.scala

Add Exhausted condition for Path of the Berserker

Path of the Berserker Barbarian's currently doesn't gain exhaustion when Frenzy ends.

This involves adding a new Condition: Exhuasted, which has number of levels. As a first iteration only one level of exhaustion could be added.

This should apply when the Berserker's rage ends: either rageTurns reaches 0 or it has not attacked/been damaged for a turn.

Depends on #23

Monster abilities implement levelRequirement

Abilities must implement a levelRequirement, however monster specific abilities such as mutliAttack have no use for the levelRequirement field as Monster has no concept of Level, instead implementing a challenge rating.

There is unlikely to be any ability used by both Players and Monsters. Likely a separate implementation is more appropriate (e.g Extra Attack / Multi Attack).

One possibility is to drop levelRequirement from Ability. This is undeseriable as it's main usage is to remind the developer to implement this and consider it.

Another option is to have a Level to represent Monsters (e.g LevelZero), however this will cause issues when pattern matching over levels (see Cleric#clericSpellSlots) where this would not make sense.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.