Beispiel #1
0
 internal Enemy CreateGnomeScout(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     Monster tama = new Monster(10, 10, 100);
     Enemy enemy = new Enemy(tama, "Gnome Scout", rng.Next(2, 10 * level), 0, 0, level, drops);
     return enemy;
 }
Beispiel #2
0
 internal Enemy CreateFirefly(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     drops.Add(IC.CreateHPItem("HP potion 10", Item.equipment.potion, 10, 0));
     Monster monster = new Monster(10, 10, 100);
     Enemy enemy = new Enemy(monster, "Firefly", rng.Next(0, 5 * level), rng.Next(0, 5 * level), 0, level, drops);
     return enemy;
 }
Beispiel #3
0
 internal Enemy CreateGnome(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     drops.Add(IC.CreateHPItem("HP potion 10", Item.equipment.potion, 10, 0));
     Monster tama = new Monster(10, 2, 50);
     Enemy enemy = new Enemy(tama, "Gnome", rng.Next(0, 10 * level), 0, rng.Next(0, 5 * level), level, drops);
     return enemy;
 }
Beispiel #4
0
 internal Enemy CreateFairy(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     drops.Add(IC.CreateHPItem("HP potion 10", Item.equipment.potion, 10, 0));
     drops.Add(IC.CreateAtkItem("Bronze wand", Item.equipment.weapon, 15, 0, 100));
     Monster tama = new Monster(10, 5, 40);
     tama.Weapon = IC.CreateAtkItem("Bronze wand", Item.equipment.weapon, 15, 0, 100);
     Enemy enemy = new Enemy(tama, "Fairy", rng.Next(0, 10 * level), 0, rng.Next(0, 5 * level), level, drops);
     return enemy;
 }
Beispiel #5
0
 internal Enemy CreateGoblin(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     drops.Add(IC.CreateArmorItem("Bronze chest", Item.equipment.chest, 10, 0));
     drops.Add(IC.CreateHPItem("HP potion 10", Item.equipment.potion, 10, 0));
     drops.Add(IC.CreateAtkItem("Bronze dagger", Item.equipment.weapon, 5, 0, 100));
     Monster tama = new Monster(5, 2, 50);
     tama.Weapon = IC.CreateAtkItem("Bronze dagger", Item.equipment.weapon, 5, 0, 100);
     Enemy enemy = new Enemy(tama, "Goblin", rng.Next(0, 10 * level), 0, rng.Next(0, 5 * level), level, drops);
     return enemy;
 }
