Exemplo n.º 1
0
        public string SpellCheck(string SpellName)
        {
            String Output;

            switch (SpellName)
            {
            //Mana based spells
            case "mortal strike":

                GlobalVar.manaCost    = 1;
                GlobalVar.damageDealt = warriorStats.warriorSpellDamage - 10;

                //Monster status check. 0 = dead. 1 = alive.
                if (GlobalVar.monsterStatus == 0)
                {
                    Output = "No target.";
                    return(Output);
                }
                else if (GlobalVar.currentMP >= GlobalVar.manaCost)
                {
                    GlobalVar.currentMP = GlobalVar.currentMP - GlobalVar.manaCost;

                    Random diceRoll     = new Random();
                    int    randomNumber = diceRoll.Next(1, 100);

                    hitStatus hitInst = new hitStatus();
                    hitInst.hitCheck(randomNumber);

                    if (GlobalVar.playerAttack == 1)
                    {
                        Output = "You swing a mortal strike at the enemy dealing " + GlobalVar.damageDealt + " damage.";


                        GlobalVar.monsterHP = GlobalVar.monsterHP - GlobalVar.damageDealt;
                        return(Output);
                    }
                    else
                    {
                        Output = "You swing and miss! Causing no damage.";
                        return(Output);
                    }
                }
                else
                {
                    Output = "You do not have enough mana to cast this spell.";
                    return(Output);
                }

            case "hamstring":
                GlobalVar.manaCost    = 2;
                GlobalVar.damageDealt = warriorStats.warriorSpellDamage - 8;


                //Monster status check. 0 = dead. 1 = alive.
                if (GlobalVar.monsterStatus == 0)
                {
                    Output = "No target.";
                    return(Output);
                }
                else if (GlobalVar.currentMP >= GlobalVar.manaCost)
                {
                    // Uses mana before the roll. Place it above the Monster HP reduction equation if you want the mana to not be deducted on a failed roll.
                    GlobalVar.currentMP = GlobalVar.currentMP - GlobalVar.manaCost;

                    Random diceRoll     = new Random();
                    int    randomNumber = diceRoll.Next(1, 100);

                    hitStatus hitInst = new hitStatus();
                    hitInst.hitCheck(randomNumber);

                    if (GlobalVar.playerAttack == 1)
                    {
                        Output = "You hamstring your opponent dealing " + GlobalVar.damageDealt + " damage.";
                        // Monster HP reduction equation. Place the mana reduction equation below this comment to have the mana only be deducted after a successful roll.
                        GlobalVar.monsterHP = GlobalVar.monsterHP - GlobalVar.damageDealt;
                        return(Output);
                    }
                    else
                    {
                        Output = "You swing and miss causing no damage!";
                        return(Output);
                    }
                }
                else
                {
                    Output = "You do not have enough mana to cast this spell.";
                    return(Output);
                }

            // Health Based Spells
            //Rage cannot miss.
            case "rage":


                GlobalVar.manaCost   = 0;
                GlobalVar.healthCost = 2;

                int manaRestored = 3;
                if (GlobalVar.currentHP > GlobalVar.healthCost && GlobalVar.currentMP < warriorStats.warriorMP)
                {
                    Output = "You are enraged and gain mana.";
                    GlobalVar.currentHP = GlobalVar.currentHP - GlobalVar.healthCost;
                    GlobalVar.currentMP = GlobalVar.currentMP + manaRestored;
                    return(Output);
                }
                else
                {
                    Output = "You do not have enough health to cast this spell.";
                    return(Output);
                }

            //Spell List
            case "list":
                Output = Environment.NewLine + "Current Spells:" +
                         Environment.NewLine + "===============" +
                         Environment.NewLine + "Mortal Strike" +
                         Environment.NewLine + "Hamstring" +
                         Environment.NewLine + "Rage";
                return(Output);

            //Error.
            default:
                Output = "That is not a valid command.";
                return(Output);
            }
        }
