예제 #1
0
파일: Ninja.cs 프로젝트: yeatnaiceng/NCGAME
        public override void Skill3(List <AnimatedObject> AnmObj, Player player, string Direction)
        {
            int        X;
            int        Y;
            List <int> xDelete = new List <int>();
            List <int> yDelete = new List <int>();
            int        damage;

            if (player.Mp < 100)
            {
                return;
            }
            player.Mp -= 100;
            if (Direction == "Up")
            {
                X = player.X;
                Y = player.Y - 1;
            }
            else if (Direction == "Down")
            {
                X = player.X;
                Y = player.Y + 1;
            }
            else if (Direction == "Left")
            {
                X = player.X - 1;
                Y = player.Y;
            }
            else
            {
                X = player.X + 1;
                Y = player.Y;
            }

            foreach (AnimatedObject a in AnmObj)
            {
                if (a.X == X && a.Y == Y)
                {
                    if (a is Player)
                    {
                        Player b = a as Player;
                        damage = rnd.Next(_physicalAttackMin, _physicalAttackMax) * Mobility - rnd.Next(b.CharacterChosen.PhysicalDefenseMin, b.CharacterChosen.PhysicalDefenseMax);
                        if (damage > 0)
                        {
                            b.Hp -= damage;
                        }
                    }
                    else if (a is Obstacle)
                    {
                        Obstacle b = a as Obstacle;
                        damage = rnd.Next(_physicalAttackMin, _physicalAttackMax) * Mobility;
                        if (damage > 0)
                        {
                            b.Hp -= damage;
                        }
                    }
                    else if (a is Bomb)
                    {
                        Bomb b = a as Bomb;
                        xDelete.Add(a.X);
                        yDelete.Add(a.Y);
                        b.Explode(AnmObj);
                    }
                }
            }

            for (int a = 0; a < AnmObj.Count; a++)
            {
                for (int b = 0; b < xDelete.Count; b++)
                {
                    if (AnmObj[a].X == xDelete[b] && AnmObj[a].Y == yDelete[b])
                    {
                        AnmObj.RemoveAt(a);
                    }
                }
            }
        }
예제 #2
0
        public override void Skill1(List <AnimatedObject> AnmObj, Player player, string Direction)
        {
            int damage;
            int distance = 5;

            int[]      X       = new int[distance];
            int[]      Y       = new int[distance];
            List <int> xDelete = new List <int>();
            List <int> yDelete = new List <int>();

            if (player.Mp < 40)
            {
                return;
            }
            player.Mp -= 40;
            //Set Attack Range
            if (Direction == "Up")
            {
                for (int a = 0; a < distance; a++)
                {
                    X[a] = player.X;
                    Y[a] = player.Y - (a + 1);
                }
            }
            else if (Direction == "Down")
            {
                for (int a = 0; a < distance; a++)
                {
                    X[a] = player.X;
                    Y[a] = player.Y + (a + 1);
                }
            }
            else if (Direction == "Right")
            {
                for (int a = 0; a < distance; a++)
                {
                    X[a] = player.X + (a + 1);
                    Y[a] = player.Y;
                }
            }
            else
            {
                for (int a = 0; a < distance; a++)
                {
                    X[a] = player.X - (a + 1);
                    Y[a] = player.Y;
                }
            }
            //Skill activated
            for (int a = 0; a < distance; a++)
            {
                foreach (AnimatedObject b in AnmObj)
                {
                    if (b.X == X[a] && b.Y == Y[a])
                    {
                        if (b is Player)
                        {
                            Player c = b as Player;
                            damage = rnd.Next(_magicalAttackMin, _magicalAttackMax) * 2 - rnd.Next(c.CharacterChosen.MagicalDefenseMin, c.CharacterChosen.MagicalDefenseMax);
                            if (damage > 0)
                            {
                                c.Hp -= damage;
                            }
                        }
                        else if (b is Obstacle)
                        {
                            Obstacle c = b as Obstacle;
                            damage = rnd.Next(_magicalAttackMin, _magicalAttackMax) * 2;
                            if (damage > 0)
                            {
                                c.Hp -= damage;
                            }
                        }
                        else if (b is Bomb)
                        {
                            Bomb c = b as Bomb;
                            xDelete.Add(c.X);
                            yDelete.Add(c.Y);
                            c.Explode(AnmObj);
                        }
                    }
                }
            }
            for (int a = 0; a < AnmObj.Count; a++)
            {
                for (int b = 0; b < xDelete.Count; b++)
                {
                    if (AnmObj[a].X == xDelete[b] && AnmObj[a].Y == yDelete[b])
                    {
                        AnmObj.RemoveAt(a);
                    }
                }
            }
        }