Beispiel #6
0
        /// <summary>
        /// Takes in a player object to get the items there can be used in the fight and setup a fight between the 2 Monsters
        /// the user keeps interacting between each attack and can either attack, use item or run from the fight
        /// </summary>
        /// <param name="player"></param>
        /// <param name="you"></param>
        /// <param name="enemy"></param>
        /// <returns></returns>
        internal Player FightMonster(Player player, Monster you, Enemy ene)
        {
            this.you = you;
            old = you;
            Monster enemy = ene.Tama;
            enemy.prepareForBattle(); //Configures the attack and armor to itself if it has been modified by a battle before
            this.you.prepareForBattle();  //Configures the attack and armor to itself if it has been modified by a battle before

            int choice = 0;
            Console.Clear();
            while (enemy.CurrentHealth > 0 && this.you.CurrentHealth > 0)
            {

            fightingMenu:
                Console.WriteLine("****************");
                Console.WriteLine("Enemy: " + enemy.CurrentHealth + " you: " + this.you.CurrentHealth);
                Console.WriteLine("****************");
                Console.WriteLine("Enemy stats: armor: " + enemy.CurrentArmor + " attack: " + enemy.CurrentAttack);
                Console.WriteLine();
                Console.WriteLine("Your stats: armor: " + this.you.CurrentArmor + " attack: " + this.you.CurrentAttack);
                Console.WriteLine("****************");
                Console.WriteLine();
                Console.WriteLine("1. Do you wanna attack?");
                Console.WriteLine("2. Use an item?");
                Console.WriteLine("3. Run from the fight?");

                try
                {
                    choice = Convert.ToInt32(Console.ReadLine());
                    Console.Clear();
                }
                catch (Exception)
                {
                    Console.Clear();
                    goto fightingMenu;
                }

                switch (choice)
                {
                    case 1:
                        int a = attack(this.you, enemy);
                        enemy.CurrentHealth -= a;
                        Console.WriteLine("You did " + a + " damage to it");
                        Console.WriteLine();
                        break;
                    case 2:
                        if (player.Inventory.Count <= 0)
                        {
                            goto fightingMenu;
                        }
                        for (int i = 0; i < player.Inventory.Count; i++)
                        {
                            if (!player.Inventory[i].Name.Contains("potion"))
                            {
                                goto fightingMenu;

                            }

                        }
                        player = useItem(player, this.you);
                        goto fightingMenu;
                    case 3:
                        this.you.CurrentHealth = this.you.MaxHealth;
                        player.Monsters.Remove(old);
                        player.Monsters.Add(this.you);
                        return player;
                    default:
                        goto fightingMenu;
                }

                if (enemy.CurrentHealth > 0 && this.you.CurrentHealth > 0)
                {
                    int a = attack(enemy, this.you);
                    this.you.CurrentHealth -= a;
                    Console.WriteLine(ene.Name +" did " + a + " damage to you");
                    Console.WriteLine();
                }

            }
            if (enemy.CurrentHealth <= 0)
            {
                Console.Clear();
                Console.WriteLine("Congratz you won the battle");
                Console.WriteLine();
                this.you = this.you.grantExp(you, 20 * enemy.Level);
                player.Money += 5 * enemy.Level;
                Console.WriteLine("Exp: " + 20 * enemy.Level);
                Console.WriteLine("Money: " + 5 * enemy.Level);
                player.updateQuests(ene, null, null, 0, 5 * enemy.Level, 0);
                Console.WriteLine();

            }
            else
            {
                Console.WriteLine("You lost the battle");
                Console.WriteLine();
                //TODO Decide what to do when the player lost the battle
            }
            this.you.CurrentHealth = this.you.MaxHealth;
            player.Monsters.Remove(old);
            player.Monsters.Add(this.you);

            return player;
        }
Beispiel #7
0
 internal Enemy CreateIronGolem(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     drops.Add(IC.CreateHPItem("HP potion 10", Item.equipment.potion, 10, 0));
     Monster monster = new Monster(7, 25, 150);
     Enemy enemy = new Enemy(monster, "Iron Golem", rng.Next(0, 5 * level), 0, rng.Next(5, 15 * level), level, drops);
     return enemy;
 }
Beispiel #8
0
 internal Enemy CreateSwampHumanoid(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     drops.Add(IC.CreateHPItem("HP potion 10", Item.equipment.potion, 10, 0));
     Monster monster = new Monster(5, 5, 100);
     monster.Weapon = IC.CreateAtkItem("Wooden Stick", Item.equipment.weapon, 5, 0, 100);
     Enemy enemy = new Enemy(monster, "Swamp Humanoid", rng.Next(0, 5 * level), 0, 0, level, drops);
     return enemy;
 }
Beispiel #9
0
 internal Enemy CreateSorcerer(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     Item item = IC.CreateAtkItem("Ice wand",Item.equipment.weapon,50,level,100);
     drops.Add(item);
     Monster monster = new Monster(25, 10, 200);
     monster.Weapon = item;
     Enemy enemy = new Enemy(monster, "Sorcerer", rng.Next(0, 5 * level), 0, 0, level, drops);
     return enemy;
 }
Beispiel #10
0
 internal Enemy CreateSkeleton(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     drops.Add(IC.CreateHPItem("HP potion 10", Item.equipment.potion, 10, 0));
     drops.Add(IC.CreateArmorItem("Bronze chest", Item.equipment.chest, 10, 0));
     drops.Add(IC.CreateArmorItem("Bronze shield", Item.equipment.shield, 10, 0));
     drops.Add(IC.CreateAtkItem("Bronze bow", Item.equipment.weapon, 10, 0, 100));
     Monster tama = new Monster(7, 4, 70);
     tama.Shield = IC.CreateArmorItem("Bronze chest", Item.equipment.chest, 10, 0);
     tama.Weapon = IC.CreateAtkItem("Bronze bow", Item.equipment.weapon, 10, 0, 100);
     tama.Chest = IC.CreateArmorItem("Bronze shield", Item.equipment.shield, 10, 0);
     Enemy enemy = new Enemy(tama, "Skeleton", rng.Next(0, 10 * level), 0, rng.Next(0, 5 * level), level, drops);
     return enemy;
 }
