Esempio n. 1
0
 public void addArticles(params Article[] art)
 {
     for (int i = 0; i < art.Length; i++)
     {
         ArtList.Add(art[i]);
     }
 }
Esempio n. 2
0
        public override bool Cast()
        {
            if (base.Cast() == false)
            {
                return(false);
            }

            CastingTime          = 140;
            CastingStages        = 7;
            CurCastingStage      = 0;
            CastingStageInterval = CastingTime / CastingStages;
            SkillManager.NewCastingSkills.Add(this);

            Art shield = new Art();

            shield.SrcImage = "Shield";
            shield.Frames   = 1;
            shield.SrcRect  = new Rectangle(0, 0, Globals.TileSize, Globals.TileSize);
            shield.Angle    = Owner.LastDir;
            ArtList.Add(shield);
            SetShieldByOwnerPos();
            Game.World.AfterCharArts.Add(shield);

            return(true);
        }
        public override void Casting()
        {
            if (CurCastingStage == 0)
            {
                //Tạo art cây súng
                Art newArt = new Art();
                newArt.SrcImage = "Shotgun";
                newArt.SrcRect  = new Rectangle(0, 0, Globals.TileSize, Globals.TileSize);
                newArt.Angle    = Owner.LastDir;
                if (Owner.LastDir == Dir.Up)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y - 16, 32, 32);
                    Game.World.BeforeCharArts.Add(newArt);
                }
                else if (Owner.LastDir == Dir.Down || Owner.LastDir == Dir.Stand)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y + 16, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X - 16, Owner.CurRawPos.Y, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }
                else
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X + 16, Owner.CurRawPos.Y, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }
                ArtList.Add(newArt);
            }
            else
            {
                //Tạo missile
                Missile m = new Missile(new TileLayer("1", 1, 0), 32, 32, Owner, this, Owner.CurRawPos, Owner.LastDir, 16, 3, 0);
                Game.World.MissileList.Add(m);
                m = new Missile(new TileLayer("1", 1, 0), 32, 32, Owner, this, Owner.CurRawPos, Owner.LastDir, 16, 3, Math.PI / 6);
                Game.World.MissileList.Add(m);
                m = new Missile(new TileLayer("1", 1, 0), 32, 32, Owner, this, Owner.CurRawPos, Owner.LastDir, 16, 3, -Math.PI / 6);
                Game.World.MissileList.Add(m);
                Owner.IsCasting = false;
            }

            if (CurCastingStage >= CastingStages)
            {
                Finished          = true;
                ArtList[0].remove = true;
                ArtList.Clear();
                Owner.IsCasting = false;
            }
        }
Esempio n. 4
0
        public override void Casting()
        {
            if (CurCastingStage == 0)
            {
                //Tạo art cây súng
                Art newArt = new Art();
                newArt.SrcImage = "Bow";
                newArt.SrcRect  = new Rectangle(0, 0, Globals.TileSize, Globals.TileSize);
                //newArt.Angle = Game.GetAngleByCharacterFacing(Owner, true, true);
                newArt.Angle = Owner.LastDir;
                if (Owner.LastDir == Dir.Up)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y - 12, 32, 32);
                    Game.World.BeforeCharArts.Add(newArt);
                }
                else if (Owner.LastDir == Dir.Down || Owner.LastDir == Dir.Stand)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y + 12, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X - 12, Owner.CurRawPos.Y, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }
                else
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X + 12, Owner.CurRawPos.Y, 32, 32);
                    Game.World.AfterCharArts.Add(newArt);
                }

                ArtList.Add(newArt);
            }
            else
            {
                //Tạo missile
                Missile m = new Missile(new TileLayer("1", 2, 0), 32, 32, Owner, this, Owner.CurRawPos, Owner.LastDir, 12, 10, 0);
                Game.World.MissileList.Add(m);
                Owner.IsCasting = false;
                SoundManager.PlayByFileName("Bow");
            }

            if (CurCastingStage >= CastingStages)
            {
                Finished          = true;
                ArtList[0].remove = true;
                ArtList.Clear();
                Owner.IsCasting = false;
            }
        }
