def createEffects(self): p = self.unit.getPos() p = [p[0], p[1] - 15] if self.iconPos: PTRS["EFFECTS"].addEffect( Effects.FadingBuffEffect(self.iconPos, p, self.unit.floor, 30)) else: if "moveSpeed" in self.stats: if self.stats["moveSpeed"] < 1: PTRS["EFFECTS"].addEffect( Effects.FadingBuffEffect([0, 0], p, self.unit.floor, 30))
def use(self, user): if self.cooldown[0] <= 0: user.hitFrames = self.hitFrames[:] user.setState("attack", self.getTimeTaken()) self.user = user self.cooldown[0] = self.cooldown[1] self.targetSquare = posToCoords(user.target.getPos()) p = self.targetSquare self.flashingSquares = [] for i in [[-1, 0], [-1, -1], [1, 0], [1, -1], [0, -1], [1, 1], [-1, 1], [0, 1], [0, 0]]: e = Effects.FlashingSquare([p[0] + i[0], p[1] + i[1]], user.floor, self.getTimeTaken() * 2 / 4) PTRS["EFFECTS"].addEffect(e) self.flashingSquares += [e] if self.getSpellCircle(): e = Effects.SpellEffect(self.getSpellCircle(), self.owner.getPos(), user.floor, 20) PTRS["EFFECTS"].addEffect(e, 0)
def useCallback(self, user): if user.target and (user.canSeeUnit(user.target) and not user.target.isDead()) or user.target.isTrainingDummy(): for u in PTRS["UNITS"].getEnemyUnits(): d = dist(u.getPos(), user.target.getPos()) if d < self.radius: self.hitTarget(u, math.atan2(u.getPos()[1] - user.target.getPos()[1], u.getPos()[0] - user.target.getPos()[0]), user.getStat("attack"), 1) PTRS["EFFECTS"].addEffect(Effects.ExplosionEffect("FireballExplosion", user.target.getPos(), user.floor, 10))
def createEffects(self): self.sourceAbil.doImmolationEffect(self.unit) PTRS["EFFECTS"].addEffect( Effects.SpellEffect("Ignite", self.unit.getPos(), self.unit.floor, self.timeBetweenShots, True)) #WORKING ON IMMOLATION SKILL
def use(self, user): if self.isUsable(user): if Ability.use(self, user): e = Effects.SpellEffect(self.getSpellCircle(), self.owner.getPos(), user.floor, 20) PTRS["EFFECTS"].addEffect(e, 0) return True return False
def addNumberParameter(self, number): if 0 <= number < 5: PTRS["EFFECTS"].addEffect( Effects.TextEffect([ self.source[0] * TILESIZE[0], self.source[1] * TILESIZE[1] ], self.floor, [255] * 3, 30, str(number))) self.key = number
def hitTarget(self, target, angle, attack, damageMod): from Code.Units.Stats import calcKnockback #(self, unit, damageSource, damageType, totalDamage, timeBetweenDamage, timesToDamage) timeBetweenDamage = 10 timesToDamage = 10 target.addBuff(Buffs.DamageBuff(self, target, self.owner, self.DamageType, self.Damage, timeBetweenDamage, timesToDamage)) target.addKnockback(calcKnockback(angle, target, self.getKnockbackAmount(target))) PTRS["EFFECTS"].addEffect(Effects.SpellEffect("Ignite", target.getPos(), target.floor, 40, True, None, target))
def createEffects(self): p = self.unit.getPos() p = [p[0], p[1] - 15] if self.iconPos: PTRS["EFFECTS"].addEffect( Effects.FadingBuffEffect(self.iconPos, p, self.unit.floor, 30)) else: pass
def interactWithUnit(self, shrine): if self.favour < self.FavourLevels[2]: self.unit.addDamage(self.unit.getMaxHealth() / 3.0, None, 0) PTRS["EFFECTS"].addEffect( Effects.SpellEffect("Ignite", self.unit.getPos(), self.unit.floor, 40, True, None, self.unit)) elif self.favour > self.FavourLevels[-2]: self.unit.heal(self.unit.getMaxHealth() / 4.0, None) self.unit.addBuff( Buffs.StatBuff(None, self.unit, 200, { "moveSpeed": 1.2, "defense": 20 })) PTRS["EFFECTS"].addEffect( Effects.SpellEffect("Buffed", self.unit.getPos(), self.unit.floor, 40, True, None, self.unit))
def useCallback(self, user): targ = coordsToPos(self.targetSquare) if user.target and user.canSeeUnit(user.target) and not user.target.isDead(): for u in PTRS["UNITS"].getPlayers(): coords = posToCoords(u.getPos()) for e in self.flashingSquares: if e.coord[0] == coords[0] and e.coord[1] == coords[1]: self.hitTarget(u, math.atan2(u.getPos()[1] - targ[1], u.getPos()[0] - targ[0]), user.getStat("attack"), 1) pos = [self.targetSquare[0] * TILESIZE[0] + random.uniform(0, TILESIZE[0]), self.targetSquare[1] * TILESIZE[1] + random.uniform(0, TILESIZE[1])] PTRS["EFFECTS"].addEffect(Effects.ExplosionEffect(self.pic, pos, user.floor, 10))
def addNumberParameter(self, number): numberLookup = { 0: 6, 1: 20, 2: 40, 3: 60, 4: 80, 5: 100, 6: 150, 7: 200, 8: 300, 9: 600 } PTRS["EFFECTS"].addEffect( Effects.TextEffect( [self.source[0] * TILESIZE[0], self.source[1] * TILESIZE[1]], self.floor, [255] * 3, 30, str(numberLookup[number]))) self.time = numberLookup[number]
def drawMe(self, camera): maxToDraw = 3 maxFadeTime = 12 minFadeTime = 8 swordAngle = int(self.angOffset * 180 / math.pi) for i in range(maxToDraw): angPct = i / float(maxToDraw) angle = self.angOffset + (self.finalAngOffset - self.angOffset) * angPct duration = int(minFadeTime + (maxFadeTime - minFadeTime) * i / float(maxToDraw)) dist = self.distEnd distMod = math.fabs(maxToDraw / 2 - i) / float(maxToDraw) dist -= (self.distEnd - self.distStart) * distMod pos = [ self.user.getPos()[0] + math.cos(self.angFacing + angle) * dist, self.user.getPos()[1] + math.sin(self.angFacing + angle) * dist ] PTRS["EFFECTS"].addEffect( Effects.WeaponFadeEffect(self.picture, pos, duration, swordAngle)) swordAngle += 45
def update(self): PTRS["EFFECTS"].addEffect( Effects.LineEffect(self.pos, self.floor, self.endPos, 1, 20))
def createEffects(self): if self.damageType == damageTypes.FIRE: PTRS["EFFECTS"].addEffect( Effects.SpellEffect("Burn", self.unit.getPos(), self.unit.floor, 10, True))
def useCallback(self, user): ang = math.atan2(user.target.getPos()[1] - user.getPos()[1], user.target.getPos()[0] - user.getPos()[0]) d = min(dist(user.getPos(), user.target.getPos()), self.Range) pos = intOf([user.getPos()[0] + math.cos(ang) * d, user.getPos()[1] + math.sin(ang) * d]) PTRS["EFFECTS"].addEffect(Effects.ExplosionEffect("FrostExplosion", pos, user.floor, 70, 10, self))
def useCallback(self, user): targ = coordsToPos(self.targetSquare) pos = coordsToPos(self.targetSquare) PTRS["EFFECTS"].addEffect(Effects.LoopingExplosionEffect(self.pic, pos, user.floor, self, 15, 200, 3))
def useCallback(self, user): PTRS["EFFECTS"].addEffect(Effects.FollowingExplosionEffect("BigSlash", user, user.floor, self, 20, 4)) self.drawnSlash = True