Ejemplo n.º 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
}
Ejemplo n.º 2
0
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
}
Ejemplo n.º 3
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
}