Esempio n. 5
0
        public override void Casting()
        {
            Owner.AniFrame += 1;

            foreach (Art a in ArtList)
            {
                a.Position.Y   += Globals.TileSize * 2;
                a.SkillCounter += 1;
                if (a.SkillCounter >= 5 && !a.remove)
                {
                    a.remove = true;
                    SoundManager.PlayByFileName("Explosion");
                    Rectangle area = new Rectangle(a.Position.X + 8, a.Position.Y + 8, a.Position.Width - 16, a.Position.Height - 16);

                    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      = a.Position;
                    Game.World.AfterCharArts.Add(explosion);

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

            if (CurCastingStage % 5 == 0 && CurCastingStage < CastingStages - 10)
            {
                SoundManager.PlayByFileName("ThrowBomb");
                Art newArt = new Art();
                newArt.SrcImage = "Ball";
                newArt.SrcRect  = new Rectangle(0, 0, Globals.TileSize * 4, Globals.TileSize * 4);
                Rectangle loc = new Rectangle(
                    Globals.gen.Next(Game.Player.CurRawPos.X - 3 * Globals.TileSize, Game.Player.CurRawPos.X + Game.Player.charType.Size.X + 2 * Globals.TileSize),
                    Globals.gen.Next(Game.Player.CurRawPos.Y - 3 * Globals.TileSize, Game.Player.CurRawPos.Y + Game.Player.charType.Size.Y + 2 * Globals.TileSize),
                    Globals.TileSize * 4, Globals.TileSize * 4);
                newArt.Position = new Rectangle(loc.X, loc.Y - 10 * Globals.TileSize, loc.Width, loc.Height);
                ArtList.Add(newArt);
                Game.World.AfterCharArts.Add(newArt);
            }

            if (CurCastingStage % 20 == 0)
            {
                SoundManager.PlayByFileName("Laugh");
            }

            if (CurCastingStage >= CastingStages)
            {
                Finished = true;
                foreach (Art a in ArtList)
                {
                    a.remove = true;
                }
                ArtList.Clear();
                Owner.IsCasting = false;
                Owner.charType.Source.srcPos.Y = 0;
            }
        }
        public override void Casting()
        {
            if (CurCastingStage == 0)
            {
                //Tạo art
                Art newArt = new Art();
                newArt.SrcImage = swordArt;
                newArt.SrcRect  = new Rectangle(0, 0, Globals.TileSize, Globals.TileSize);
                newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y, Globals.TileSize, Globals.TileSize);
                //newArt.Angle = Game.GetAngleByCharacterFacing(Owner, true, true);
                newArt.Angle = Owner.LastDir;
                ArtList.Add(newArt);
                if (Owner.LastDir == Dir.Up)
                {
                    Game.World.BeforeCharArts.Add(newArt);
                }
                else
                {
                    Game.World.AfterCharArts.Add(newArt);
                }
            }
            else if (CurCastingStage <= 5)
            {
                //Di chuyển art của cây kiếm đi về phía trước
                if (Owner.LastDir == Dir.Up)
                {
                    ArtList[0].Position.Y -= 4;
                }
                else if (Owner.LastDir == Dir.Down)
                {
                    ArtList[0].Position.Y += 4;
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    ArtList[0].Position.X -= 4;
                }
                else if (Owner.LastDir == Dir.Right)
                {
                    ArtList[0].Position.X += 4;
                }
            }
            else
            {
                //Di chuyển art của cây kiếm lùi ra sau
                if (Owner.LastDir == Dir.Up)
                {
                    ArtList[0].Position.Y += 4;
                }
                else if (Owner.LastDir == Dir.Down)
                {
                    ArtList[0].Position.Y -= 4;
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    ArtList[0].Position.X += 4;
                }
                else if (Owner.LastDir == Dir.Right)
                {
                    ArtList[0].Position.X -= 4;
                }
            }

            if (CurCastingStage == 5)
            {
                //Gây damage
                Rectangle area = new Rectangle();
                if (Owner.LastDir == Dir.Up)
                {
                    area = new Rectangle(Owner.CurRawPos.X + 6, Owner.CurRawPos.Y - 20, 20, 20);
                }
                else if (Owner.LastDir == Dir.Down)
                {
                    area = new Rectangle(Owner.CurRawPos.X + 6, Owner.CurRawPos.Y + Owner.charType.Size.Y, 20, 20);
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    area = new Rectangle(Owner.CurRawPos.X - 20, Owner.CurRawPos.Y + 6, 20, 20);
                }
                else if (Owner.LastDir == Dir.Right)
                {
                    area = new Rectangle(Owner.CurRawPos.X + Owner.charType.Size.X, Owner.CurRawPos.Y + 6, 20, 20);
                }
                List <Character> targets = GamePlay.GetEnemies(area, Owner.team);
                foreach (Character c in targets)
                {
                    if (GamePlay.CheckHit(Owner, c, this))
                    {
                        int damage = GamePlay.DamageCalculation(Owner, c, this);
                        GamePlay.InfictDamage(Owner, c, damage);
                        Owner.MP += (int)(Owner.MPMax * PercentManaRecover);
                    }
                }
            }

            if (CurCastingStage >= CastingStages)
            {
                Finished          = true;
                ArtList[0].remove = true;
                Owner.IsCasting   = false;
            }
        }
Esempio n. 7
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;
            }
        }
