Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def current_rendering(self):
health = (
ICombatant(self.entity).current_health /
ICombatant(self.entity).maximum_health)
for weight, sprite, color in self.choices:
if health <= weight:
return sprite, color
health -= weight
def update(self):
from flax.component import ICombatant
combatant = ICombatant(self.player)
#self.health_text.set_text("Health: {}".format(ICombatant(self.player).health))
self.health_meter.current = combatant.current_health
self.health_meter.maximum = combatant.maximum_health
self.strength_text.set_text("Strength: {}".format(combatant.strength))
self._invalidate()
def current_rendering(self):
health = (
ICombatant(self.entity).current_health /
ICombatant(self.entity).maximum_health)
for weight, sprite, color in self.choices:
if health <= weight:
return sprite, color
health -= weight
def do_melee_attack(event, combatant):
opponent = ICombatant(event.actor)
event.world.queue_immediate_event(
Damage(combatant.entity, opponent.strength))