コード例 #1
0
        public Item GetBounty()
        {
            active = false;
            var item = ItemsList.GetItemByLvl(Game.maxDungeonLevel + (Game.player.perksSystem.CheckPerk(PerksList.luckPerk) ? 2 : 0));

            StatusLine.AddLine(" " + " You got in the chest: " + item.name);
            return(item);
        }
コード例 #2
0
 public void Attack(Persona persona)
 {
     StatusLine.AddLine(" " + name + " attack " + persona.name);
     persona.ReceiveAttack(attack, this);
     if (this is Player)
     {
         if (Game.player.perksSystem.CheckPerk(PerksList.doubleAttackPerk) && (persona.helth > 0))
         {
             StatusLine.AddLine(" " + Game.player.name + " do double attack");
             persona.ReceiveAttack(attack, this);
         }
     }
 }
コード例 #3
0
 static public void HuricaneBlast()
 {
     for (int i = -3; i < 4; ++i)
     {
         for (int j = -3; j < 4; ++j)
         {
             var enemy = Game.world.dungeon.GetEnemyOverPosition((int)Game.player.GetPosition().X + i,
                                                                 (int)Game.player.GetPosition().Y + j);
             if (enemy != null)
             {
                 StatusLine.AddLine(" You use Huricane Blast on " + enemy.name);
                 enemy.ReceiveAttack(Game.player.specification.spellPower * 2, Game.player);
             }
         }
     }
 }
コード例 #4
0
 static public void EchoStun()
 {
     for (int i = -1; i < 2; ++i)
     {
         for (int j = -1; j < 2; ++j)
         {
             var enemy = Game.world.dungeon.GetEnemyOverPosition((int)Game.player.GetPosition().X + i,
                                                                 (int)Game.player.GetPosition().Y + j);
             if (enemy != null)
             {
                 StatusLine.AddLine(" You stun: " + enemy.name);
                 enemy.inStun = true;
             }
         }
     }
 }
コード例 #5
0
 public void Cast()
 {
     if (this.name != "Empty magic")
     {
         if (Game.player.mana >= cost)
         {
             Game.player.mana -= cost;
             castDelegate();
             StatusLine.AddLine(" You use magic: " + name + " for " + cost + " mana");
         }
         else
         {
             StatusLine.AddLine(" You dont have enough mana for: " + name);
         }
     }
 }
コード例 #6
0
 static public void MeteorFlame()
 {
     for (int i = -1; i < 2; ++i)
     {
         for (int j = -1; j < 2; ++j)
         {
             var enemy = Game.world.dungeon.GetEnemyOverPosition((int)Game.player.GetPosition().X + i,
                                                                 (int)Game.player.GetPosition().Y + j);
             if (enemy != null)
             {
                 StatusLine.AddLine(" You use Meteor Flame on" + enemy.name);
                 enemy.inStun = true;
                 enemy.ReceiveAttack(Game.player.specification.spellPower, Game.player);
             }
         }
     }
 }
コード例 #7
0
        public void Update()
        {
            if (inStun)
            {
                StatusLine.AddLine(" " + name + " in stun");
                inStun = false;
            }
            else
            {
                if (CheckPlayer())
                {
                    Attack(Game.player);
                }
                else
                {
                    int value = DungeonGenerator.random.Next(0, 4);
                    switch (value)
                    {
                    case 0:
                        MoveUp();
                        break;

                    case 1:
                        MoveRight();
                        break;

                    case 2:
                        MoveDown();
                        break;

                    case 3:
                        MoveLeft();
                        break;
                    }
                }
            }
        }
コード例 #8
0
        public void Update()
        {
            if (inStun)
            {
                StatusLine.AddLine(" " + name + " in stun");
                inStun = false;
                isMove = true;
            }
            else
            {
                isMove = false;
                Console.SetCursorPosition(1, 1);

                char command = Console.ReadKey(true).KeyChar;
                switch (command)
                {
                case 'w':
                case 'W':
                    isMove = true;
                    AllChecks((int)position.X - 1, (int)position.Y);
                    MoveUp();
                    break;

                case 'd':
                case 'D':
                    isMove = true;
                    AllChecks((int)position.X, (int)position.Y + 1);
                    MoveRight();
                    break;

                case 's':
                case 'S':
                    isMove = true;
                    AllChecks((int)position.X + 1, (int)position.Y);
                    MoveDown();
                    break;

                case 'a':
                case 'A':
                    isMove = true;
                    AllChecks((int)position.X, (int)position.Y - 1);
                    MoveLeft();
                    break;

                case 'i':
                case 'I':
                    inventory.OpenInventory();
                    break;

                case 'u':
                case 'U':
                    specification.LevelUp();
                    break;

                case 'p':
                case 'P':
                    perksSystem.ShowPerks();
                    break;

                case 'q':
                case 'Q':
                    if (magicSystem.activeMagic != null)
                    {
                        magicSystem.activeMagic.Cast();
                    }
                    break;

                case 'm':
                case 'M':
                    magicSystem.ShowMagics();
                    break;
                }
            }
            Console.SetCursorPosition(1, 1);
            Console.Write(" ");
            Draw();
        }
