Пример #1
0
    /*public void StartCardFxCon(int playerIndex, int cardIndex)
    {
        var card = playCards[cardIndex];
        var libCard = card.GetLibCard();
        var libFx = new LibraryFX();

        if (libFx.conditionCount <= 0) { return; }
        if (libFx.conditionMore)
        {

        }
        if (!libFx.conditionMore)
        {
            int value = 0;

            for (int i = 0; i < playCards.Count; i++)
            {
                if (playCards[i].pile == libFx.selectorPile)
                {
                    value++;
                }
            }
        }

    }*/
    public void StartCardFx( int playerIndex, int libCardIndex, int fxIndex = 0, int adjacentPos = -1, PlayCard card = null )
    {
        Debug.Log("StartCardFx entered");
        /*if (effectCounter >= 2) {
            Debug.Log("test");
            return;
        }*/

        //var card = playCards[cardIndex];
        var libCard = CardLibrary.Get().GetCard(libCardIndex);
        //var libFx = new LibraryFX();

        //if (libCard == null) { return; }

        Debug.Log("StartCardFX()" + libCard.fxList.Count + " " + fxIndex + " " + libCardIndex);
        if (libCard.fxList.Count <= 0) { return; }

        Debug.Log("Start effectCounter " + effectCounter);
        currentFx = new PlayFX();
        //currentFx.cardId = libCardIndex;
        currentFx.fxIdx = effectCounter;
        currentFx.libId = libCardIndex;
        Debug.Log("currentfx = 0?" + currentFx.libId);
        currentFx.fxIdx = fxIndex;
        currentFx.playerIdx = playerIndex;
        if (card != null)
        {
            currentFx.globalIdx = card.globalIdx;
        }

        var libFx = currentFx.GetLibFx();
        currentFx.actionCount = libFx.actionCount;
        currentFx.selectorCount = libFx.selectorCount;
        if (libFx.adjacentPos) { currentFx.adjacentPos = adjacentPos; }

        effectInProgess = true;

        //Condition
        if (libFx.conditionType != LibraryFX.ConditionType.none)
        {
            Debug.Log(currentFx.GetLibFx().conditionType);
            //GREED
            if (libFx.conditionType == LibraryFX.ConditionType.ctrlOwn)
            {
                //Debug.Log("value check storage: " + (CountCards(playerIndex, PlayCard.Pile.field) + 1) + " / " + libFx.conditionCount + " * " + currentFx.actionCount);
                Debug.Log("value storage check: " + (CountCards(playerIndex, PlayCard.Pile.field) + 1) + " / " + libFx.conditionCount);
                int storage = ((CountCards(playerIndex, PlayCard.Pile.field) + 1) / libFx.conditionCount);
                Debug.Log("storage: " + storage);

                if (storage > 1) { storage = 1; Debug.Log("storage: " + storage); }
                else if (storage < 0) { storage = 0; Debug.Log(storage); }
                storage = storage * currentFx.actionCount;
                Debug.Log("storage: " + storage);

                currentFx.actionCount = storage;
                currentFx.actionCount = storage;
                if (storage > 0)
                {
                    currentFx.selectorCount = storage;
                }
                if (storage < 0)
                {
                    currentFx.selectorCount = -storage;
                }
            }
            //ENVY
            if (libFx.conditionType == LibraryFX.ConditionType.ctrlOpp)
            {
                Debug.Log("value check storage: " + (CountCards((playerIndex + 1) % 2, PlayCard.Pile.field) + 1) + " / " + libFx.conditionCount + " * " + currentFx.actionCount);
                int storage = ((CountCards((playerIndex + 1) % 2, PlayCard.Pile.field) + 1) / libFx.conditionCount);
                Debug.Log("storage " + storage);
                if (storage > 1) { storage = 1; Debug.Log(storage); }
                else if (storage < 0) { storage = 0; Debug.Log(storage); }
                storage = storage * currentFx.actionCount;
                Debug.Log("storage: " + storage);

                currentFx.actionCount = storage;
                if (storage > 0)
                {
                    currentFx.selectorCount = storage;
                }
                if (storage < 0)
                {
                    currentFx.selectorCount = -storage;
                }
            }

            //PRIDE
            if (libFx.conditionType == LibraryFX.ConditionType.ctrlMoreOwn)
            {
                Debug.Log("value check storage: " + ((CountCards(playerIndex, PlayCard.Pile.field) + 1) + " / " + (CountCards(playerIndex + 1 % 2, PlayCard.Pile.field) + 1)));

                //int storage = (((CountCards(playerIndex, PlayCard.Pile.field) - libFx.conditionCount) + 1) / (CountCards(playerIndex + 1 % 2, PlayCard.Pile.field) + 1));
                int storage = (CountCards(playerIndex, PlayCard.Pile.field) + 1) - (CountCards(playerIndex + 1 % 2, PlayCard.Pile.field) + 1);
                Debug.Log("storage: " + storage + "conCount: " + libFx.conditionCount);
                if (storage >= libFx.conditionCount) { storage = 1; Debug.Log(storage); }
                else if (storage < libFx.conditionCount) { storage = 0; Debug.Log(storage); }
                storage = storage * currentFx.actionCount;
                Debug.Log("storage: " + storage);

                currentFx.actionCount = storage;
                if (storage > 0)
                {
                    currentFx.selectorCount = storage;
                }
                if (storage < 0)
                {
                    currentFx.selectorCount = -storage;
                }
            }
            /*
             * //DELETE FOR BUILD, NOT IN USE
            if (libFx.conditionType == LibraryFX.ConditionType.ctrlMoreOpp)
            {
                currentFx.actionCount = currentFx.selectorCount = (CountCards(playerIndex, PlayCard.Pile.field) / libFx.conditionCount);
            }
            /**/

            //WRATH
            if (libFx.conditionType == LibraryFX.ConditionType.kills)
            {
                //Debug.Log("calc ints: " + (players[playerIndex].kills + " " + libFx.conditionCount + " " + libFx.actionCount));
                int storage = currentFx.selectorCount = (players[playerIndex].kills / libFx.conditionCount);
                //prevents exponential actioncounts
                if (storage > 1) { storage = 1; }
                storage = storage * currentFx.actionCount;
                //Debug.Log("storage: " + storage);

                currentFx.actionCount = storage;
            }

            if (currentFx.selectorCount > 1) { currentFx.selectorCount = 1; }
            //Debug.Log("sdgdssh " + currentFx.selectorCount);
        }

        //Target checks

        //Selector
        Debug.Log("ACTIONCOUNT DEBUG: " + currentFx.actionCount + " " + currentFx.GetLibFx().actionType);
        if (currentFx.actionCount != 0 || (currentFx.GetLibFx().actionType == LibraryFX.ActionType.tap || currentFx.GetLibFx().actionType == LibraryFX.ActionType.ready))
        {
            if (libFx.selectorPile == PlayCard.Pile.none || currentFx.selectorCount <= 0) { currentFx.selectorDone = true; }

            if (!CheckSelectorAll(playerIndex)) { currentFx.selectorDone = true; Debug.Log("Skip Selector"); }
            Debug.Log("currentFx" + currentFx.GetLibFx().description);
            SendGameManager();
            ExeCardFx();
        }
        else if (currentFx.GetLibFx().actionType != LibraryFX.ActionType.tap || currentFx.GetLibFx().actionType != LibraryFX.ActionType.ready)
        {
            if (currentFx.actionCount == 0)
            {
                effectInProgess = false;
                currentFx = new PlayFX();
            }
        }
    }