Esempio n. 8
0
        public override void Casting()
        {
            if (CurCastingStage == 0)
            {
                //Tạo art
                Art newArt = new Art();
                newArt.SrcImage      = "Bite";
                newArt.Frames        = 5;
                newArt.FrameInterval = 10000;
                newArt.SrcRect       = new Rectangle(0, 0, Globals.TileSize, Globals.TileSize);
                if (Owner.LastDir == Dir.Up)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y - Globals.TileSize, Globals.TileSize, Globals.TileSize);
                }
                else if (Owner.LastDir == Dir.Down)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X, Owner.CurRawPos.Y + Owner.charType.Size.Y, Globals.TileSize, Globals.TileSize);
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X - Globals.TileSize, Owner.CurRawPos.Y, Globals.TileSize, Globals.TileSize);
                }
                else if (Owner.LastDir == Dir.Right)
                {
                    newArt.Position = new Rectangle(Owner.CurRawPos.X + Owner.charType.Size.X, Owner.CurRawPos.Y, Globals.TileSize, Globals.TileSize);
                }
                ArtList.Add(newArt);
                Game.World.AfterCharArts.Add(newArt);
            }
            else
            {
                ArtList[0].CurFrame += 1;
            }


            if (CurCastingStage == 3)
            {
                //Gây damage
                Rectangle area = new Rectangle();
                if (Owner.LastDir == Dir.Up)
                {
                    area = new Rectangle(Owner.CurRawPos.X + 6, Owner.CurRawPos.Y - 20, 20, 20);
                }
                else if (Owner.LastDir == Dir.Down)
                {
                    area = new Rectangle(Owner.CurRawPos.X + 6, Owner.CurRawPos.Y + Owner.charType.Size.Y, 20, 20);
                }
                else if (Owner.LastDir == Dir.Left)
                {
                    area = new Rectangle(Owner.CurRawPos.X - 20, Owner.CurRawPos.Y + 6, 20, 20);
                }
                else if (Owner.LastDir == Dir.Right)
                {
                    area = new Rectangle(Owner.CurRawPos.X + Owner.charType.Size.X, Owner.CurRawPos.Y + 6, 20, 20);
                }
                List <Character> targets = GamePlay.GetEnemies(area, Owner.team);
                foreach (Character c in targets)
                {
                    if (GamePlay.CheckHit(Owner, c, this))
                    {
                        GamePlay.InfictDamage(Owner, c, GamePlay.DamageCalculation(Owner, c, this));
                    }
                }
            }

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