def doAction(self, attacker, defender): damage = self.spell.getDamage() if element.isWeak(self.spell.elem, defender.armor.elem): damage *= 2 defender.curhp -= damage attacker.curmp -= self.spell.mpcost print "DEBUG: %s damages %s with %s for %d damage" % (attacker.charactername, defender.charactername, self.spellname, damage)
def checkCondition(self, attacker, defenders): for defender in defenders: if element.isWeak(self.targetElement, defender.armor.elem): print "DEBUG: About to return %s as target" % defender return defender print "DEBUG: No target found for weak against %s" % self.targetElement return None
def doAction(self, attacker, defender): damage = attacker.weapon.getDamage() reduction = defender.armor.getDamageReduction() if element.isWeak(attacker.weapon.elem, defender.armor.elem): damage *= 2 damage -= reduction damage = max(1, damage) defender.curhp -= damage print "DEBUG: %s damages %s for %d damage" % (attacker.charactername, defender.charactername, damage)