Пример #1
0
func (b *Encounter) enemyTurn(player character.Player) (afterPlayer character.Player) {
	damage := b.enemyAttack(player)
	player.DamageHP(damage)

	if player.IsDown() {
		b.playerDown()
	}

	return player
}
Пример #2
0
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
}