コード例 #9
0
 public void ReceiveAttack(int attack, Persona whoMadeAttack)
 {
     if (DungeonGenerator.random.Next(0, 100) > whoMadeAttack.accuracy)
     {
         StatusLine.AddLine(" " + whoMadeAttack.name + " miss on " + name);
     }
     else
     {
         if (DungeonGenerator.random.Next(0, 100) < evasion)
         {
             StatusLine.AddLine(" " + name + " dodged an attack");
         }
         else
         {
             if ((this is Player) &&
                 Game.player.perksSystem.CheckPerk(PerksList.doubleMissPerk) &&
                 (DungeonGenerator.random.Next(0, 100) < evasion))
             {
                 StatusLine.AddLine(" " + name + " dodged an attack due to perk");
             }
             else
             {
                 int damage = attack - blocking;
                 if (damage < 0)
                 {
                     damage = 0;
                 }
                 StatusLine.AddLine(" " + whoMadeAttack.name + " hit " + name);
                 if (DungeonGenerator.random.Next(0, 100) < whoMadeAttack.criticalChance)
                 {
                     StatusLine.AddLine(" " + whoMadeAttack.name + " critical hit on " + name);
                     damage *= 2;
                 }
                 StatusLine.AddLine(" " + name + " received damage " + damage);
                 if (damage > 0)
                 {
                     helth -= damage;
                 }
                 StatusLine.AddLine(" " + name + " has helth: " + ((helth >= 0) ? Convert.ToString(helth) : "0"));
                 if (helth <= 0)
                 {
                     StatusLine.AddLine(" " + name + " killed");
                     if (!(this is Player))
                     {
                         int expectedExp  = (this as Enemy).expectedExp;
                         int expectedGold = (this as Enemy).expectedGold;
                         if (Game.player.perksSystem.CheckPerk(PerksList.receiverPerk))
                         {
                             expectedExp  += (int)(expectedExp * 0.2);
                             expectedGold += (int)(expectedGold * 0.2);
                         }
                         Game.player.specification.currentExp += expectedExp;
                         Game.player.currentGold += expectedGold;
                         if (Game.player.specification.currentExp >= Game.player.specification.maxExp)
                         {
                             ++Game.player.specification.levelPoint;
                             ++Game.player.specification.level;
                             int remainder = Game.player.specification.currentExp - Game.player.specification.maxExp;
                             Game.player.specification.currentExp = remainder;
                             Game.player.specification.maxExp    += 5;
                         }
                         StatusLine.AddLine(" " + Game.player.name + " received experience: " +
                                            expectedExp + ", gold: " + expectedGold);
                         if (this.name == "Diablo")
                         {
                             Console.Clear();
                             Console.WriteLine(" YOU KILL DIABLO, YOU ARE THE BEST");
                             Console.ReadKey();
                             Game.EndGame(true);
                         }
                         if (Game.player.perksSystem.CheckPerk(PerksList.cannibalPerk))
                         {
                             int canHeal = (int)(Game.player.maxHelth * 0.2);
                             Game.player.helth += canHeal;
                             if (Game.player.helth > Game.player.maxHelth)
                             {
                                 Game.player.helth = Game.player.maxHelth;
                             }
                             StatusLine.AddLine(" " + Game.player.name + " after kill " + this.name + " heal " + canHeal);
                         }
                     }
                     else
                     {
                         (this as Player).isDead = true;
                         Console.Clear();
                         Console.ForegroundColor = ConsoleColor.Red;
                         Console.WriteLine(" You are dead. Game Over.");
                         Console.ReadKey();
                         Game.EndGame();
                     }
                     if (this is Enemy)
                     {
                         Game.world.dungeon.enemyes.Remove(this as Enemy);
                     }
                 }
             }
         }
     }
 }