def point_damage(universe,target,dmg,bodypart,damage_type=None):
bodypart = target.body.get_bodypart(bodypart)
if bodypart is None:
Common.debug(8,'No such bodypart! get_bodypart returned None')
return False
if bodypart.hp <= 0:
if bodypart.size != 0:
truth_about_death = bodypart_death(universe,target,bodypart,damage_type)
Common.debug(9,'Bodypart found dead. Applying death mechanic')
return truth_about_death
else:
Common.debug(8,'bodypart is a category. randomizing child')
bodypart = bodypart.get_children()[random.randrange(bodypart.get_children().__len__())]
if bodypart is None:
Common.debug(8, 'No bodypart found, point attack missed!')
return False
damage_remainder = damage(target,dmg,bodypart,damage_type)
if damage_remainder <= 0:
truth_about_death = bodypart_death(universe,target,bodypart,damage_type)
return True
评论列表
文章目录