Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Transformer t1 = new Decepticon(8, 9, 2, 6, 7, 5, 6, 10, "Soundwave", 'D');
            Transformer t2 = new Autobot(6, 6, 7, 9, 5, 2, 9, 7, "Bluestreak", 'A');
            Transformer t3 = new Autobot(4, 4, 4, 4, 4, 4, 4, 4, "Hubcap", 'A');

            Battle(new Transformer[] { t1, t2, t3 });
        }
Exemplo n.º 2
0
 /// <summary>
 /// This is a function to let transformers fight and record the results
 /// </summary>
 /// <param name="autobot">autobot</param>
 /// <param name="deception">deception</param>
 /// <param name="rA">record for aubobot</param>
 /// <param name="rD">record for deception</param>
 static void compete(Autobot autobot, Decepticon deception, Record rA, Record rD)
 {
     if (autobot.Name.Equals(OptimusPrime) && !deception.Name.Equals(Predaking))
     {
         rA.NumOfDestroiedEnemies++;
         rA.Survivor.Add(autobot);
     }
     else if (!autobot.Name.Equals(OptimusPrime) && deception.Name.Equals(Predaking))
     {
         rD.NumOfDestroiedEnemies++;
         rD.Survivor.Add(deception);
     }
     else if (autobot.Courage - deception.Courage >= 4 && autobot.Strength - deception.Strength >= 3)
     {
         rA.NumOfDestroiedEnemies++;
         rA.Survivor.Add(autobot);
     }
     else if (deception.Courage - autobot.Courage >= 4 && deception.Strength - autobot.Strength >= 3)
     {
         rD.NumOfDestroiedEnemies++;
         rD.Survivor.Add(deception);
     }
     else if (autobot.Skill - deception.Skill >= 3)
     {
         rA.NumOfDestroiedEnemies++;
         rA.Survivor.Add(autobot);
     }
     else if (deception.Skill - autobot.Skill >= 3)
     {
         rD.NumOfDestroiedEnemies++;
         rD.Survivor.Add(deception);
     }
     else if (autobot.getOverallRating() > deception.getOverallRating())
     {
         rA.NumOfDestroiedEnemies++;
         rA.Survivor.Add(autobot);
     }
     else if (deception.getOverallRating() > autobot.getOverallRating())
     {
         rD.NumOfDestroiedEnemies++;
         rD.Survivor.Add(deception);
     }
     else
     {
         // then it is a tie
         rA.NumOfDestroiedEnemies++;
         rD.NumOfDestroiedEnemies++;
     }
 }