Exemplo n.º 1
0
 private static void CombatFacile(MonstreFacile monster, ref Joueur player)
 {
     while (monster.IsAlive)
     {
         // first strike : by player
         if (player.Jet() < monster.Jet())
         {
             // second strike : by the monster
             if (player.Jet() < monster.Jet())
             {
                 if (player.Shield < monster.Jet())
                 {
                     player.Damage(10);
                 }
             }
         }
         else
         {
             monster.IsAlive = false;
         }
     }
 }
Exemplo n.º 2
0
        private static int[] GameOn(ref int[] result)
        {
            Joueur player = new Joueur();

            while (player.HealthPoint >= 1)
            {
                int choixMonstre = De.LancerD2();

                if (choixMonstre == 1)
                {
                    MonstreFacile monster = new MonstreFacile();
                    CombatFacile(monster, ref player);
                    result[0]++;
                }
                else
                {
                    MonstreDifficile monster = new MonstreDifficile();
                    CombatDifficile(monster, ref player);
                    result[1]++;
                }
            }

            return(result);
        }