Esempio n. 1
0
    private void SelectDefender()
    {
        CreatureCardVisual currentTarget = CardClicked() as CreatureCardVisual;

        //CardCreatureData creatureData = currentTarget.cardData as CardCreatureData;

        if (!ConfirmCardClicked(currentTarget, DeckType.Battlefield))
        {
            Debug.Log("Invalid Target");
            return;
        }

        if (currentTarget.owner == owner)
        {
            Debug.Log("That Soul is yours");
            return;
        }

        if (Finder.CardHasKeyword(currentTarget, Keywords.Invisible))
        {
            Debug.Log("That Soul is invisible");
            return;
        }

        if (attacker.keywords.Contains(Keywords.Rush) && currentTarget.primaryCardType == CardType.Player)
        {
            Debug.Log("Rush Souls cannot attack Generals the turn they're played");
            return;
        }

        if (currentTarget.keywords.Contains(Keywords.Flight) && !attacker.keywords.Contains(Keywords.Flight) && !attacker.keywords.Contains(Keywords.Reach))
        {
            Debug.Log("That target is flying");
            return;
        }


        //List<CardVisual> potentialInterceptors = Finder.FindAllCardsInZone(DeckType.Battlefield, Keywords.Interceptor, OwnerConstraints.Theirs);



        if (currentInterceptors.Count > 0)
        {
            if (!currentInterceptors.Contains(currentTarget))
            {
                Debug.Log("You must select an Interceptor");
                return;
            }

            defender = currentTarget;
        }
        else
        {
            defender = currentTarget;
        }


        Debug.Log(defender.cardData.cardName + " is Defending");
        combatState = CombatState.SendingCombatEvents;
    }
Esempio n. 2
0
    private List <CardVisual> SortInterceptors()
    {
        currentInterceptors.Clear();

        List <CardVisual> allInterceptors = Finder.FindAllCardsInZone(DeckType.Battlefield, Keywords.Interceptor, OwnerConstraints.Theirs);

        for (int i = allInterceptors.Count - 1; i >= 0; i--)
        {
            CreatureCardVisual interceptor = allInterceptors[i] as CreatureCardVisual;

            if (Finder.CardHasKeyword(attacker, Keywords.Invisible))
            {
                allInterceptors.Remove(interceptor);
                //Debug.Log("attcker is invisable, removeing all interceptors");
                continue;
            }

            if (Finder.CardHasKeyword(interceptor, Keywords.Invisible))
            {
                allInterceptors.Remove(interceptor);
                //Debug.Log("Defender is invisable, removeing");
                continue;
            }

            if (interceptor.size < attacker.size)
            {
                //Debug.Log(interceptor.cardData.cardName + " is smaller than " + attacker.cardData.cardName + ". Removeing");
                allInterceptors.Remove(interceptor);
                continue;
            }

            if (Finder.CardHasKeyword(attacker, Keywords.Flight) && !Finder.CardHasKeyword(interceptor, Keywords.Flight) && !Finder.CardHasKeyword(interceptor, Keywords.Reach))
            {
                //Debug.Log(interceptor.cardData.cardName + " does not have flight or reach and " + attacker.cardData.cardName + " does. Removeing");
                allInterceptors.Remove(interceptor);
                continue;
            }

            if (Finder.CardHasKeyword(interceptor, Keywords.Flight) && !Finder.CardHasKeyword(attacker, Keywords.Flight))
            {
                allInterceptors.Remove(interceptor);
                continue;
            }
        }

        //for (int i = 0; i < allInterceptors.Count; i++) {
        //    Debug.Log(allInterceptors[i].cardData.name + " is a valid interceptor");
        //}

        return(allInterceptors);
    }
Esempio n. 3
0
    private void DoCombat()
    {
        //RPCBroadcastAttacker(PhotonTargets.All, attacker);
        //RPCBroadcastDefender(PhotonTargets.All, defender);

        //RPCBroadcastCombat(PhotonTargets.All, attacker, defender);

        //CheckForCombatStatChanges();

        if (CheckForCombatEventDeaths())
        {
            EndCombat();
            return;
        }

        if (!Finder.CardHasKeyword(attacker, Keywords.Tireless))
        {
            attacker.RPCToggleExhaust(PhotonTargets.All, true);
        }

        attacker.hasAttacked = true;

        if (attacker.battleToken.battleTokenGlow.activeInHierarchy)
        {
            attacker.battleToken.battleTokenGlow.SetActive(false);
        }


        if (attacker.keywords.Contains(Keywords.FirstStrike) && !defender.keywords.Contains(Keywords.FirstStrike))
        {
            CombatHelper(attacker, defender);

            if (defender.health <= 0)
            {
                EndCombat();
                return;
            }
            else
            {
                CombatHelper(defender, attacker);
                EndCombat();
                return;
            }
        }

        if (!attacker.keywords.Contains(Keywords.FirstStrike) && defender.keywords.Contains(Keywords.FirstStrike))
        {
            CombatHelper(defender, attacker);

            if (attacker.health <= 0)
            {
                EndCombat();
                return;
            }
            else
            {
                CombatHelper(attacker, defender);
                EndCombat();
                return;
            }
        }

        if (attacker.keywords.Contains(Keywords.Ranged))
        {
            CombatHelper(attacker, defender);
            EndCombat();
            return;
        }

        if (defender.keywords.Contains(Keywords.Ranged))
        {
            CombatHelper(attacker, defender);
            EndCombat();
            return;
        }


        CombatHelper(attacker, defender);
        CombatHelper(defender, attacker);

        EndCombat();
    }