Пример #1
0
 private void ExecuteEnemyAction(Enemy e, GameTime gameTime)
 {
     lastMessageTime = gameTime.TotalGameTime;
       SetHealthReferencePoint();
       if (e.GetEnemyStats().Health > 0)
       {
     SetHealthReferencePoint();
     if (e.whichAi == 1)
     {
       e.ExecuteAI1(enemySelectedPlayer);
       AddMessage(e.Name + " attacked " + enemySelectedPlayer.Name + "!");
     }
     else if (e.whichAi == 2)
     {
       chosenEnemySkill = e.ExecuteAI2(enemySelectedPlayer, e);
       if (chosenEnemySkill != null)
       {
     AddMessage(e.Name + " cast " + e.skillA.Name + "!");
       }
       else
       {
     AddMessage(e.Name + " attacked " + enemySelectedPlayer.Name + "!");
       }
     }
     else if (e.whichAi == 3)
     {
       chosenEnemySkill = e.ExecuteAI3(enemySelectedPlayer, e);
       AddMessage(e.Name + " cast " + chosenEnemySkill.Name + "!");
     }
     DeterminePlayerMessages(enemySelectedPlayer);
     DetermineOtherMessages(enemySelectedPlayer);
       }
 }
Пример #2
0
        public Skill ExecuteAI3(Player p, Enemy e)
        {
            Skill chosenSkill;
              int randomNumber = random.Next(1, 100);

              if (randomNumber > 50)
              {
            chosenSkill = skillA;
              }
              else
              {
            chosenSkill = skillB;
              }

              if (chosenSkill.isDamage)
              {
            int damage = (int)(enemyStats.Concentration * chosenSkill.skillRatio) - p.GetPlayerStats().Defence;
            if (damage <= 0)
            {
              damage = 1;
            }
            p.GetPlayerStats().SubtractHealth(damage);
              }
              else if (chosenSkill.isHealing)
              {
            int health = (int)(enemyStats.Concentration * chosenSkill.skillRatio);
            e.GetEnemyStats().addHealth(health);
            Console.WriteLine(health);
              }
              return chosenSkill;
        }
Пример #3
0
 public void ExecuteSkillB(Enemy e, Player p)
 {
     if (skillB.isDamage)
       {
     int damage = (int)(playerStats.Concentration * skillB.skillRatio) - e.GetEnemyStats().Defence;
     if (damage < 0)
     {
       damage = 1;
     }
     e.GetEnemyStats().SubtractHealth(damage);
       }
       else if (skillB.isHealing)
       {
     int health = (int)(playerStats.Concentration * skillB.skillRatio);
     p.GetPlayerStats().addHealth(health);
       }
 }
Пример #4
0
 public Skill ExecuteAI2(Player p, Enemy e)
 {
     int randomNumber = random.Next(1, 100);
       Skill chosenSkill;
       if (randomNumber > 50)
       {
     chosenSkill = null;
     int damage = enemyStats.Attack - p.GetPlayerStats().Defence;
     if (damage < 0)
     {
       damage = 1;
     }
     p.GetPlayerStats().SubtractHealth(damage);
       }
       else
       {
     chosenSkill = skillA;
     if (skillA.isDamage)
     {
       int damage = (int)(enemyStats.Concentration * skillA.skillRatio) - p.GetPlayerStats().Defence;
       if (damage <= 0)
       {
     damage = 1;
       }
       p.GetPlayerStats().SubtractHealth(damage);
     }
     else if (skillA.isHealing)
     {
       int health = (int)(enemyStats.Concentration * skillA.skillRatio);
       e.GetEnemyStats().addHealth(health);
     }
       }
       return chosenSkill;
 }
Пример #5
0
 public int ExecuteBasicAttack(Enemy e)
 {
     int damage = playerStats.Attack - e.GetEnemyStats().Defence;
       if (damage <= 0)
       {
     damage = 1;
       }
       e.GetEnemyStats().SubtractHealth(damage);
       return damage;
 }