Exemplo n.º 1
0
        private Item getDrop()
        {
            Classes.Items.Type itemType = (Classes.Items.Type)((Level % 12) / 2 + (Level % 12) % 2);
            int  grade      = Level / 12;
            Item itemToDrop = null;

            switch (rGen.Next(1, 5))
            {
            case 1:
                itemToDrop = new Consumable(grade, itemType, "A " + itemType + "+" + grade + " health potion! Enjoy it!");;
                break;

            case 2:
                itemToDrop = new Armor(itemType, grade, "Some " + itemType + "+" + grade + " armor! Enjoy it!");;
                break;

            case 3:
                WeaponType wepType = (Classes.Items.WeaponType)rGen.Next(1, 4);
                itemToDrop = new Weapon(itemType, wepType, grade, "A " + itemType + "+" + grade + " " + wepType + "! Enjoy it!");;
                break;

            case 4:
                itemToDrop = new Consumable(grade, itemType, "A " + itemType + "+" + grade + " health potion! Enjoy it!");;
                break;
            }
            return(itemToDrop);
        }
Exemplo n.º 2
0
        private void assignShopWeapons(int grade, Classes.Items.Type itemType)
        {
            Random     rGen    = new Random();
            WeaponType wepType = (Classes.Items.WeaponType)rGen.Next(1, 4);

            shopWeaponInventory.Add(new Weapon(itemType, wepType, grade, "A " + itemType + "+" + grade + " " + wepType + "! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " " + wepType));
        }
Exemplo n.º 3
0
        public override Items.Item getDrop()
        {
            Classes.Items.Type itemType = (Classes.Items.Type)((Level % 12) / 2 + ((Level % 12) % 2) + ((Level % 12 == 0) ? 6 : 0));
            int grade = 0;

            for (int i = 0; i < Level; i += 12)
            {
                grade = i / 12;
            }

            Item itemToDrop = null;

            switch (rGen.Next(1, 5))
            {
            case 1:
                itemToDrop = new Consumable(grade, itemType, "A " + itemType + "+" + grade + " health potion! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " health potion");
                break;

            case 2:
                itemToDrop = new Armor(itemType, grade, "Some " + itemType + "+" + grade + " armor! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " armor");
                break;

            case 3:
                WeaponType wepType = (Classes.Items.WeaponType)rGen.Next(1, 4);
                itemToDrop = new Weapon(itemType, wepType, grade, "A " + itemType + "+" + grade + " " + wepType + "! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " " + wepType);
                break;

            case 4:
                itemToDrop = new Consumable(grade, itemType, "A " + itemType + "+" + grade + " health potion! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " health potion");
                break;
            }
            return(itemToDrop);
        }
Exemplo n.º 4
0
        private void assignShopItems(int lvl)
        {
            Classes.Items.Type itemType = (Classes.Items.Type)((lvl % 12) / 2 + ((lvl % 12) % 2) + ((lvl % 12 == 0) ? 6 : 0));
            int grade = 0;

            for (int i = 0; i < lvl; i += 12)
            {
                grade = i / 12;
            }

            assignShopArmor(grade, itemType);
            assignShopWeapons(grade, itemType);
            assignShopConsumables(grade, itemType);
        }
Exemplo n.º 5
0
        public override Items.Item getDrop()
        {
            Classes.Items.Type itemType   = (Classes.Items.Type)(((Level + 5) % 12) / 2 + (((Level + 5) % 12) % 2) + (((Level + 5) % 12 == 0) ? 6 : 0));
            UniqueWeaponNames  uniqueName = (UniqueWeaponNames)rGen.Next(1, 30);

            int grade = 0;

            for (int i = 0; i < Level + 5; i += 12)
            {
                grade = i / 12;
            }

            WeaponType wepType    = (Classes.Items.WeaponType)rGen.Next(1, 4);
            Item       itemToDrop = new Weapon(itemType, wepType, grade, uniqueName.GetDescription() + " " + wepType + "! Enjoy it!", uniqueName.GetDescription() + " " + wepType);

            return(itemToDrop);
        }
Exemplo n.º 6
0
 private void assignShopConsumables(int grade, Classes.Items.Type itemType)
 {
     shopConsumableInventory.Add(new Consumable(grade, itemType, "A " + itemType + "+" + grade + " health potion! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " health potion"));
 }
Exemplo n.º 7
0
 private void assignShopArmor(int grade, Classes.Items.Type itemType)
 {
     shopArmorInventory.Add(new Armor(itemType, grade, "Some " + itemType + "+" + grade + " armor! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " armor"));
 }
Exemplo n.º 8
0
        private int ItemValue(int grade, Classes.Items.Type type)
        {
            int value = ((int)Classes.Items.Type.Dragon * 2 * grade) + (int)type * 2;

            return(value);
        }
Exemplo n.º 9
0
        public void testBalance(int lvl, int statPrio)
        {
            Level = lvl;
            MaxHP = (StartHp) + (int)Math.Round(3.5 * Level);
            HP    = MaxHP;
            numUnusedStatPoints = 10 + 2 * (lvl - 1);
            if (statPrio == 0)
            {
                Strength            = numUnusedStatPoints;
                Intelligence        = 0;
                Dexterity           = 0;
                numUnusedStatPoints = 0;

                Classes.Items.Type equipType = (Classes.Items.Type)((Level % 12) / 2 + (Level % 12) % 2);
                int    grade = Level / 12;
                Weapon wep   = new Weapon(equipType, WeaponType.Sword, grade, "uncreative");
                EquipItem(wep);
                Armor arm = new Armor(equipType, grade, "uncreative");
                EquipItem(arm);
            }
            if (statPrio == 1)
            {
                Strength            = 0;
                Intelligence        = numUnusedStatPoints;
                Dexterity           = 0;
                numUnusedStatPoints = 0;

                Classes.Items.Type equipType = (Classes.Items.Type)((Level % 12) / 2 + (Level % 12) % 2);
                int    grade = Level / 12;
                Weapon wep   = new Weapon(equipType, WeaponType.Staff, grade, "uncreative");
                EquipItem(wep);
                Armor arm = new Armor(equipType, grade, "uncreative");
                EquipItem(arm);
            }
            if (statPrio == 2)
            {
                Strength            = 0;
                Intelligence        = 0;
                Dexterity           = numUnusedStatPoints;
                numUnusedStatPoints = 0;

                Classes.Items.Type equipType = (Classes.Items.Type)((Level % 12) / 2 + (Level % 12) % 2);
                int    grade = Level / 12;
                Weapon wep   = new Weapon(equipType, WeaponType.Bow, grade, "uncreative");
                EquipItem(wep);
                Armor arm = new Armor(equipType, grade, "uncreative");
                EquipItem(arm);
            }
            if (statPrio == 3)
            {
                Strength            = (int)Math.Round(numUnusedStatPoints / 2.0);
                Intelligence        = (int)Math.Round(numUnusedStatPoints / 4.0);
                Dexterity           = (int)Math.Round(numUnusedStatPoints / 4.0);
                numUnusedStatPoints = 0;

                Classes.Items.Type equipType = (Classes.Items.Type)((Level % 12) / 2 + (Level % 12) % 2);
                int    grade = Level / 12;
                Weapon wep   = new Weapon(equipType, WeaponType.Sword, grade, "uncreative");
                EquipItem(wep);
                Armor arm = new Armor(equipType, grade, "uncreative");
                EquipItem(arm);
            }
            if (statPrio == 4)
            {
                Strength            = (int)Math.Round(numUnusedStatPoints / 4.0);
                Intelligence        = (int)Math.Round(numUnusedStatPoints / 2.0);
                Dexterity           = (int)Math.Round(numUnusedStatPoints / 4.0);
                numUnusedStatPoints = 0;

                Classes.Items.Type equipType = (Classes.Items.Type)((Level % 12) / 2 + (Level % 12) % 2);
                int    grade = Level / 12;
                Weapon wep   = new Weapon(equipType, WeaponType.Staff, grade, "uncreative");
                EquipItem(wep);
                Armor arm = new Armor(equipType, grade, "uncreative");
                EquipItem(arm);
            }
            if (statPrio == 5)
            {
                Strength            = (int)Math.Round(numUnusedStatPoints / 4.0);
                Intelligence        = (int)Math.Round(numUnusedStatPoints / 4.0);
                Dexterity           = (int)Math.Round(numUnusedStatPoints / 2.0);
                numUnusedStatPoints = 0;

                Classes.Items.Type equipType = (Classes.Items.Type)((Level % 12) / 2 + (Level % 12) % 2);
                int    grade = Level / 12;
                Weapon wep   = new Weapon(equipType, WeaponType.Bow, grade, "uncreative");
                EquipItem(wep);
                Armor arm = new Armor(equipType, grade, "uncreative");
                EquipItem(arm);
            }
        }
Exemplo n.º 10
0
        public void Battle(Player player1, Monster.Monster Monster1)
        {
            bool ValidInput  = false;
            bool Flee        = false;
            bool monsterdead = false;
            int  damage      = 0;

            while (!Flee && (player1.HP > 0 && !monsterdead))
            {
                Console.WriteLine("New Round");
                Console.WriteLine("Monster is dead: " + monsterdead);

                while (!ValidInput)
                {
                    Console.WriteLine(" Its your turn what do you want to do /n 1) Fight /n 2) Use Item /n 3)Flee");
                    string input = Console.ReadLine();
                    int    choice;
                    if (int.TryParse(input, out choice))
                    {
                        if (choice == 1)
                        {
                            if (Monster1.type == "Goblin" && player1.EquippedWeapon.type == WeaponType.Staff)
                            {
                                if (player1.Intelligence - Monster1.dexterity < 0)
                                {
                                    damage = (int)Math.Round((1.1 * player1.Attack()));
                                }
                                else
                                {
                                    damage = (int)Math.Round((1.1 + (0.05 * (player1.Intelligence - Monster1.dexterity))) * player1.Attack());
                                }
                            }
                            else if (Monster1.type == "Orc" && player1.EquippedWeapon.type == WeaponType.Bow)
                            {
                                if (player1.Dexterity - Monster1.strength < 0)
                                {
                                    damage = (int)Math.Round((1.1 * player1.Attack()));
                                }
                                else
                                {
                                    damage = (int)Math.Round((1.1 + (0.05 * (player1.Dexterity - Monster1.strength))) * player1.Attack());
                                }
                            }
                            else if (Monster1.type == "Witch" && player1.EquippedWeapon.type == WeaponType.Sword)
                            {
                                if (player1.Strength - Monster1.intellect < 0)
                                {
                                    damage = (int)Math.Round((1.1 * player1.Attack()));
                                }
                                else
                                {
                                    damage = (int)Math.Round((1.1 + (0.05 * (player1.Strength - Monster1.intellect))) * player1.Attack());
                                }
                            }
                            else if (Monster1.type == "Goblin" && player1.EquippedWeapon.type == WeaponType.Sword)
                            {
                                if (player1.Strength - Monster1.dexterity < 0)
                                {
                                    damage = (int)Math.Round((.9 * player1.Attack()));
                                }
                                else
                                {
                                    damage = (int)Math.Round((.9 - (0.02 * (player1.Strength - Monster1.dexterity))) * player1.Attack());
                                }
                            }
                            else if (Monster1.type == "Orc" && player1.EquippedWeapon.type == WeaponType.Staff)
                            {
                                if (player1.Intelligence - Monster1.strength < 0)
                                {
                                    damage = (int)Math.Round((.9 * player1.Attack()));
                                }
                                else
                                {
                                    damage = (int)Math.Round((.9 - (0.02 * (player1.Strength - Monster1.dexterity))) * player1.Attack());
                                }
                            }
                            else if (Monster1.type == "Witch" && player1.EquippedWeapon.type == WeaponType.Bow)
                            {
                                if (player1.Dexterity - Monster1.intellect < 0)
                                {
                                    damage = (int)Math.Round((.9 * player1.Attack()));
                                }
                                else
                                {
                                    damage = (int)Math.Round((.9 - (0.02 * (player1.Intelligence - Monster1.strength))) * player1.Attack());
                                }
                            }
                            else if (Monster1.type == "Goblin" && player1.EquippedWeapon.type == WeaponType.Bow)
                            {
                                damage = (player1.Attack());
                            }
                            else if (Monster1.type == "Orc" && player1.EquippedWeapon.type == WeaponType.Sword)
                            {
                                damage = (player1.Attack());
                            }
                            else if (Monster1.type == "Witch" && player1.EquippedWeapon.type == WeaponType.Staff)
                            {
                                damage = (player1.Attack());
                            }

                            monsterdead = Monster1.takeDamage(damage);
                            Console.WriteLine("You swing and hit the " + Monster1.type + " for " + damage + " Damage. Remaining hp: " + Monster1.hp);
                        }
                        if (choice == 2)
                        {
                            Classes.Items.Type conType = (Classes.Items.Type)((player1.Level % 12) / 2 + (player1.Level % 12) % 2);
                            int  grade   = player1.Level / 12;
                            Item consume = new Consumable(grade, conType, "uncreative");
                            player1.UseConsumable(consume);
                            Console.WriteLine(conType + "+" + grade + " type consumable restored " + ((Consumable)consume).HealthRegen + " hp. Hp is now " + player1.HP);
                        }
                        if (choice == 3)
                        {
                            Random rand    = new Random();
                            int    FleeTry = rand.Next(0, 11);
                            Console.WriteLine(FleeTry);
                            if (Monster1.Level > player1.Level)
                            {
                                if (FleeTry > 6)
                                {
                                    Flee = true;
                                }
                            }
                            if (Monster1.Level < player1.Level)
                            {
                                if (FleeTry > 3)
                                {
                                    Flee = true;
                                }
                            }
                            if (Monster1.Level == player1.Level)
                            {
                                if (FleeTry > 4)
                                {
                                    Flee = true;
                                }
                            }
                            Console.WriteLine(Flee);
                        }
                        ValidInput = true;
                        if (choice > 3)
                        {
                            ValidInput = false;
                        }
                    }
                    else
                    {
                        Console.WriteLine("That is not valid input");
                    }
                }
                if (!monsterdead)
                {
                    if (Monster1.type == "Goblin" && player1.EquippedWeapon.type == WeaponType.Staff)
                    {
                        if (Monster1.dexterity - player1.Intelligence < 0)
                        {
                            damage = (int)Math.Round((1.1 * Monster1.damage));
                        }
                        else
                        {
                            damage = (int)Math.Round((1.1 + (0.05 * (Monster1.dexterity - player1.Intelligence) / 10)) * Monster1.damage);
                        }
                    }
                    else if (Monster1.type == "Orc" && player1.EquippedWeapon.type == WeaponType.Bow)
                    {
                        if (Monster1.strength - player1.Dexterity < 0)
                        {
                            damage = (int)Math.Round((1.1 * Monster1.damage));
                        }
                        else
                        {
                            damage = (int)Math.Round((1.1 + (0.05 * (Monster1.strength - player1.Dexterity) / 10)) * Monster1.damage);
                        }
                    }
                    else if (Monster1.type == "Witch" && player1.EquippedWeapon.type == WeaponType.Sword)
                    {
                        if (Monster1.intellect - player1.Strength < 0)
                        {
                            damage = (int)Math.Round((1.1 * Monster1.damage));
                        }
                        else
                        {
                            damage = (int)Math.Round((1.1 + (0.05 * (Monster1.intellect - player1.Strength))) * Monster1.damage);
                        }
                    }
                    else if (Monster1.type == "Goblin" && player1.EquippedWeapon.type == WeaponType.Sword)
                    {
                        if (Monster1.dexterity - player1.Strength < 0)
                        {
                            damage = (int)Math.Round((.9 * Monster1.damage));
                        }
                        else
                        {
                            damage = (int)Math.Round((.9 - (0.02 * (Monster1.dexterity - player1.Strength) / 10)) * Monster1.damage);
                        }
                    }
                    else if (Monster1.type == "Orc" && player1.EquippedWeapon.type == WeaponType.Staff)
                    {
                        if (player1.Intelligence - Monster1.strength < 0)
                        {
                            damage = (int)Math.Round((.9 * Monster1.damage));
                        }
                        else
                        {
                            damage = (int)Math.Round((.9 - (0.02 * (player1.Strength - Monster1.dexterity) / 10)) * Monster1.damage);
                        }
                    }
                    else if (Monster1.type == "Witch" && player1.EquippedWeapon.type == WeaponType.Bow)
                    {
                        if (player1.Dexterity - Monster1.intellect < 0)
                        {
                            damage = (int)Math.Round((.9 * Monster1.damage));
                        }
                        else
                        {
                            damage = (int)Math.Round((.9 - (0.02 * (player1.Intelligence - Monster1.strength) / 10)) * Monster1.damage);
                        }
                    }
                    else if (Monster1.type == "Goblin" && player1.EquippedWeapon.type == WeaponType.Bow)
                    {
                        damage = (Monster1.damage);
                    }
                    else if (Monster1.type == "Orc" && player1.EquippedWeapon.type == WeaponType.Sword)
                    {
                        damage = (Monster1.damage);
                    }
                    else if (Monster1.type == "Witch" && player1.EquippedWeapon.type == WeaponType.Staff)
                    {
                        damage = (Monster1.damage);
                    }
                    player1.HP -= damage;
                    Console.WriteLine("The " + Monster1.type + " Swings and hits you for " + damage + " Damage. Remaining hp: " + player1.HP);
                    Console.WriteLine();
                }

                ValidInput = false;
            }
            if (!Flee)
            {
                if (monsterdead)
                {
                    player1.gainExperience(Monster1.experience);
                    Console.WriteLine("You have slain the enemy");
                }
                if (player1.HP <= 0)
                {
                    Console.WriteLine("The monster Has killed you. Told you he died at the end!");
                }
            }
        }