/// <summary> /// Method to decide which action to be taken by Player based on call percent calculation /// </summary> private void ChoseActionToPlayAndInformListeners() { int callPercent = GetCallPercent(GameController.Instance.GetPlayers(), this); Debug.Log("Call Percent" + callPercent); if (callPercent >= 85) { listener.SayMinimum(this); } else if (myDeck.CardsCount() < 3) { PickBestCard(myDeck, GameController.Instance.DiscardedDeck.GetTopCard()); } else { int straightResult = HandCombination.IsStraight(this, GameController.Instance.DiscardedDeck.GetTopCard()); Debug.Log("Straight Method result" + straightResult); // int threeOfKindResult = HandCombination.isThreeOfKind(this, GameController.Instance.DealtDeck.GetTopCard()); int threeOfKindResult = HandCombination.isThreeOfKind(this, GameController.Instance.DiscardedDeck.GetTopCard()); Debug.Log("Three of kinds method result" + threeOfKindResult); if (straightResult == 1) //Straight card exist in Player Deck { Debug.Log("Straight Card exist in Player Deck getting it now"); Deck straightCards = HandCombination.GetStraight(this); listener.MultiSwapFromDiscardedDeck(this, straightCards); } else if (straightResult == -1) //Straight card created by deck and discarded deck card combination { Debug.Log("Straight card created by deck and discarded deck card combination"); Card nonStraightCard = HandCombination.CreateStraight(this, GameController.Instance.DiscardedDeck.GetTopCard()); listener.SingleSwapFromDiscardedDeck(this, nonStraightCard); } else if (threeOfKindResult == 1) //Three of kind exist in Player Deck { Debug.Log("Three of kind exist in Player Deck getting it now"); Deck threeOfKind = HandCombination.GetThreeOfKind(this); listener.MultiSwapFromDiscardedDeck(this, threeOfKind); } else if (threeOfKindResult == -1) //Three of kind created using Player deck and Discarded Deck card { Debug.Log("Three of kind created using Player deck and Discarded Deck card"); Card threeOfKindCard = HandCombination.CreateThreeOfKind(this, GameController.Instance.DiscardedDeck.GetTopCard()); listener.SingleSwapFromDiscardedDeck(this, threeOfKindCard); } else { PickBestCard(myDeck, GameController.Instance.DiscardedDeck.GetTopCard()); //IF nothing match, pick AI player deck largest card } } }