Ejemplo n.º 1
0
        private void Explode(Missile m)
        {
            SoundManager.PlayByFileName(explodeSFX);
            Rectangle area = new Rectangle(m.curPos.X - 12, m.curPos.Y - 12, 56, 56);

            Art explosion = new Art();

            explosion.SrcImage      = contactArt;
            explosion.AutoRemove    = true;
            explosion.Frames        = contactArtFrames;
            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> hitTargets = GamePlay.GetEnemies(area, team);

            foreach (Character c in hitTargets)
            {
                if (GamePlay.CheckHit(Owner, c, this))
                {
                    GamePlay.InfictDamage(Owner, c, GamePlay.DamageCalculation(Owner, c, this));
                }
            }
        }
Ejemplo n.º 2
0
        public override void Casting()
        {
            int forORback;

            if (CurCastingStage <= 3)
            {
                forORback = 1;
            }
            else
            {
                forORback = -1;
            }

            Owner.AniFrame += 1;

            if (Owner.LastDir == Dir.Up)
            {
                Owner.OffSet.Y -= forORback * 4;
            }
            else if (Owner.LastDir == Dir.Down)
            {
                Owner.OffSet.Y += forORback * 4;
            }
            else if (Owner.LastDir == Dir.Left)
            {
                Owner.OffSet.X -= forORback * 4;
            }
            else if (Owner.LastDir == Dir.Right)
            {
                Owner.OffSet.X += forORback * 4;
            }

            if (CurCastingStage == 1)
            {
                SoundManager.PlayByFileName("Attack");
            }
            else if (CurCastingStage == 3)
            {
                Rectangle        area       = new Rectangle(Owner.CurRawPos.X + 12, Owner.CurRawPos.Y + 12, Owner.charType.Size.X - 24, Owner.charType.Size.Y - 24);
                List <Character> hitTargets = 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));
                    }
                }
            }
            else if (CurCastingStage >= CastingStages)
            {
                Owner.FrameNum  = 2;
                Owner.AniFrame  = Owner.AniFrame;
                Finished        = true;
                Owner.IsCasting = false;
            }
        }
Ejemplo n.º 3
0
        public override void MissileHit(Missile missile, Character target)
        {
            if (target == null)
            {
                return;
            }

            if (GamePlay.CheckHit(Owner, target, this))
            {
                GamePlay.InfictDamage(Owner, target, GamePlay.DamageCalculation(Owner, target, this));
            }
        }
Ejemplo n.º 4
0
        public override void MissileHit(Missile missile, Character target)
        {
            if (target == null)
            {
                return;
            }

            if (GamePlay.CheckHit(Owner, target, this))
            {
                SoundManager.PlayByFileName("BowHit");
                GamePlay.InfictDamage(Owner, target, GamePlay.DamageCalculation(Owner, target, this));
            }
        }
Ejemplo n.º 5
0
        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;
            }
        }
Ejemplo n.º 6
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;
            }
        }
Ejemplo n.º 7
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;
            }
        }
Ejemplo n.º 8
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;
            }
        }
Ejemplo n.º 9
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;
            }
        }