Added definition for take_damage function