//Kezeljük a játékos kiválasztott kártyáját
        public void HandleCardSelection(int selectedCard, int currentKey)
        {
            //Ha az akció tartalékolás volt
            if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.Store)
            {
                //A modelben frissítjük a helyzetet
                modules.GetDataModule().SacrificeWinnerCard(selectedCard, currentKey);

                //UI oldalon is frissítjük a helyzetet, hogy aktuális állapotot tükrözzön
                int    winSize  = modules.GetDataModule().GetWinnerAmount(currentKey);
                int    lostSize = modules.GetDataModule().GetLostAmount(currentKey);
                Sprite win      = modules.GetDataModule().GetLastWinnerImage(currentKey);
                Sprite lost     = modules.GetDataModule().GetLastLostImage(currentKey);
                modules.GetClientModule().ChangePileText(winSize, lostSize, currentKey, win, lost);
                modules.GetGameModule().SetCurrentAction(SkillEffectAction.None);
                modules.GetGameModule().ActionFinished();
            }

            else
            {
                modules.GetSkillModule().HandleSelectionForSkill(selectedCard, currentKey);
            }
        }
Пример #2
0
        private IEnumerator HandCheckAction()
        {
            int currentKey = controller.GetCurrentKey();

            //Ha több mint 7 lap van a kezünkben, le kell dobni egy szabadon választottat.
            if (modules.GetDataModule().GetCardsFromPlayer(currentKey, CardListTarget.Hand).Count > 7)
            {
                controller.SetCurrentAction(SkillEffectAction.TossCard);
                controller.SetSwitchType(CardListTarget.Hand);

                modules.GetSkillModule().MakePlayerChooseCard();
                yield return(new WaitForSeconds((GameSettings_Controller.drawTempo) / 2));

                controller.ActionFinished();
            }

            else
            {
                yield return(new WaitForSeconds((GameSettings_Controller.drawTempo) / 2));

                controller.ActionFinished();
            }
        }
 //Képesség használata
 public void Use(int cardPosition)
 {
     modules.GetSkillModule().UseSkill(modules.GetDataModule().GetPlayerWithKey(currentKey).GetCardsOnField()[cardPosition].GetCardID());
 }
        //Kártyacsere vagy választás
        public IEnumerator CardSelectionEffect(int key, CardListFilter filter, int limit = 0, int otherPlayer = -1)
        {
            GetCurrentContext(key);

            //Ha cseréről van szó
            if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.Switch)
            {
                int handID = -1;

                //Ha kézből cserélünk
                if (modules.GetGameModule().GetCurrentListType() == CardListTarget.Hand)
                {
                    handID = Bot_Behaviour.HandSwitch(
                        modules.GetDataModule().GetCardsFromPlayer(currentKey, CardListTarget.Hand),
                        modules.GetDataModule().GetCardsFromPlayer(currentKey, CardListTarget.Field),
                        modules.GetDataModule().GetOpponentsCard(currentKey),
                        currentStat);

                    modules.GetSkillModule().SwitchCard(currentKey, modules.GetGameModule().GetActiveCardID(), handID);
                }
            }

            //Ha skill lopásról van szó
            else if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.SkillUse)
            {
                //Adatgyűjtés
                Card ownCard = modules.GetDataModule().GetCardFromPlayer(currentKey, modules.GetGameModule().GetActiveCardID(), CardListTarget.Field);
                List <PlayerCardPairs> cards = modules.GetDataModule().GetOtherLosers(currentKey);
                int index = Bot_Behaviour.WhichSkillToUse(cards);

                modules.GetInputModule().HandleCardSelection(cards[index].cardPosition, cards[index].playerKey);
                yield break;
            }

            //Ha felélesztésről van szó
            else if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.Revive)
            {
                List <Card> cards  = modules.GetDataModule().GetCardsFromPlayer(currentKey, CardListTarget.Losers);
                int         cardID = Bot_Behaviour.WhomToRevive(cards);
                modules.GetInputModule().HandleCardSelection(cardID, currentKey);
            }

            else if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.Execute)
            {
                List <int> temp       = modules.GetDataModule().GetOtherKeyList(currentKey);
                int        choosenKey = Bot_Behaviour.WhichPlayerToExecute(temp);

                modules.GetInputModule().ReportNameBoxTapping(choosenKey);
                yield return(modules.GetGameModule().WaitForEndOfAction());
            }

            else if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.SwitchOpponentCard)
            {
                List <int> temp       = modules.GetDataModule().GetOtherKeyList(currentKey);
                int        choosenKey = Bot_Behaviour.WhichPlayerToExecute(temp);

                modules.GetInputModule().ReportNameBoxTapping(choosenKey);
                yield return(modules.GetGameModule().WaitForEndOfAction());
            }

            else if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.PickCardForSwitch)
            {
                List <Card> cardsOnField  = modules.GetDataModule().GetCardsFromPlayer(otherPlayer, CardListTarget.Field);
                int         choosenCardID = Bot_Behaviour.WhichCardToSwitch(cardsOnField);
                int         deckCount     = (modules.GetDataModule().GetDeckAmount(otherPlayer)) - 1;
                modules.GetGameModule().SetSwitchType(CardListTarget.Deck);
                modules.GetSkillModule().SwitchCard(otherPlayer, choosenCardID, deckCount);
            }

            else if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.CheckWinnerAmount)
            {
                List <int> keyList    = modules.GetDataModule().GetOtherKeyList(currentKey);
                List <int> winAmounts = modules.GetDataModule().GetOthersWinAmount(currentKey);

                int playerID = Bot_Behaviour.WhichPlayerToChoose(winAmounts);

                modules.GetInputModule().ReportNameBoxTapping(keyList[playerID]);
            }

            //Ha kézből eldobásról van szó
            else if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.TossCard)
            {
                //Csak akkor dobunk el lapot, ha van a kezünkben
                if (cardsInHand.Count > 1)
                {
                    int cardID = Bot_Behaviour.WhomToToss(cardsInHand);
                    modules.GetInputModule().HandleCardSelection(cardID, currentKey);
                }

                else
                {
                    Debug.Log("Nincs mit eldobni");
                    modules.GetGameModule().ActionFinished();
                }
            }

            else if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.SacrificeFromHand)
            {
                int cardID = Bot_Behaviour.WhomToToss(cardsInHand);
                modules.GetInputModule().HandleCardSelection(cardID, currentKey);
            }

            else if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.SacrificeDoppelganger)
            {
                List <Card> cardList = modules.GetDataModule().GetCardsFromPlayer(currentKey, CardListTarget.Hand, filter);
                if (cardList.Count > 0)
                {
                    int cardID = Bot_Behaviour.WhomToToss(cardList);
                    modules.GetInputModule().HandleCardSelection(cardID, currentKey);
                }

                else
                {
                    Debug.Log("Nincs megfelelő lap a kézben");
                    modules.GetGameModule().ActionFinished();
                }
            }

            else if (modules.GetGameModule().GetCurrentAction() == SkillEffectAction.Reorganize)
            {
                List <Card> cardsInDeck = modules.GetDataModule().GetCardsFromPlayer(currentKey, CardListTarget.Deck, CardListFilter.None, limit);
                cardsInDeck = Bot_Behaviour.OrganiseCardsInDeck(cardsInDeck, modules.GetDataModule().GetRNG());
                modules.GetInputModule().HandleChangeOfCardOrder(cardsInDeck, currentKey);
            }
        }