Ejemplo n.º 1
0
func (m *Mob) Damage(amount int) {
	amountLeft := amount

	if m.shield > 0 {
		shieldDamage := num.MinI(m.shield, amountLeft)
		m.shield -= shieldDamage
		amountLeft -= shieldDamage

		// Freebie damage reduction from destroying shields. Only really
		// massive damage penetrates on the same turn.
		amountLeft = num.MaxI(0, amountLeft-3)
	}

	m.health = num.MaxI(0, m.health-amountLeft)
}
Ejemplo n.º 2
0
func (m *Mob) AddShield(amount int) {
	m.shield = num.MaxI(0, m.shield+amount)
}