def AOEAttack(self,tile_x,tile_y, imagepath = 'images/magic/AOE_firelion.png'):#This is also known as Fire Lion! if dist(self.CurrentSprite().tile_x,self.CurrentSprite().tile_y, tile_x,tile_y)<=4: #print(tile_x+self.Board()._camTile_x,tile_y+self.Board()._camTile_y) HitAnyone=False for actor in self.Characters(): #print(actor.tile_x,actor.tile_y) if dist(actor.tile_x, actor.tile_y, tile_x, tile_y) <=1: HitAnyone=True self._currentSprite.Attack(actor,int(1.5*(self.CurrentSprite().Power()+self.CurrentSprite().ActionLevel(AOE)+random.randint(0,self.CurrentSprite().Power()/2)))) #print(self._currentSprite._Name, "attacked", actor._Name, 'with', AOE) if HitAnyone:#check if anyone was damaged, if not then don't do anything self._board.ClearLayer(self._board._shadowLayer) AttackSound = pygame.mixer.Sound("sound/explosion.wav") AttackSound.play() self.Board().AnimatedParticleEffect(128,128,imagepath,tile_x, tile_y) self._canAttack=False self.CancelMode() if CANCEL in self._currentActions: self._currentActions.remove(CANCEL) else: pass
def HealAction(self, tile_x, tile_y): if dist(self.CurrentSprite().tile_x,self.CurrentSprite().tile_y, tile_x,tile_y)<=2: HitAnyone=False for actor in self.Characters(): #print(actor.tile_x,actor.tile_y) if dist(actor.tile_x, actor.tile_y, tile_x, tile_y) <=1 and actor.Health()<actor.MaxHealth(): HitAnyone=True self.CurrentSprite().Heal(actor, 3*self.CurrentSprite().ActionLevel(HEAL)+random.randint(int(self.CurrentSprite().Power()),self.CurrentSprite().Power())) if HitAnyone:#check if anyone was damaged, if not then don't do anything self._board.ClearLayer(self._board._shadowLayer) HealSound = pygame.mixer.Sound("sound/Heal.wav") HealSound.play() #self.Board().AnimatedParticleEffect(128,128,imagepath,tile_x, tile_y) self._canAttack=False self.CancelMode() if CANCEL in self._currentActions: self._currentActions.remove(CANCEL)
def Whirlwind(self):#attacks all players (hostile or friendly) in adjacent spa HitAnyone=False for actor in self.Characters(): if dist(actor.tile_x, actor.tile_y, self.CurrentSprite().tile_x, self.CurrentSprite().tile_y) <=2 and actor.Alignment() != self.CurrentSprite().Alignment(): self._currentSprite.Attack(actor,self.CurrentSprite().Power()+3*self.CurrentSprite().ActionLevel(WHIRLWIND)+random.randint(0,self.CurrentSprite().Power())) HitAnyone=True if HitAnyone: AttackSound = pygame.mixer.Sound("sound/explosion.wav") AttackSound.play() self._canAttack=False self.CancelMode()