func (b *Encounter) enemyTurn(player character.Player) (afterPlayer character.Player) { damage := b.enemyAttack(player) player.DamageHP(damage) if player.IsDown() { b.playerDown() } return player }
func (b *Encounter) playerTurn(player character.Player) (afterPlayer character.Player) { damage := b.playerAttack(player) b.Enemy.DamageHP(damage) if b.Enemy.IsDown() { exp := b.enemyDown() player.AddExp(exp) // 撃破経験値獲得 } return player }
func (b *Encounter) Battle(player character.Player) (afterPlayer character.Player) { if b.isFirstAttack(player.CharacterStatus, b.Enemy.CharacterStatus) { player = b.playerTurn(player) if !b.Enemy.IsDown() { player = b.enemyTurn(player) } } else { player = b.enemyTurn(player) if !player.IsDown() { player = b.playerTurn(player) } } return player }