def from_skill(self, skill, source): self.template = skill self.damage_type = skill.active_damage_type self.accuracy = roll_calc(source, skill.accuracy_calc, skill.skill_level) self.damage = roll_calc(source, skill.damage_calc, skill.skill_level) self.adj_damage = self.damage self.adj_accuracy = self.accuracy self.source = source return self
def apply(self, owner, attack): try: validate_weapon(self, owner) validate_delivery(self, attack.delivery) validate_dam_type(self, attack.damage_type) except ActionError: return adj_accuracy = roll_calc(owner, self.avoid_calc, self.skill_level) combat_log(attack.source, lambda: ''.join(['{N} defense: ', self.name, ' adj_accuracy: ', str(adj_accuracy)]), self) attack.adj_accuracy -= adj_accuracy if attack.adj_accuracy < 0: return absorb = roll_calc(owner, self.absorb_calc, self.skill_level) combat_log(attack.source, lambda: ''.join(['{N} defense: ', self.name, ' absorb: ', str(absorb)]), self) attack.adj_damage -= absorb