Exemplo n.º 1
0
    def BeAttacked(self, attacker):
        armor = self.GetArmor() + self.GetBonusForAction("armor")
        defense = self.GetDefense() + self.GetBonusForAction("defense")
        offense = attacker.GetOffense() + attacker.GetBonusForAction("attack")
        damage = attacker.GetDamage() + attacker.GetBonusForAction("damage")
        # This will torque them off
        self.attitude = -1

        TextBox.MainText.AddText("Player (atk %d) attacks %s (def %d)" %
                                 (offense, self.name, defense))

        if (dice.StandardRoll(offense, defense) == 0):
            Barks.CreateFloatingBark("Player misses!", self.screenPosX - 128,
                                     self.screenPosY - 16)
            TextBox.MainText.AddText("Player misses %s." % (self.name))
            return

        realDamage = dice.DamageRoll(damage, armor)
        TextBox.MainText.AddText("Damage %d vs. armor %d" % (damage, armor))

        if (realDamage < 1):
            Barks.CreateFloatingBark("Armor Resists Damage!",
                                     self.screenPosX - 128,
                                     self.screenPosY - 16)
            TextBox.MainText.AddText("Player does no damage.")
            return

        Barks.CreateFloatingBark("Player hits for %d!" % realDamage,
                                 self.screenPosX - 128, self.screenPosY - 16)
        TextBox.MainText.AddText("%s takes %d damage." %
                                 (self.name, realDamage))
        self.TakeDamage(realDamage)

        return
Exemplo n.º 2
0
    def TakeBoltAttack(self, boltLevel, attacker):
        if (boltLevel<1):
            boltLevel = 1
        if (boltLevel>4):
            boltLevel = 4

        attackerLevel = attacker.PC.Attributes.GetAttribute("Wil")+attacker.PC.Attributes.GetSkill("magic")+attacker.GetBonusForAction("magic")
        defenderLevel = self.Attributes.GetAttribute("Wil")+self.Attributes.GetSkill("magic defense")+self.GetBonusForAction("magic defense")

        damageBase = 10 + attacker.PC.Attributes.GetSkill("magic") + attacker.GetBonusForAction("magic")

        totalDamage = 0
        for x in range(0,boltLevel):
            totalDamage += dice.DamageRoll(damageBase,0)


        save = dice.StandardRoll(defenderLevel, attackerLevel)
        
        if (save):
            totalDamage = (1+totalDamage)/2
            Barks.CreateFloatingBark("Saved! Reduced Damage (%d)!"%totalDamage,self.screenPosX, self.screenPosY)               
            TextBox.MainText.AddText("%s saves against magic "%self.name)
            TextBox.MainText.AddText("(%d to %d) for %d damage."%(attackerLevel,defenderLevel,totalDamage))
        else:
            Barks.CreateFloatingBark("Smack-down by bolt for %d damage!"%totalDamage,self.screenPosX, self.screenPosY)                           
            TextBox.MainText.AddText("%s fails saves against magic "%self.name)
            TextBox.MainText.AddText("(%d to %d) for %d damage."%(attackerLevel,defenderLevel,totalDamage))

        self.TakeDamage(totalDamage)
Exemplo n.º 3
0
    def HealSelf(self, spellLevel):
        if (spellLevel < 1):
            spellLevel = 1
        if (spellLevel > 4):
            spellLevel = 4
        healBase = 6 + (self.PC.Attributes.GetSkill("magic") +
                        self.GetBonusForAction("magic")) * 2
        healTotal = 0
        for x in range(0, spellLevel):
            healTotal += dice.DamageRoll(healBase, 0)

        Barks.CreateFloatingBark("Healed for %d" % healTotal, self.screenPosX,
                                 self.screenPosY)
        TextBox.MainText.AddText("Player heals self for %d." % healTotal)

        self.PC.Heal(healTotal)
Exemplo n.º 4
0
 def CheckForTraps(self, oPC):
     if (self.trap < 1):
         return 1
     lockpicking = oPC.PC.Attributes.GetAttribute('Wits') + oPC.PC.Attributes.GetSkill("Search")+oPC.GetBonusForAction("Search")
     rslt = dice.StandardRoll(lockpicking,
                              self.trap)
     if (rslt>0):
         TextBox.MainText.AddText("Player (%d) avoids trap (%d)"%(lockpicking,self.trap))
         Barks.CreateFloatingBark("Player avoids trap!",oPC.screenPosX - 128,oPC.screenPosY -16)
     else:
         TextBox.MainText.AddText("Player (%d) accidentally sets off trap (%d)"%(lockpicking,self.trap))
         damageLevel = self.trap / 2
         realDamage = dice.DamageRoll(damageLevel,oPC.PC.GetArmor())
         Barks.CreateFloatingBark("Boom! Player sets off trap for %d damage!"%realDamage,oPC.screenPosX - 128,oPC.screenPosY -16)
         TextBox.MainText.AddText("Player takes %d damage through armor."%realDamage)
         oPC.TakeDamage(realDamage)
Exemplo n.º 5
0
    def BeAttacked(self, attacker):
        armor = self.GetArmor() + self.GetBonusForAction("armor")
        defense = self.GetDefense() + self.GetBonusForAction("defend")
        offense = attacker.GetOffense() + attacker.GetBonusForAction("attack")
        damage = attacker.GetDamage() + attacker.GetBonusForAction("damage")
        attackerVert = attacker.position.Y

        if (attackerVert == self.PC.position.Y):
            offsetY = 32
        else:
            offsetY = -16

        TextBox.MainText.AddText("%s (atk %d) attacks player (def %d)" %
                                 (attacker.name, offense, defense))

        if (dice.StandardRoll(offense, defense) == 0):
            Barks.CreateFloatingBark("%s misses player!" % attacker.name,
                                     self.screenPosX - 128,
                                     self.screenPosY + offsetY)
            TextBox.MainText.AddText("%s misses!" % attacker.name)
            return

        realDamage = dice.DamageRoll(damage, armor)
        TextBox.MainText.AddText("Damage %d vs. armor %d" % (damage, armor))
        if (realDamage < 1):
            Barks.CreateFloatingBark("Player's Armor Resists Damage!",
                                     self.screenPosX - 128,
                                     self.screenPosY + offsetY)
            TextBox.MainText.AddText("Attack does no damage!")
            return

        Barks.CreateFloatingBark(
            "%s hits Player for %d!" % (attacker.name, realDamage),
            self.screenPosX - 128, self.screenPosY + offsetY)
        TextBox.MainText.AddText("Player takes %d damage" % (realDamage))
        self.TakeDamage(realDamage)

        return