public override void Casting()
        {
            if (CurCastingStage == 1)
            {
                SoundManager.PlayByFileName("Dash");
                ChangeFrameWhenCharging();
            }

            if (GamePlay.IsBlocked(Owner, distance, Owner.LastDir))
            {
                CurCastingStage = CastingStages;
            }
            else
            {
                if (Owner.LastDir == Dir.Up)
                {
                    Owner.OffSet.Y -= distance;
                }
                else if (Owner.LastDir == Dir.Down)
                {
                    Owner.OffSet.Y += distance;
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    Owner.OffSet.X -= distance;
                }
                else if (Owner.LastDir == Dir.Right)
                {
                    Owner.OffSet.X += distance;
                }
                Owner.SetPos();
                Owner.AniFrame += 1;

                List <Character> hitTargets = GamePlay.GetEnemies(Owner.HitBox, Owner.team);
                if (hitTargets.Count > 0)
                {
                    SoundManager.PlayByFileName("Explosion");
                    Rectangle area = new Rectangle(Owner.CurRawPos.X - 12, Owner.CurRawPos.Y - 12, 56, 56);

                    Art explosion = new Art();
                    explosion.SrcImage      = "Explosion";
                    explosion.AutoRemove    = true;
                    explosion.Frames        = 7;
                    explosion.FrameInterval = 50;
                    explosion.SrcRect       = new Rectangle(0, 0, Globals.TileSize * 2, Globals.TileSize * 2);
                    explosion.Position      = area;
                    Game.World.AfterCharArts.Add(explosion);

                    List <Character> targets = GamePlay.GetEnemies(area, Owner.team);
                    foreach (Character c in hitTargets)
                    {
                        if (GamePlay.CheckHit(Owner, c, this))
                        {
                            GamePlay.InfictDamage(Owner, c, GamePlay.DamageCalculation(Owner, c, this));
                        }
                    }

                    CurCastingStage = CastingStages;
                }
            }

            if (CurCastingStage >= CastingStages)
            {
                Owner.ResetPos();
                Finished        = true;
                Owner.IsCasting = false;
            }
        }
Esempio n. 2
0
        public override void Casting()
        {
            if (CurCastingStage == 1)
            {
                SoundManager.PlayByFileName("Dash");
            }

            if (GamePlay.IsBlocked(Owner, distance, Owner.LastDir))
            {
                CurCastingStage = CastingStages;
            }
            else
            {
                if (Owner.LastDir == Dir.Up)
                {
                    Owner.OffSet.Y -= distance;
                }
                else if (Owner.LastDir == Dir.Down)
                {
                    Owner.OffSet.Y += distance;
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    Owner.OffSet.X -= distance;
                }
                else if (Owner.LastDir == Dir.Right)
                {
                    Owner.OffSet.X += distance;
                }
                Owner.SetPos();
                Owner.AniFrame += 1;

                SetShieldByOwnerPos();

                List <Character> hitTargets = GamePlay.GetEnemies(Owner.HitBox, Owner.team);
                foreach (Character c in hitTargets)
                {
                    if (GamePlay.CheckHit(Owner, c, this) && targetList.Contains(c) == false)
                    {
                        targetList.Add(c);
                        SoundManager.PlayByFileName("Charge");
                        Art slash = new Art();
                        slash.SrcImage      = "Slash";
                        slash.AutoRemove    = true;
                        slash.Frames        = 6;
                        slash.FrameInterval = 30;
                        slash.SrcRect       = new Rectangle(0, 0, Globals.TileSize * 2, Globals.TileSize * 2);
                        slash.Position      = new Rectangle(c.CurRawPos.X - 16, c.CurRawPos.Y - 16, Globals.TileSize * 2, Globals.TileSize * 2);
                        ArtList.Add(slash);
                        Game.World.AfterCharArts.Add(slash);
                        GamePlay.InfictDamage(Owner, c, GamePlay.DamageCalculation(Owner, c, this));
                    }
                }
            }

            if (CurCastingStage >= CastingStages)
            {
                Owner.ResetPos();
                Finished          = true;
                ArtList[0].remove = true;
                ArtList.Clear();
                targetList.Clear();
                Owner.IsCasting = false;
            }
        }