Пример #1
0
 private void RoundExhausted()
 {
     Debug.WriteLine("RoundExhausted::Invoked.");
     // Reiniciamos el juego
     Engine.ReiniciaGame(true);
     // Actualizamos la pantalla indicando que pinte los programas
     if (Event_roundExhausted != null)
     {
         MyEvent e3 = new MyEvent();
         e3.message    = "";
         e3.ganador    = 0;
         e3.round      = nRound;
         e3.ciclos     = totalciclos;
         e3.winnername = "";
         Event_roundExhausted(this, e3);
     }
     update(0);
     totalciclos = 0;
 }
Пример #2
0
        public void stepCombate()
        {
            Debug.WriteLine("r2wars:stepCombate");
            if (bInCombat)
            {
                if (!bDead)
                {
                    if (bResetArena)
                    {
                        bResetArena = false;
                        Engine.ReiniciaGame(true);
                        // Actualizamos la pantalla indicando que pinte los programas
                        resetTablero();
                        drawPC(Engine.thisplayer);
                        drawPC(Engine.otherplayer);
                        drawscreen(Engine.thisplayer);
                        drawscreen(Engine.otherplayer);
                        send_draw_event(json_output());
                        return;
                    }

                    totalciclos++;
                    if (totalciclos > MAX_CYCLES)
                    {
                        nExausted++;
                        if (nExausted > 2)
                        {
                            bInCombat    = false;
                            bThreadIni   = false;
                            bStopProcess = false;
                            CombatEnd(true);
                            nExausted = 0;
                            return;
                        }
                        else
                        {
                            RoundExhausted();
                            totalciclos = 0;
                            bResetArena = true;
                            return;
                        }
                    }
                    ExecuteRoundInstruction(false);
                }
                else
                {
                    victorias[Engine.thisplayer]++;
                    if (nRound == 3 || victorias[1] == 2 || victorias[0] == 2)
                    {
                        bInCombat    = false;
                        bThreadIni   = false;
                        bStopProcess = false;
                        RoundEnd();
                        CombatEnd();
                    }
                    else
                    {
                        RoundEnd();
                        bDead       = false;
                        totalciclos = 0;
                        bResetArena = true;
                        nRound++;
                    }
                }
            }
        }