Fighting now takes into account the constitution. Closes #51
This commit is contained in:
@ -443,11 +443,12 @@ class FightingEntity(Entity):
|
||||
"""
|
||||
Take damage from the attacker, based on the stats
|
||||
"""
|
||||
self.health -= amount
|
||||
damage = max(0, amount - self.constitution)
|
||||
self.health -= damage
|
||||
if self.health <= 0:
|
||||
self.die()
|
||||
return _("{name} takes {amount} damage.")\
|
||||
.format(name=self.translated_name.capitalize(), amount=str(amount))\
|
||||
return _("{name} takes {damage} damage.")\
|
||||
.format(name=self.translated_name.capitalize(), damage=str(damage))\
|
||||
+ (" " + _("{name} dies.")
|
||||
.format(name=self.translated_name.capitalize())
|
||||
if self.health <= 0 else "")
|
||||
|
Reference in New Issue
Block a user