예제 #3
0
        public override void Skill1(List <AnimatedObject> AnmObj, Player player, string Direction)
        {
            List <int> xDelete = new List <int>();
            List <int> yDelete = new List <int>();

            if (player.Mp < 20)
            {
                return;
            }
            player.Mp -= 20;
            int x_1, y_1;
            int x_2, y_2;
            int x_3, y_3;
            int damage;

            if (Direction == "Up")
            {
                x_1 = player.X - 1;
                x_2 = player.X;
                x_3 = player.X + 1;
                y_1 = player.Y - 1;
                y_2 = player.Y - 1;
                y_3 = player.Y - 1;
            }
            else if (Direction == "Down")
            {
                x_1 = player.X - 1;
                x_2 = player.X;
                x_3 = player.X + 1;
                y_1 = player.Y + 1;
                y_2 = player.Y + 1;
                y_3 = player.Y + 1;
            }
            else if (Direction == "Left")
            {
                x_1 = player.X - 1;
                x_2 = player.X - 1;
                x_3 = player.X - 1;
                y_1 = player.Y - 1;
                y_2 = player.Y;
                y_3 = player.Y + 1;
            }
            else
            {
                x_1 = player.X + 1;
                x_2 = player.X + 1;
                x_3 = player.X + 1;
                y_1 = player.Y - 1;
                y_2 = player.Y;
                y_3 = player.Y + 1;
            }
            foreach (AnimatedObject a in AnmObj)
            {
                if ((a.X == x_1 && a.Y == y_1) || (a.X == x_2 && a.Y == y_2) || (a.X == x_3 && a.Y == y_3))
                {
                    if (a is Player)
                    {
                        Player b = a as Player;

                        damage = rnd.Next(_physicalAttackMin, _physicalAttackMax) * 2 - rnd.Next(b.CharacterChosen.PhysicalDefenseMin, b.CharacterChosen.PhysicalDefenseMax);
                        if (damage > 0)
                        {
                            b.Hp -= damage;
                        }
                    }
                    else if (a is Obstacle)
                    {
                        Obstacle b = a as Obstacle;
                        damage = rnd.Next(_physicalAttackMin, _physicalAttackMax) * 2;
                        if (damage > 0)
                        {
                            b.Hp -= damage;
                        }
                    }
                    else if (a is Bomb)
                    {
                        Bomb b = a as Bomb;
                        xDelete.Add(b.X);
                        yDelete.Add(b.Y);
                        b.Explode(AnmObj);
                    }
                }
            }
            for (int a = 0; a < AnmObj.Count; a++)
            {
                for (int b = 0; b < xDelete.Count; b++)
                {
                    if (AnmObj[a].X == xDelete[b] && AnmObj[a].Y == yDelete[b])
                    {
                        AnmObj.RemoveAt(a);
                    }
                }
            }
        }
