Added moves with a cooldown

This commit is contained in:
dalyjame
2019-06-17 14:41:15 -04:00
parent a475126a3f
commit 908069f2bc
9 changed files with 289 additions and 24 deletions

View File

@@ -18,10 +18,17 @@ class BattleEngine(val player: Party, val enemy: Party)(implicit val reader: Sig
def playTurn(): Unit = {
val playerAction = player.pollAction(enemy)
playTurn(playerAction)
playTurnImp(playerAction)
}
def playTurn(playerAction: Action): Unit = {
playTurnImp(playerAction)
while (player.lead.isLocked) {
playTurn()
}
}
def playTurnImp(playerAction: Action): Unit = {
val enemyAction = enemy.pollAction(player)
val actions = Seq(playerAction, enemyAction)

View File

@@ -39,7 +39,9 @@ class BattleUI extends SignalConsumer {
}
def onMove(move: Move): Unit = {
val action = Action(engine.player.lead, move, engine.enemy.lead)
implicit val rng = engine.rng
implicit val reader = engine
val action = Action(engine.player.lead, move, engine.player.pollTarget(move, engine.player.lead, engine.enemy))
engine.playTurn(action)
updateUI()
}