Beispiel #11
0
 internal Enemy CreateRiverMonster(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     Monster tama = new Monster(10, 10, 200);
     Enemy enemy = new Enemy(tama, "River Monster", rng.Next(10, 20 * level), 0, 0, level, drops);
     return enemy;
 }
Beispiel #12
0
 internal Enemy CreateMummy(int level)
 {
     Random rng = new Random();
     List<Item> drops = new List<Item>();
     Monster monster = new Monster(20, 10, 100);
     Enemy enemy = new Enemy(monster, "Mummy", rng.Next(0, 5 * level), 0, 0, level, drops);
     return enemy;
 }
Beispiel #13
0
        internal void updateQuests(Enemy enemy, Area area, Item item, int herbs, int money, int metal)
        {
            for (int i = 0; i < questlog.Count; i++)
            {
                switch (questlog[i].Name)
                {
                    #region The Goblin Cave
                    case "The Goblin cave":
                        if (enemy != null)
                        {
                            if (enemy.Name == "goblin")
                            {
                                if (!questlog[i].Completed)
                                {
                                    questlog[i].Progress += 1;
                                    if (questlog[i].Progress >= questlog[i].GoalValidator)
                                    {
                                        Console.WriteLine("You completed the quest " + questlog[i].Name);
                                        Console.WriteLine();
                                        questlog[i].Completed = true;
                                        Console.WriteLine();
                                        Console.WriteLine("Press enter to continue");
                                        Console.ReadLine();
                                    }
                                }
                            }
                        }
                        break;
                    #endregion
                    #region Find the source of the corruption
                    case "Find the source of the corruption":
                        if (area != null)
                        {
                            if (area.Name == "The_Plague_Lands")
                            {
                                if (!questlog[i].Completed)
                                {
                                    questlog[i].Progress += 1;
                                    if (questlog[i].Progress >= questlog[i].GoalValidator)
                                    {
                                        Console.WriteLine("You completed the quest " + questlog[i].Name);
                                        Console.WriteLine();
                                        questlog[i].Completed = true;
                                        Console.WriteLine();
                                        Console.WriteLine("Press enter to continue");
                                        Console.ReadLine();
                                    }
                                }
                            }
                        }
                        break;
                    #endregion
                    #region Learning Brewing
                    case "Learning Brewing":
                        if (herbs > 0)
                        {
                            if (!questlog[i].Completed)
                            {
                                questlog[i].Progress += herbs;
                                if (questlog[i].Progress >= questlog[i].GoalValidator)
                                {
                                    Console.WriteLine("You completed the quest " + questlog[i].Name);
                                    Console.WriteLine();
                                    questlog[i].Completed = true;
                                    Console.WriteLine();
                                    Console.WriteLine("Press enter to continue");
                                    Console.ReadLine();
                                }
                            }
                        }
                        break;
                    #endregion
                    #region The Sorcerer
                    case "The Sorcerer":
                        if (enemy != null)
                        {
                            if (!questlog[i].Completed)
                            {
                                questlog[i].Progress += 1;
                                if (questlog[i].Progress >= questlog[i].GoalValidator)
                                {
                                    Console.WriteLine("You completed the quest " + questlog[i].Name);
                                    Console.WriteLine("You have now vanguished the corruption congratulation on beating the game!");
                                    Console.WriteLine();
                                    questlog[i].Completed = true;
                                    Console.WriteLine();
                                    Console.WriteLine("Press enter to continue");
                                    Console.ReadLine();
                                    Console.ReadLine();
                                }
                            }
                        }
                        break;
                    #endregion
                    default:
                        break;
                }

            }
        }