Пример #2
0
    public void ExeCardFx()
    {
        Debug.Log("destgds tb" + currentFx.libId + "||" + currentFx.selectorDone);
        if (currentFx.libId == 0)
        {
            SendGameManager();
            return;
        }

        if (currentFx.libId >= 701 && currentFx.libId <= 706)
        {
            //Debug.LogError("monument bool not set correctly");
            monumentfx = true;
        }

        if (!currentFx.selectorDone)
        {
            SendGameManager();
            return;
        }

        var libFx = currentFx.GetLibFx();

        if (libFx.actionType == LibraryFX.ActionType.none)
        {
            Debug.Log("No effect assigned");
        }

        if (libFx.actionType == LibraryFX.ActionType.draw)
        {
            if (monumentfx == true)
            {
                currentFx.actionCount += Neverfall_God_of_Pride;
            }

            Debug.Log("adgldjsoidjoisjoi draw");
            DrawCard(currentFx.playerIdx, currentFx.actionCount);
        }

        if (libFx.actionType == LibraryFX.ActionType.discard)
        {
            for (int i = 0; i < currentFx.selectedCards.Count; i++)
            {
                int cardIndex = currentFx.selectedCards[i];
                var card = playCards[cardIndex];

                if (card.pile == PlayCard.Pile.field && currentFx.playerIdx == ((card.owner + 1) % 2))
                {
                    players[((card.owner + 1) % 2)].kills++;
                }

                DiscardCard(card.owner, cardIndex);
            }

            /*if (Neverfall_God_of_Pride > 0)
            {
                monumentfx = false;
                StartCardFx(currentFx.playerIdx, 500);
            }
            /**/
        }

        if (libFx.actionType == LibraryFX.ActionType.tap)
        {
            for (int i = 0; i < currentFx.selectedCards.Count; i++)
            {
                int cardIndex = currentFx.selectedCards[i];
                var card = playCards[cardIndex];
                card.actions = 0;
                card.tap++;
            }
        }

        if (libFx.actionType == LibraryFX.ActionType.ready)
        {
            for (int i = 0; i < currentFx.selectedCards.Count; i++)
            {
                int cardIndex = currentFx.selectedCards[i];
                var card = playCards[cardIndex];
                card.tap = 0;
            }
        }

        if (libFx.actionType == LibraryFX.ActionType.buffHeal)
        {
            if (monumentfx == true)
            {
                currentFx.actionCount += Neverfall_God_of_Pride;
            }

            for (int i = 0; i < currentFx.selectedCards.Count; i++)
            {
                int cardIndex = currentFx.selectedCards[i];
                var card = playCards[cardIndex];
                if (card.health < card.GetLibCard().health)
                {
                    card.health += currentFx.actionCount;
                }
                if (card.actions > 0) { card.tap = 0; }
            }
        }

        if (libFx.actionType == LibraryFX.ActionType.buffAction)
        {
            if (monumentfx == true)
            {
                currentFx.actionCount += Neverfall_God_of_Pride;
            }

            for (int i = 0; i < currentFx.selectedCards.Count; i++)
            {
                int cardIndex = currentFx.selectedCards[i];
                var card = playCards[cardIndex];
                card.actions += currentFx.actionCount;
                Debug.Log ("BuffSelectedCards, Action reset");
                if (card.actions > 0) { card.tap = 0; }
            }
        }

        if (libFx.actionType == LibraryFX.ActionType.buffAttack)
        {
            if (monumentfx == true)
            {
                currentFx.actionCount += Neverfall_God_of_Pride;
            }

            Debug.Log(currentFx.actionCount);
            Debug.Log(10 + currentFx.actionCount);

            for (int i = 0; i < currentFx.selectedCards.Count; i++)
            {
                int cardIndex = currentFx.selectedCards[i];
                var card = playCards[cardIndex];

                Debug.Log(card.attack);
                card.attack += currentFx.actionCount;

                if (currentFx.libId == 957)
                {
                    card.attack = 0;
                }

                if (card.attack < 0)
                {
                    card.attack = 0;
                }
            }
        }

        if (libFx.actionType == LibraryFX.ActionType.cultBuff)
        {
            for (int i = 0; i < playCards.Count; i++)
            {
                Debug.Log(currentFx.libId);
                Debug.Log(currentFx.globalIdx);
                Debug.Log("Selfbuff stuff: " + playCards[i].GetLibCard().cult + " " + playCards[currentFx.globalIdx].GetLibCard().cult);
                if (playCards[i].pile == PlayCard.Pile.field && playCards[i].GetLibCard().cult == CardLibrary.Get().GetCard(currentFx.libId).cult)
                {
                    playCards[i].attack += 2;
                }
            }
        }

        if (libFx.actionType == LibraryFX.ActionType.damageCard)
        {
            if (monumentfx == true)
            {
                currentFx.actionCount += Neverfall_God_of_Pride;
            }

            Debug.Log("brutal fix " + currentFx.libId + " " + brutalOD);
            if (currentFx.libId == 100)
            {
                currentFx.actionCount = brutalOD;
                brutalOD = 0;
            }

            for (int i = 0; i < currentFx.selectedCards.Count; i++)
            {
                int cardIndex = currentFx.selectedCards[i];
                var card = playCards[cardIndex];

                card.health -= currentFx.actionCount;

                if (card.health <= 0)
                {
                    DiscardCard(card.owner, cardIndex);

                    if (card.owner != currentFx.playerIdx)
                    {
                        players[currentFx.playerIdx].kills++;
                    }
                }

            }
            //DamagePlayer(currentFx.playerIdx, currentFx.actionCount);
        }

        if (libFx.actionType == LibraryFX.ActionType.selfDestruct)
        {
            var card = playCards[currentFx.globalIdx];

            card.health -= currentFx.actionCount;

            if (card.health <= 0)
            {
                DiscardCard(card.owner, card.globalIdx);
            }
        }

        if (libFx.actionType == LibraryFX.ActionType.damageSelf)
        {

            if (currentFx.libId == 707)
            {
                Debug.Log("monument test: " + CountCultMember() + " " + currentFx.actionCount);
                currentFx.actionCount = (CountCultMember() * -2);

                if (currentFx.actionCount < -8)
                {
                    currentFx.actionCount = -8;
                }

                Debug.Log("monument test actioncount: " + currentFx.actionCount);
            }
            else if (monumentfx == true)
            {
                currentFx.actionCount += Neverfall_God_of_Pride;
                DamagePlayer(currentFx.playerIdx, -Neverfall_God_of_Pride);
            }

            DamagePlayer(currentFx.playerIdx, currentFx.actionCount);
        }

        if (libFx.actionType == LibraryFX.ActionType.damageOpp)
        {
            DamagePlayer((currentFx.playerIdx + 1) % 2, currentFx.actionCount);
        }

        /*
        Debug.Log(currentFx);
        Debug.Log(currentFx.fxIdx);
        Debug.Log(currentFx.libId);
        Debug.Log((CardLibrary.Get()));
        Debug.Log(CardLibrary.Get().GetCard(currentFx.libId));
        Debug.Log(CardLibrary.Get().GetCard(currentFx.libId).fxList.Count);
        Debug.Log(CardLibrary.Get().GetCard(currentFx.libId).fxList.Count);
        /**/
        Debug.Log("nextfx bugged: " + currentFx.fxIdx + " " + CardLibrary.Get().GetCard(currentFx.libId).fxList.Count);
        if (currentFx.NextFx())
        {
            Debug.Log("true");
            Debug.Log("next fx started??");
            StartCardFx(currentFx.playerIdx, currentFx.libId, currentFx.fxIdx);
            return;
        }
        currentFx = new PlayFX();
        effectInProgess = false;
        effectCounter++;
        Debug.Log("End effectCounter " + effectCounter);

        SendGameManager();
    }