Example #1
0
 void EvaluateTurn()
 {
     // if a side lost the battle then end it
     //if ((currentHpNPC <= 0 || currentHpPlayer <= 0) && Time.timeSinceLevelLoad - timeEnter >= timeExit)
     // This is infocard case 1
     if (currentHpNPC <= 0 || currentHpPlayer <= 0)
     {
         Debug.Log("A side has reached 0 HP. Game is over");
         nextPhase = new EndBattle(battleManager, playerStats, npcData, playerHand, npcHand);
         battleManager.nPCDisplay.SetReaction(npcData.endQuotes[Random.Range(0, npcData.endQuotes.Length)], npcData.enemyAngry);
         DisplayInfoCard(1);
     }
     // if challenge is won, even if target isn't reached yet then start a new round
     // this is infocard case 2
     else if (isChallengeWon)
     {
         Debug.Log("Challenge is won by opponent. Moving cards to graveyard and starting a new round.");
         battleManager.SwitchTurn();
         // empty table and pot before new round
         table.ClearTable(CardCollections.Graveyard);
         pot.EmptyPot();
         nextPhase = new NewRound(battleManager, playerStats, npcData, playerHand, npcHand);
         DisplayInfoCard(2);
     }
     // if the target is crossed then start a new round and move cards to pot
     // this is infocard case 3
     else if (battleManager.currentNumber > battleManager.targetNumber)
     {
         Debug.Log("Target number is crossed. Moving cards to Pot and starting a new round.");
         battleManager.SwitchTurn();
         table.ClearTable(CardCollections.Pot);
         nextPhase = new NewRound(battleManager, playerStats, npcData, playerHand, npcHand);
         DisplayInfoCard(3);
     }
     // if the target is reached then start a new round and move cards to graveyard
     // this is infocard case 4
     else if (battleManager.currentNumber == battleManager.targetNumber)
     {
         Debug.Log("Target number is reached. Moving cards to Graveyard and starting a new round.");
         battleManager.SwitchTurn();
         // empty table and pot before new round
         table.ClearTable(CardCollections.Graveyard);
         pot.EmptyPot();
         nextPhase = new NewRound(battleManager, playerStats, npcData, playerHand, npcHand);
         DisplayInfoCard(4);
     }
     // if neither of the above then continue the same round and switch turns
     // this is infocard case 5
     else
     {
         Debug.Log(battleManager.playerTurn + " player's turn has ended. Switching sides.");
         battleManager.SwitchTurn();
         nextPhase = new CardDeal(battleManager, playerStats, npcData, playerHand, npcHand);
         DisplayInfoCard(5);
     }
 }