Exemple #1
0
 public static void DiceLoop(int maxDice, int diceType, int statHolder)
 {
     ActionVariables.diceResult = 0;
     for (int i = 0; i < maxDice; i++)
     {
         ActionVariables.diceResult += RandomDice(diceType);
     }
     ActionMods.MeleeModifier(statHolder);
     ActionVariables.diceOut = ActionVariables.diceResult + ActionVariables.statAdjuster;
     if (ActionVariables.diceOut <= 0)
     {
         ActionVariables.diceOut = 1;
     }
 }
        /// <summary>
        /// TODO
        /// Add items and skills to actions list
        ///
        /// </summary>

        public static void ActionStart(int setMaxDice, int setDiceType, int manaCost, int statHolder)        //handles base action functions.
        {
            int pcHealthHolder  = 0;
            int pcManaHolder    = 0;
            int npcHealthHolder = 0;
            int npcManaHolder   = 0;

            //if 0 needs to be npc health, if 1 needs to be pc health since health of the enemy is required
            pcHealthHolder  = MainForm._pcStats.curHealth;
            pcManaHolder    = MainForm._pcStats.curMana;
            npcHealthHolder = MainForm._npcStats.curHealth;
            npcManaHolder   = MainForm._npcStats.curMana;

            Dice.DiceLoop(setDiceType, setMaxDice, statHolder);
            ActionMods.StatChanger(pcHealthHolder, pcManaHolder, npcHealthHolder, npcManaHolder, manaCost);
            ActionMods.StatPasser();
        }
Exemple #3
0
        public static void NpcAi(int curMana, int maxMana, int curHealth, int maxHealth)        //handles npc actions
        {
            double healthPercent = ActionMods.GetPercent((double)curHealth / maxHealth);
            double manaPercent   = ActionMods.GetPercent((double)curMana / maxMana);

            if (MainForm._npcStats.charClass == 1)           //warrior
            {
                Actions.Melee(MainForm._npcStats.stren);
            }
            else if (MainForm._npcStats.charClass == 2)           //ranger
            {
                Actions.Ranged(MainForm._npcStats.agili);
            }
            else if (MainForm._npcStats.charClass == 3) //mage //Currently mage functions are not working. Mage performs melee action and no others.
            {
                if (manaPercent > 0.0)                  //mana is over a certain number
                {
                    if (healthPercent > 0.5)            // over a certain health
                    {
                        Actions.FireBall(MainForm._npcStats.intel);
                    }
                    else if (healthPercent < 0.5)                   //if under a certain health
                    {
                        Actions.Healing(MainForm._npcStats.intel);
                    }
                }
                else if (manaPercent < 0.05)               //mana is under a certain range
                {
                    Actions.Melee(MainForm._npcStats.stren);
                }
            }
            else if (MainForm._npcStats.charClass == 4)           //troll
            {
                Actions.Melee(MainForm._npcStats.stren);
            }
        }