示例#1
0
 private void EnemyMove(Actor User, Move moveName)
 {
     int damageDealt;
     Random rand = new Random();
     damageDealt = (User.Attack * moveName.Attack) / 100;
     if (User.curStamina >= moveName.StaminaCost)
     {
         if (moveName.Aoe)
         {
             //Check if it hits
             if ((rand.Next(0, 100) - HealerObj.Dodge < moveName.Accuracy))
             {
                 HealerObj.curHealth -= damageDealt;
             }
             if ((rand.Next(0, 100) - TankObj.Dodge < moveName.Accuracy))
             {
                 TankObj.curHealth -= damageDealt;
             }
             if ((rand.Next(0, 100) - MageObj.Dodge < moveName.Accuracy))
             {
                 MageObj.curHealth -= damageDealt;
             }
             if ((rand.Next(0, 100) - DpsObj.Dodge < moveName.Accuracy))
             {
                 DpsObj.curHealth -= damageDealt;
             }
         }
         else
         {
             switch (rand.Next(0, 4))
             {
                 case 0:
                     if ((rand.Next(0, 100) - HealerObj.Dodge < moveName.Accuracy))
                     {
                         HealerObj.curHealth -= damageDealt;
                     }
                     break;
                 case 1:
                     if ((rand.Next(0, 100) - TankObj.Dodge < moveName.Accuracy))
                     {
                         TankObj.curHealth -= damageDealt;
                     }
                     break;
                 case 2:
                     if ((rand.Next(0, 100) - MageObj.Dodge < moveName.Accuracy))
                     {
                         MageObj.curHealth -= damageDealt;
                     }
                     break;
                 case 3:
                     if ((rand.Next(0, 100) - DpsObj.Dodge < moveName.Accuracy))
                     {
                         DpsObj.curHealth -= damageDealt;
                     }
                     break;
             }
         }
     }
     if ((User.curStamina - moveName.StaminaCost) <= 0)
     {
         User.curStamina = 0;
     }
     if (User.curStamina > User.Stamina)
     {
         User.curStamina = User.Stamina;
     }
 }
示例#2
0
 public void UpdateText(Actor person, Move moveIn, Actor target, GameTime gameTime)
 {
     float ElapsedTime = 0;
     BattleLog = person.Name + " used " + moveIn.Name + " with " + target.Name + ".";
     while (ElapsedTime  < 1)
     {
         ElapsedTime += (float)gameTime.ElapsedGameTime.Milliseconds;
     }
 }
示例#3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            GenericEnemy.Name = "Monster";
            base.Initialize();
            //Creates characters on initalization
            //Needs some sort of file reader beforehand to input stats
            //For now they have defaults
            turn = 0;
            monstersKilled = 0;
            currentTime = 0;
            PlayerTarget = -1;
            targetting = false;

            BattleLog = "BATTLELOG:";

            RedPotion = new Potions(0, RedBottle);
            GreenPotion = new Potions(1, GreenBottle);
            BluePotion = new Potions(2, BlueBottle);
            OrangePotion = new Potions(3, OrangeBottle);
            YellowPotion = new Potions(4, YellowBottle);
            PurplePotion = new Potions(5, PurpleBottle);
            MilkPotion = new Potions(6, MilkBottle);
            BlackPetalPotion = new Potions(7, BlackPetalBottle);

            HealerObj = new Actor("Healer");
            TankObj = new Actor("Tank");
            MageObj = new Actor("Mage");
            DpsObj = new Actor("Warrior");

            HealerObj.ActorFile("Healer");
            TankObj.ActorFile("Tank");
            MageObj.ActorFile("Mage");
            DpsObj.ActorFile("Warrior");

            GenericEnemy = new Actor("Generic");
            DragonObj = new Actor("PurpleEvilDragon");
            FrogObj = new Actor("RobotSnowFrog");

            DragonObj.ActorFile("PurpleEvilDragon");
            FrogObj.ActorFile("RobotSnowFrog");

            testHeal = new Move("testHeal");
            testTargetHeal = new Move("testTargetHeal");
            testBash = new Move("testBash");
            testCast = new Move("testCast");
            testSlash = new Move("testSlash");

            testFireBreath = new Move("testFireBreath");
            testClaw = new Move("testClaw");
            testCannon = new Move("testCannon");
            testHop = new Move("testHop");

            testHeal.MoveRead("testHeal");
            testBash.MoveRead("testBash");
            testCast.MoveRead("testCast");
            testSlash.MoveRead("testSlash");

            testFireBreath.MoveRead("testFireBreath");
            testClaw.MoveRead("testClaw");
            testCannon.MoveRead("testCannon");
            testHop.MoveRead("testHop");

            monsterList = new List<Actor>();
            monsterList.Add(DragonObj);
            monsterList.Add(FrogObj);

            enemyAttackList = new List<Move>();
            enemyAttackList.Add(testFireBreath);
            enemyAttackList.Add(testClaw);
            enemyAttackList.Add(testCannon);
            enemyAttackList.Add(testHop);
        }
示例#4
0
 private void PlayerMove(Actor User, Move moveName, Actor Enemy)
 {
     if (User.curStamina >= moveName.StaminaCost)
     {
         User.curStamina -= moveName.StaminaCost;
         int damageDealt;
         Random rand = new Random();
         if (moveName.Type == "Physical")
         {
             damageDealt = (User.Attack * moveName.Attack) / 100;
             if (rand.Next(0, 100) + Enemy.Dodge >= moveName.Accuracy)
             {
                 damageDealt = 0;
             }
             Enemy.curHealth -= damageDealt;
         }
         else if (moveName.Type == "Magical")
         {
             damageDealt = User.Magic * moveName.Attack / 100;
             if (rand.Next(0, 100) + Enemy.Dodge >= moveName.Accuracy)
             {
                 damageDealt = 0;
             }
             Enemy.curHealth -= damageDealt;
         }
         else if (moveName.Type == "Target")
         {
             damageDealt = User.Magic * moveName.Attack / 100;
             Enemy.curHealth -= damageDealt;
         }
         else
         {
             damageDealt = moveName.Attack;
             if (rand.Next(0, 100) < moveName.Accuracy)
             {
                 damageDealt = 0;
             }
             HealerObj.curHealth -= damageDealt;
             if (TankObj.curHealth > 0)
             {
                 TankObj.curHealth -= damageDealt;
             }
             if (MageObj.curHealth > 0)
             {
                 MageObj.curHealth -= damageDealt;
             }
             if (DpsObj.curHealth > 0)
             {
                 DpsObj.curHealth -= damageDealt;
             }
         }
     }
     if (User.curStamina > User.Stamina)
     {
         User.curStamina = User.Stamina;
     }
 }