Example #1
0
 public static void PlayedCard(int PlayerID, CardTypes type, bool isNewCard)
 {
     CurrentRoyalRoundTimes = CardsBeforeMove;
     if (PlayerID != GameProperties.GetCurrentPlayerID())
     {
         throw new Exception("A player whose turn hadn't come yet was able to play!");
     }
     if (isNewCard)
     {
         GameProperties.CardAddedToTheTable();
     }
     if (Card.isSameType(type, LastPlayedType) && GameProperties.GetNumberOfCardsOnTable() > 1 && isNewCard)
     {
         //THE SAME KIND OF CARD HAS BEEN PLAYED
         //TODO Implement reaction to the same kind of card being played. Don't forget to reset number of cards on table afterwards
         Debug.Log("SAME TYPE SAME TYPE SAME TYPEEEEEEEEEEEEEEEEEE");
         GameProperties.ActivateSameTypesInMiddle(type, PlayerID);
         return;
     }
     if (Card.isRoyalCard(type) == -1)
     {
         //A NON ROYAL CARD HAS BEEN PLAYED!
         if (!OnRoyalRound)
         {
             //NOT ON ROYAL ROUND, MOVE TO NEXT PLAYER
             Debug.Log("Normal Stuff m8");
             GameProperties.MoveToNextPlayer();
         }
         else
         {
             //IS ON ROYAL ROUND, IS BEING CHALLENGED BY OTHER PLAYER'S ROYAL CARD!!1
             CardsBeforeMove--;
             CurrentRoyalRoundTimes--;
             if (CardsBeforeMove == 0)
             {
                 //COULDNT PLAY ROYAL CARD DESPITE THE OTHER PLAYER'S ROYAL CHALLENGE, REWARD THE OTHER PLAYER THE CARDS.
                 Debug.Log("Sheet man he or she or it or helicopter has failed to draw a royal card!");
                 OnRoyalRound    = false;
                 CardsBeforeMove = 1;
                 LastPlayedType  = type;
                 GameProperties.ResetNumberOfCardsOnTheTable();
                 GameProperties.ResetAssignableZPosition();
                 Player.Players[(GameProperties.GetCurrentPlayerNumberID() == 1) ? ((GameProperties.isGame2Player()) ? NumbertoPlayer[2].PlayerID : NumbertoPlayer[4].PlayerID) :
                                NumbertoPlayer[GameProperties.GetCurrentPlayerNumberID() - 1].PlayerID].PlayerSet.ClaimMiddleCardsInASecond();
                 //We will move to the player before after the shuffle.
                 CurrentRoyalRoundTimes = 1;
                 return;
             }
             Debug.Log("Still Can win!");
             return;  //OUR CURRENT PLAYER STILL HAS CHANCES TO PLAY MORE IN ORDER TO WIN THE CHALLENGE.
         }
     }
     else
     {
         //A ROYAL CARD HAS BEEN PLAYED
         Debug.Log("Ow shit son a royal is among us!");
         OnRoyalRound    = true;
         CardsBeforeMove = Card.isRoyalCard(type);
         GameProperties.MoveToNextPlayer();
         CurrentRoyalRoundTimes = CardsBeforeMove;
     }
     LastPlayedType = type;
 }