예제 #1
0
    def runEffect(self, gl, t, distanceMulti=1.0):
        if distanceMulti == 1.0:

            subEffectDict[self.effectType](gl, t,
                                           rollAttack(self.dice,
                                                      self.diceSides))
        else:
            a = round(rollAttack(self.dice, self.diceSides) * distanceMulti)

            subEffectDict[self.effectType](gl, t, a)
예제 #2
0
    def __boltEffect(self, gl, user, targetCo, runEffect):
        eList = gl.getEntitiesInLineOfFire(user,
                                           targetCo,
                                           maxRange=self.maxRange)
        #ip = (user.co - targetCo).normalize()

        if len(eList) > 0:

            for e in eList:
                dist = user.co.distance(e.co)
                if rollAttack(2, 6) - dist > 0:  #to hit roll
                    if e.getShieldBlock < rollAttack(1, 4):
                        runEffect(e, dist)
                    break
예제 #3
0
    def __ballEffect(self, gl, user, targetCo, runEffect):
        eList = gl.getEntitiesInLineOfFire(user,
                                           targetCo,
                                           maxRange=self.maxRange)
        #eList = gl.getEntitiesBetweenPoints(user.co, targetCo, maxEntities=10000, maxRange=self.maxRange)
        ip = (user.co - targetCo).normalize()
        impactPoint = Coords(round(ip[0] * self.maxRange),
                             round(ip[1] * self.maxRange))
        if len(eList) > 0:

            for e in eList:
                dist = user.co.distance(e.co)
                if rollAttack(2, 6) - dist > 0:  #to hit roll
                    impactPoint = e.co

                    break
            if self.radius > 0:
                # entitiesInBlastArea = list(filter(lambda x: not gl.checkForObstructionBetweenPoints(x.co, impactPoint, maxRange=self.radius) and x.co != impactPoint, gl.allEntities))
                entitiesInBlastArea = list(
                    (e for e in gl.allEntities if e.co != impactPoint
                     and not gl.checkForObstructionBetweenPoints(
                         e.co, impactPoint, maxRange=self.radius)))
                map(lambda x: runEffect(x, x.co.distance(impactPoint)),
                    entitiesInBlastArea)
        else:
            # entitiesInBlastArea = list(filter(lambda x: not gl.checkForObstructionBetweenPoints(x.co, impactPoint, maxRange=self.radius) and x.co != impactPoint, gl.allEntities))
            entitiesInBlastArea = list(
                (e for e in gl.allEntities if e.co != impactPoint
                 and not gl.checkForObstructionBetweenPoints(
                     e.co, impactPoint, maxRange=self.radius)))

            map(lambda x: runEffect(x, x.co.distance(impactPoint)),
                entitiesInBlastArea)
예제 #4
0
 def useSpell(self, gl, user, targetCo):
     user.magic.addTo(-self.cost)
     if user.getSkillPlusBonus('SKILL_SPELLCRAFT') + rollAttack(
             2, 8) > self.difficulty:
         self.__magicEffect(gl, user, targetCo)
     else:
         user.incrementSkill('SKILL_SPELLCRAFT')
예제 #5
0
    def useDevice(self, gl, user, targetCo):
        if user.getSkillPlusBonus('SKILL_MAGIC_DEVICE') + rollAttack(
                2, 8) > self.difficulty:
            self.__magicEffect(gl, user, targetCo)

        else:
            user.incrementSkill('SKILL_MAGIC_DEVICE')
예제 #6
0
 def tryToDisarm(self, entity):
     roll = rollAttack(2, 4)
     if entity.getSkillPlusBonus('SKILL_TRAPS') + roll >= self.disarmDiff:
         return 1
     else:
         if entity.getSkillPlusBonus('SKILL_TRAPS') + 8 < self.disarmDiff:
             self.trapEffect.effect(entity)
             return -1
         #entity.incrementSkill('SKILL_TRAPS')
         return 0
예제 #7
0
    def tryToDisarm(self, entity):
        roll = rollAttack(2, 4)
        if entity.getSkillPlusBonus(
                'SKILL_TRAPS') + roll >= self.__trap['disarmDiff']:
            self.disarm()
        else:
            if entity.getSkillPlusBonus(
                    'SKILL_TRAPS') + 8 < self.__trap['disarmDiff']:
                self.__trap['effect'](entity)

            entity.incrementSkill('SKILL_TRAPS')
예제 #8
0
    def spawnForPlayer(cls, baseData, x, y, stack=-1):
        if baseData is None or baseData is DUMMY_ITEM:
            return cls(DUMMY_ITEM,
                       Coords(x, y),
                       E_NONE,
                       0,
                       False,
                       1,
                       identified=True)

        if stack == -1:
            stack = 1
        if baseData.typeOfItem == 'STAFF':
            stack = rollAttack(2, 1 + baseData.minLevel)

        return cls(baseData, Coords(x, y), E_NONE, 0, True, 1, identified=True)
예제 #9
0
 def rollThrownDamage(self):
     return round(
         rollAttack(self.__baseData.damageDice,
                    self.__baseData.damageDiceSides) *
         self.__baseData.multiplier) + self.extraDam
예제 #10
0
 def rollDamage(self):
     if self.__baseData.typeOfItem == 'WEAPON' or self.__baseData.typeOfItem == 'AMNUNITION':
         return rollAttack(self.__baseData.damageDice,
                           self.__baseData.damageDiceSides) + self.extraDam
     return 0