Exemplo n.º 2
0
        public string SpellCheck(string SpellName)
        {
            String Output;

            switch (SpellName)
            {
            //Mana based spells
            case "magic missiles":

                GlobalVar.manaCost    = 1;
                GlobalVar.damageDealt = 2;

                //Monster status check. 0 = dead. 1 = alive.
                if (GlobalVar.monsterStatus == 0)
                {
                    Output = "No target.";
                    return(Output);
                }
                else if (GlobalVar.currentMP >= GlobalVar.manaCost)
                {
                    //Deducts MP before attempt.
                    GlobalVar.currentMP = GlobalVar.currentMP - GlobalVar.manaCost;

                    //Random DiceRoll
                    Random diceRoll     = new Random();
                    int    randomNumber = diceRoll.Next(1, 100);

                    //hitStatus.cs cruncher.
                    hitStatus hitInst = new hitStatus();
                    hitInst.hitCheck(randomNumber);

                    if (GlobalVar.playerAttack == 1)
                    {
                        Output = "You cast Magic Missiles. Dealing " + GlobalVar.damageDealt + " damage.";


                        GlobalVar.monsterHP = GlobalVar.monsterHP - GlobalVar.damageDealt;
                        return(Output);
                    }
                    else
                    {
                        Output = "You miss causing no damage!";
                        return(Output);
                    }
                }
                else
                {
                    Output = "You do not have enough mana to cast this spell.";
                    return(Output);
                }

            case "fireball":
                GlobalVar.manaCost    = 2;
                GlobalVar.damageDealt = 4;

                //Monster status check. 0 = dead. 1 = alive.
                if (GlobalVar.monsterStatus == 0)
                {
                    Output = "No target.";
                    return(Output);
                }
                else if (GlobalVar.currentMP >= GlobalVar.manaCost)
                {
                    //Deducts MP before attempt.
                    GlobalVar.currentMP = GlobalVar.currentMP - GlobalVar.manaCost;

                    //Random DiceRoll
                    Random diceRoll     = new Random();
                    int    randomNumber = diceRoll.Next(1, 100);

                    //hitStatus.cs cruncher.
                    hitStatus hitInst = new hitStatus();
                    hitInst.hitCheck(randomNumber);

                    if (GlobalVar.playerAttack == 1)
                    {
                        Output = "You cast Fireball. Dealing " + GlobalVar.damageDealt + " damage.";

                        GlobalVar.monsterHP = GlobalVar.monsterHP - GlobalVar.damageDealt;
                        return(Output);
                    }
                    else
                    {
                        Output = "You miss causing no damage.";
                        return(Output);
                    }
                }
                else
                {
                    Output = "You do not have enough mana to cast this spell.";
                    return(Output);
                }

            case "death":
                GlobalVar.manaCost    = 5;
                GlobalVar.damageDealt = warlockStats.intelligence + warlockStats.strength;

                //Monster status check. 0 = dead. 1 = alive.
                if (GlobalVar.monsterStatus == 0)
                {
                    Output = "No target.";
                    return(Output);
                }
                else if (GlobalVar.currentMP >= GlobalVar.manaCost)
                {
                    //Deducts MP before attempt.
                    GlobalVar.currentMP = GlobalVar.currentMP - GlobalVar.manaCost;

                    //Random DiceRoll
                    Random diceRoll     = new Random();
                    int    randomNumber = diceRoll.Next(1, 100);

                    //hitStatus.cs cruncher.
                    hitStatus hitInst = new hitStatus();
                    hitInst.hitCheck(randomNumber);

                    if (GlobalVar.playerAttack == 1)
                    {
                        Output = "You cast Death. Dealing " + GlobalVar.damageDealt + " damage.";

                        GlobalVar.monsterHP = GlobalVar.monsterHP - GlobalVar.damageDealt;
                        return(Output);
                    }
                    else
                    {
                        Output = "You miss causing no damage.";
                        return(Output);
                    }
                }
                else
                {
                    Output = "You do not have enough mana to cast this spell.";
                    return(Output);
                }

            // Health Based Spells
            // Life Tap cannot miss.
            case "life tap":
                GlobalVar.manaCost   = 0;
                GlobalVar.healthCost = 2;
                int manaRestored = 3;
                if (GlobalVar.currentHP > GlobalVar.healthCost)
                {
                    Output = "You cast Life Tap.";
                    GlobalVar.currentHP = GlobalVar.currentHP - GlobalVar.healthCost;
                    GlobalVar.currentMP = GlobalVar.currentMP + manaRestored;
                    return(Output);
                }
                else
                {
                    Output = "You do not have enough health to cast this spell.";
                    return(Output);
                }

            //Spell List
            case "list":
                Output = Environment.NewLine +
                         "Current Spells:" + Environment.NewLine + "===============" +
                         Environment.NewLine + "Magic Missiles " +
                         Environment.NewLine + "Fireball " +
                         Environment.NewLine + "Life Tap " +
                         Environment.NewLine + "Death ";
                return(Output);

            //Error.
            default:
                Output = "That is not a valid command.";
                return(Output);
            }
        }