Example #1
0
        public void enemyDecision()
        {
            int option    = 0;
            int optionMax = 3;
            int optionMin = 1;

            damage = 0;

            option = rand.Next(optionMin, optionMax + 1);

            Normal  aNormal  = new Normal();
            Wizard  aWizard  = new Wizard();
            Archer  aArcher  = new Archer();
            Paladin aPaladin = new Paladin();
            Armor   aArmor   = new Armor();
            Weapon  aWeapon  = new Weapon();

            switch (option)
            {
            case 1:
                Console.WriteLine("The enemy " + selectedCharacter + " has performed a Magic Attack");
                if (weaponSelected == 1)
                {
                    damage = aWeapon.getMagicStaff();
                }
                if (aNormal.getArmorSelected() == 1)
                {
                    damage = damage - aArmor.getRobe();
                }
                if (selectedCharacter == "Wizard")
                {
                    damage = damage + aWizard.getMagicDamage();
                }
                else
                {
                    damage = damage + magicAttack();
                }
                break;

            case 2:
                Console.WriteLine("The enemy " + selectedCharacter + " has performed a Ranged Attack");
                if (weaponSelected == 2)
                {
                    damage = aWeapon.getLongBow();
                }
                if (aNormal.getArmorSelected() == 2)
                {
                    damage = damage - aArmor.getRubber();
                }
                if (selectedCharacter == "Archer")
                {
                    damage = damage + aArcher.getRangedDamage();
                }
                else
                {
                    damage = damage + rangedAttack();
                }
                break;

            case 3:
                Console.WriteLine("The enemy " + selectedCharacter + " has performed a Melee Attack");
                if (weaponSelected == 3)
                {
                    damage = aWeapon.getSword();
                }
                if (aNormal.getArmorSelected() == 3)
                {
                    damage = damage - aArmor.getTitanium();
                }
                if (selectedCharacter == "Paladin")
                {
                    damage = damage + aPaladin.getMeleeDamage();
                }
                else
                {
                    damage = damage + meleeAttack();
                }
                break;
            }
            Console.WriteLine("Your enemy " + selectedCharacter + " caused " + damage + " damage to you");
        }
Example #2
0
        public int decisionMenu(int selectedCharacter)
        {
            Console.Write("Press any key to continue...");
            Console.ReadKey();
            Console.Clear();
            weaponSelection();
            Console.Write("Press any key to continue...");
            Console.ReadKey();
            Console.Clear();
            armorSelection();
            Console.Write("Press any key to continue...");
            Console.ReadKey();
            Console.Clear();
            Wizard  aWizard  = new Wizard();
            Archer  aArcher  = new Archer();
            Paladin aPaladin = new Paladin();
            int     option   = 0;
            int     EnemyHP  = 0;
            int     damage   = 0;
            Weapon  aWeapon  = new Weapon();
            Armor   aArmor   = new Armor();

            Console.WriteLine("An enemy is approaching!");
            aEnemy.characterSelection();
            aEnemy.setHP();
            EnemyHP = aEnemy.getHP();
            Console.WriteLine("The enemy " + aEnemy.selectedCharacter + " has " + EnemyHP + " Hit Points");
            aEnemy.weaponSelection();
            aEnemy.armorSelection();
            while ((HP > 0) && (EnemyHP > 0))
            {
                damage = 0;
                Console.WriteLine("What do you want to do?");
                Console.WriteLine("1) Magic Attack");
                Console.WriteLine("2) Ranged Attack");
                Console.WriteLine("3) Melee Attack");
                Console.Write("Option: ");
                option = Convert.ToInt32(Console.ReadLine());

                switch (option)
                {
                case 1:
                    Console.WriteLine("You have performed a Magic Attack");
                    if (weaponSelected == 1)
                    {
                        damage = aWeapon.getMagicStaff();
                    }
                    if (selectedCharacter == 1)
                    {
                        damage = damage + aWizard.getMagicDamage();
                    }
                    else
                    {
                        damage = damage + getMagicDamage(3, 2);
                    }
                    if (aEnemy.getArmorSelected() == 1)
                    {
                        damage = damage - aArmor.getRobe();
                    }
                    break;

                case 2:
                    Console.WriteLine("You have performed a Ranged Attack");
                    if (weaponSelected == 2)
                    {
                        damage = aWeapon.getLongBow();
                    }
                    if (selectedCharacter == 2)
                    {
                        damage = damage + aArcher.getRangedDamage();
                    }
                    else
                    {
                        damage = damage + getRangedDamage(3, 2);
                    }
                    if (aEnemy.getArmorSelected() == 2)
                    {
                        damage = damage - aArmor.getRubber();
                    }
                    break;

                case 3:
                    Console.WriteLine("You have performed a Melee Attack");
                    if (weaponSelected == 3)
                    {
                        damage = aWeapon.getSword();
                    }
                    if (selectedCharacter == 3)
                    {
                        damage = damage + aPaladin.getMeleeDamage();
                    }
                    else
                    {
                        damage = damage + getMeleeDamage(3, 2);
                    }
                    if (aEnemy.getArmorSelected() == 3)
                    {
                        damage = damage - aArmor.getTitanium();
                    }
                    break;
                }
                Console.WriteLine("You have caused " + damage + " damage to your enemy " + aEnemy.selectedCharacter);
                EnemyHP = EnemyHP - damage;
                if (EnemyHP <= 0)
                {
                    Console.WriteLine("The enemy " + aEnemy.selectedCharacter + "'s Hit Points are 0");
                    Console.WriteLine("You defeated the enemy " + aEnemy.selectedCharacter + "!");
                }
                else
                {
                    Console.WriteLine("Now the enemy " + aEnemy.selectedCharacter + "'s Hit Points are down to " + EnemyHP);
                    Console.WriteLine("Now it is your enemy " + aEnemy.selectedCharacter + "'s turn");
                    aEnemy.enemyDecision();
                    HP = HP - aEnemy.getDamage();
                }
                if (HP <= 0)
                {
                    Console.WriteLine("Now your Hit Points are down to 0");
                    Console.WriteLine("The enemy " + aEnemy.selectedCharacter + " has defeated you!");
                }
                else if (EnemyHP > 0)
                {
                    Console.WriteLine("Now your Hit Points are down to " + HP);
                }
                Console.Write("Press any key to continue...");
                Console.ReadKey();
                Console.Clear();
            }
            return(HP & EnemyHP);
        }