Beispiel #1
0
 private static void CombatDifficile(MonstreDifficile monster, ref Joueur player)
 {
     while (monster.IsAlive)
     {
         // first strike : by player
         if (player.Jet() < monster.Jet())
         {
             // second strike : by monster
             if (player.Jet() < monster.Jet())
             {
                 if (player.Shield < monster.Jet())
                 {
                     player.Damage(10);
                 }
             }
             // magic strike : by monster
             int magic = monster.Jet();
             player.Damage(magic == 6 ? 0 : magic * 5);
         }
         else
         {
             monster.IsAlive = false;
         }
     }
 }
Beispiel #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);
        }