Added support for volatile status effects including confusion and flinching. Also, all elements are now supported.

This commit is contained in:
James Daly
2019-06-03 22:46:09 -04:00
parent 34cd67c36f
commit ce81ab2079
12 changed files with 355 additions and 155 deletions

View File

@@ -23,8 +23,8 @@ class BattleEngine(val player: Party, val enemy: Party)(implicit val rng: Random
val queue = rng.shuffle(actions).sorted // Shuffle to randomize in the event of a tie
queue.foreach(useMove)
val eotQueue = Seq(player.lead, enemy.lead).sortBy(_(Speed))
eotQueue.foreach(mon => mon.status.map(_.onResidual(mon)))
eotQueue.foreach(mon => mon.statuses.map(_.onResidual(mon)))
if (!player.lead.isAlive) {
if (player.canFight) {
val replace = player.pollReplacement(enemy)
@@ -51,7 +51,7 @@ class BattleEngine(val player: Party, val enemy: Party)(implicit val rng: Random
val move = action.move
val target = action.target
if (user.isAlive) {
if (user.status.forall(_.onBeforeMove(user, move, target))) {
if (user.statuses.forall(_.onBeforeMove(user, move, target))) {
move.useMove(user, target)
}
}