Exemplo n.º 1
0
        public List <Monster> castMove(Monster attackMonster, Move attackMove, Monster defendingMonster)
        {
            List <Monster> attackDefenderList = new List <Monster>();
            int            staminaRequired    = attackMove.getStamina();
            int            staminaPossessed   = attackMonster.getStamina();

            if (staminaRequired > staminaPossessed)
            {
                attackDefenderList.Add(attackMonster);
                attackDefenderList.Add(defendingMonster);
                Console.Write("Error Not enough Stamina" + "\n");
                return(attackDefenderList);
            }

            float damage = 0;
            float netAttack;
            float netDefense;

            Console.Write("Move Name: " + attackMove.getName() + ", Stamina required: " + attackMove.getStamina() + "\n");
            Console.Write("Attacker: " + attackMonster.getName() + ", Level: " + attackMonster.getLevel() + " Health: " + attackMonster.getHealth() + ", Stamina: " + attackMonster.getStamina() + "\n");
            Console.Write("Defender: " + defendingMonster.getName() + ", Level: " + defendingMonster.getLevel() + " Health: " + defendingMonster.getHealth() + ", Stamina: " + defendingMonster.getStamina() + "\n");

            netAttack  = principalAttackValue(attackMonster, attackMove);
            netDefense = principalDefenseValue(defendingMonster, attackMove);
            damage     = netAttack - netDefense;

            if (attackMove.getType() != "normal")
            {
                damage = specialAttack(defendingMonster, attackMove, damage);
            }
            else
            {
            }

            // Before damage is rendered the random varible must be applied
            //            the random effectiveness variable, it will be modeled as RE = (2 / 3 + E) + R where 2 / 3 represents 66 %
            //effective all the time, then E = Level / 300, such that at level 100 a creature will be completely effective while
            //  a creature at 1 will be .661.Then another variable R will be created. R will be a number that is a random
            //  number between the range of 0:X where x = 1 - (.2 / 3 + E),


            int   level     = attackMonster.getLevel();
            float tempLevel = (float)level;

            tempLevel = tempLevel / 100;
            damage    = damage * tempLevel;
            int roundedDamage = (int)damage;

            defendingMonster.renderDamage(roundedDamage, attackMonster, defendingMonster, attackMove);
            attackDefenderList.Add(attackMonster);
            attackDefenderList.Add(defendingMonster);

            return(attackDefenderList);
        }
Exemplo n.º 2
0
        public List<Monster> castMove(Monster attackMonster, Move attackMove, Monster defendingMonster)
        {
            List<Monster> attackDefenderList = new List<Monster>();
            int staminaRequired = attackMove.getStamina();
            int staminaPossessed = attackMonster.getstamina();
            if (staminaRequired > staminaPossessed)
            {
                attackDefenderList.Add(attackMonster);
                attackDefenderList.Add(defendingMonster);
                Console.Write("Error Not enough Stamina"+"\n");
                return attackDefenderList;

            }

            float damage = 0;
            float netAttack;
            float netDefense;

                Console.Write("Move Name: " + attackMove.getName() +", Stamina required: "+attackMove.getStamina()+"\n");
                Console.Write("Attacker: " + attackMonster.getName() + ", Level: " + attackMonster.getlevel()+" Health: "+attackMonster.gethealth()+", Stamina: " + attackMonster.getstamina() + "\n");
                Console.Write("Defender: " + defendingMonster.getName() + ", Level: " + defendingMonster.getlevel()+" Health: "+defendingMonster.gethealth() + ", Stamina: "+defendingMonster.getstamina() +"\n");

            netAttack = principalAttackValue(attackMonster, attackMove);
            netDefense = principalDefenseValue(defendingMonster, attackMove);
            damage = netAttack - netDefense;

            if (attackMove.getType() != "normal")
            {
                damage = specailAttack(defendingMonster, attackMove, damage);
            }
            else
            {

            }

            // Before damage is rendered the random varible must be applied
            //            the random effectiveness variable, it will be modeled as RE = (2 / 3 + E) + R where 2 / 3 represents 66 %
            //effective all the time, then E = Level / 300, such that at level 100 a creature will be completely effective while
            //  a creature at 1 will be .661.Then another variable R will be created. R will be a number that is a random
            //  number between the range of 0:X where x = 1 - (.2 / 3 + E),

            int level=attackMonster.getlevel();
            float tempLevel = (float)level;
            tempLevel = tempLevel / 100;
            damage = damage * tempLevel;
            int roundedDamage = (int)damage;
            defendingMonster.renderDamage(roundedDamage,attackMonster, defendingMonster,attackMove);
                attackDefenderList.Add(attackMonster);
                attackDefenderList.Add(defendingMonster);

            return attackDefenderList;
        }