def frag_grenade_explode(entity): _x, _y = movement.get_position(entity) _damage = entity['damage'] _size = 3 * int(round((_damage * .01))) effects.explosion(_x, _y, _size) for entity_id in entities.get_entity_group('life'): _entity = entities.get_entity(entity_id) _distance = numbers.distance((_x, _y), movement.get_position(_entity)) if _distance - 1 > _size or not life.can_see_position(_entity, (_x, _y)): continue entities.trigger_event(_entity, 'hit', projectile=entity, damage_mod=1 - ((_distance - 1) / float(_size)))
def frag_grenade_explode(entity): _x, _y = movement.get_position(entity) _damage = entity['damage'] _size = 3 * int(round((_damage * .01))) effects.explosion(_x, _y, _size) for entity_id in entities.get_entity_group('life'): _entity = entities.get_entity(entity_id) _distance = numbers.distance((_x, _y), movement.get_position(_entity)) if _distance - 1 > _size or not life.can_see_position( _entity, (_x, _y)): continue entities.trigger_event(_entity, 'hit', projectile=entity, damage_mod=1 - ((_distance - 1) / float(_size)))
def _handle_robot_death(entity): _x, _y = movement.get_position(entity) effects.explosion(_x, _y, 5)