예제 #4
0
        public override void Skill3(List <AnimatedObject> AnmObj, Player player, string Direction)
        {
            int[]      x       = new int[25];
            int[]      y       = new int[25];
            List <int> xDelete = new List <int>();
            List <int> yDelete = new List <int>();
            int        index   = 0;

            if (player.Mp < 300)
            {
                return;
            }
            player.Mp -= 300;

            for (int a = 0; a < 5; a++)
            {
                for (int b = 0; b < 5; b++)
                {
                    if (Direction == "Up")
                    {
                        x[index] = (player.X - 2) + a;
                        y[index] = (player.Y + 1) + b;
                    }
                    else if (Direction == "Down")
                    {
                        x[index] = (player.X - 2) + a;
                        y[index] = (player.Y - 1) - b;
                    }
                    else if (Direction == "Left")
                    {
                        x[index] = (player.X - 1) - a;
                        y[index] = (player.Y + 2) - b;
                    }
                    else
                    {
                        x[index] = (player.X + 1) + a;
                        y[index] = (player.Y + 2) - b;
                    }
                    index++;
                }
            }

            for (int a = 0; a < 25; a++)
            {
                foreach (AnimatedObject b in AnmObj)
                {
                    if (b.X == x[a] && b.Y == y[a])
                    {
                        if (b is Player)
                        {
                            Player c = b as Player;
                            c.Hp -= 1000;
                        }
                        else if (b is Obstacle)
                        {
                            Obstacle c = b as Obstacle;
                            c.Hp -= 1000;
                        }
                        else if (b is Bomb)
                        {
                            Bomb c = b as Bomb;
                            xDelete.Add(c.X);
                            yDelete.Add(c.Y);
                            c.Explode(AnmObj);
                        }
                    }
                }
            }
            for (int a = 0; a < AnmObj.Count; a++)
            {
                for (int b = 0; b < xDelete.Count; b++)
                {
                    if (AnmObj[a].X == xDelete[b] && AnmObj[a].Y == yDelete[b])
                    {
                        AnmObj.RemoveAt(a);
                    }
                }
            }
        }
예제 #5
0
        public override void Skill3(List <AnimatedObject> AnmObj, Player player, string Direction)
        {
            int[]      X       = new int[9];
            int[]      Y       = new int[9];
            List <int> xDelete = new List <int>();
            List <int> yDelete = new List <int>();
            int        index   = 0;
            int        damage;

            if (player.Mp < 80)
            {
                return;
            }
            player.Mp -= 80;
            //Set Attack Range
            for (int a = 0; a < 3; a++)
            {
                for (int b = 0; b < 3; b++)
                {
                    if (Direction == "Up")
                    {
                        X[index] = (player.X - 1) + a;
                        Y[index] = (player.Y - 1) - b;
                    }
                    else if (Direction == "Down")
                    {
                        X[index] = (player.X - 1) + a;
                        Y[index] = (player.Y + 1) + b;
                    }
                    else if (Direction == "Left")
                    {
                        X[index] = (player.X - 1) - a;
                        Y[index] = (player.Y - 1) + b;
                    }
                    else
                    {
                        X[index] = (player.X + 1) + a;
                        Y[index] = (player.Y - 1) + b;
                    }
                    index++;
                }
            }

            for (int a = 0; a < 9; a++)
            {
                foreach (AnimatedObject b in AnmObj)
                {
                    if (b.X == X[a] && b.Y == Y[a])
                    {
                        if (b is Player)
                        {
                            Player c = b as Player;
                            damage = rnd.Next(_physicalAttackMin, _physicalAttackMax) * 3 - rnd.Next(c.CharacterChosen.PhysicalDefenseMin, c.CharacterChosen.PhysicalDefenseMax);
                            if (damage > 0)
                            {
                                c.Hp -= damage;
                            }
                        }
                        else if (b is Obstacle)
                        {
                            Obstacle c = b as Obstacle;
                            damage = rnd.Next(_physicalAttackMin, _physicalAttackMax) * 3;
                            if (damage > 0)
                            {
                                c.Hp -= damage;
                            }
                        }
                        else if (b is Bomb)
                        {
                            Bomb c = b as Bomb;
                            xDelete.Add(c.X);
                            yDelete.Add(c.Y);
                            c.Explode(AnmObj);
                        }
                    }
                }
            }
            for (int a = 0; a < AnmObj.Count; a++)
            {
                for (int b = 0; b < xDelete.Count; b++)
                {
                    if (AnmObj[a].X == xDelete[b] && AnmObj[a].Y == yDelete[b])
                    {
                        AnmObj.RemoveAt(a);
                    }
                }
            }
        }