Exemplo n.º 1
0
    //This method actually identifies a target for the Warning Shot skill by running the card picker.
    //Note that this method contains a soft cancel if no card is chosen.
    private void ChooseWSTarget()
    {
        //Find the opponent's <Flier> cards.
        List <BasicCard> enemies = Owner.Opponent.FieldCards;
        List <BasicCard> targets = new List <BasicCard>(enemies.Count);

        foreach (BasicCard enemy in enemies)
        {
            if (enemy.UnitTypeArray[(int)CipherData.TypesEnum.Flier])
            {
                targets.Add(enemy);
            }
        }

        //This sets up the method to call after the CardPicker finishes.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(WarningShot);

        //makes the player choose an opponent's Flier card to move with the skill's effect.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = targets,
            numberOfCardsToPick = 1,
            locationText        = Owner.Opponent.playerName + "'s Field",
            instructionText     = "Please choose one card to move using Gordin's Warning Shot skill.",
            mayChooseLess       = true,
            effectToActivate    = eventToCall
        };

        CardPickerWindow cardPicker = CardPickerWindow.Instance();

        cardPicker.ChooseCards(details);
    }
Exemplo n.º 2
0
    //This is where the rest of the cost is paid for the effect and the target of the effect will be chosen.
    //Princess's Charisma [ACT] [TAP, Tap 1 other ally] Choose 1 other ally. Until the end of the turn, that unit gains +10 attack.
    private void FinishPayCost(List <BasicCard> list)
    {
        //Can be soft canceled.
        if (list.Count > 0)
        {
            //tap this card
            Tap();

            list[0].Tap();

            //choose another ally unit to buff.

            //This sets up the method to call after the CardPicker finishes.
            MyCardListEvent eventToCall = new MyCardListEvent();
            eventToCall.AddListener(PrincessCharisma);

            //makes the player choose another ally.
            CardPickerDetails details = new CardPickerDetails
            {
                cardsToDisplay      = OtherAllies,
                numberOfCardsToPick = 1,
                locationText        = Owner.playerName + "'s Field",
                instructionText     = "Please choose one other ally to gain +10 attack from Caeda's Princess's Charisma.",
                mayChooseLess       = false,
                effectToActivate    = eventToCall
            };

            CardPickerWindow cardPicker = CardPickerWindow.Instance();

            cardPicker.ChooseCards(details);
        }
    }
Exemplo n.º 3
0
    //[ATK] Magic Emblem [SUPP] Draw 1 card. Choose 1 card from your hand, and send it to the Retreat Area.
    public static void MagicEmblem()
    {
        //reports the boost
        CardReader.instance.UpdateGameLog(GameManager.instance.CurrentAttacker.Owner.playerName + "'s supported "
                                          + GameManager.instance.CurrentAttacker.Owner.SupportCard.CharName + " activates Magic Emblem.");

        //Draw.
        GameManager.instance.CurrentAttacker.Owner.Draw(1);

        //This sets up the method to call after the CardPicker finishes setting up the discard choice.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(FinishMagicEmblem);

        //makes the player choose one card to discard from their hand.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = GameManager.instance.CurrentAttacker.Owner.Hand,
            numberOfCardsToPick = 1,
            locationText        = GameManager.instance.CurrentAttacker.Owner.playerName + "'s Hand",
            instructionText     = "Please choose one card to discard for Magic Emblem. (The final card in the list was just drawn.)",
            mayChooseLess       = false,
            effectToActivate    = eventToCall
        };

        CardPickerWindow.Instance().ChooseCards(details);
    }
Exemplo n.º 4
0
    //Choose a friendly target for Elysian Emblem.  Can be soft canceled.
    private void TargetElysianEmblem()
    {
        //find the cards on the field besides the attacking unit.
        List <BasicCard> possibleAllies = Owner.FieldCards;

        possibleAllies.Remove(GameManager.instance.CurrentAttacker);

        //This sets up the method to call after the CardPicker finishes.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(ActivateElysianEmblem);

        //makes the player choose another ally for the skill's effect.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = possibleAllies,
            numberOfCardsToPick = 1,
            locationText        = "Player's Field",
            instructionText     = "Please choose one ally to move using " + CharName + "'s Elysian Emblem.",
            mayChooseLess       = true,
            effectToActivate    = eventToCall
        };

        CardPickerWindow cardPicker = CardPickerWindow.Instance();

        cardPicker.ChooseCards(details);
    }
Exemplo n.º 5
0
    //Young Hero[ACT] [TAP, Tap 1 other ally] Choose 1 enemy, and move them. This skill cannot be used unless this unit is in the Front Line.
    //This is where the rest of the cost is paid for the effect and the target of the effect will be chosen.
    private void FinishPayCost(List <BasicCard> list)
    {
        if (list.Count > 0)
        {
            //tap this card
            Tap();

            list[0].Tap();

            //choose an enemy card to be moved.

            //This sets up the method to call after the CardPicker finishes.
            MyCardListEvent eventToCall = new MyCardListEvent();
            eventToCall.AddListener(YoungHero);

            //makes the player choose an opponent's card for the skill's effect.
            CardPickerDetails details = new CardPickerDetails
            {
                cardsToDisplay      = Owner.Opponent.FieldCards,
                numberOfCardsToPick = 1,
                locationText        = Owner.Opponent.playerName + "'s Field",
                instructionText     = "Please choose one unit to move with Marth's Young Hero.",
                mayChooseLess       = false,
                effectToActivate    = eventToCall
            };

            CardPickerWindow cardPicker = CardPickerWindow.Instance();

            cardPicker.ChooseCards(details);
        }
    }
Exemplo n.º 6
0
    //This method allows the user to choose bonds to flip
    //Note that since this is being called in the middle of a skill effect, I am not going to allow for a soft cancel.
    //ADDITION: Consider adding a reference to the name of the skill being called as well as provide that text.
    public void ChooseBondsToFlip(int numToFlip)
    {
        //This sets up the method to call after the CardPicker finishes.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(FlipBonds);

        //makes the player choose the faceup bond cards to flip for whatever effect.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = FaceUpBonds,
            numberOfCardsToPick = numToFlip,
            locationText        = playerName + "'s Bonds",
            instructionText     = "Please choose " + numToFlip + " bond card",
            mayChooseLess       = false,
            effectToActivate    = eventToCall
        };

        //make the instruction text plural if we need to flip more than one bond.
        if (numToFlip > 1)
        {
            details.instructionText += "s";
        }

        details.instructionText += " to flip to activate this skill.";

        CardPickerWindow cardPicker = CardPickerWindow.Instance();

        cardPicker.ChooseCards(details);
    }
Exemplo n.º 7
0
    public void ChooseCards(CardPickerDetails details)
    {
        //Debug.Log("Displaying " + details.cardsToDisplay.Count + " cards in the Card Picker Window.");

        cardPickerObject.SetActive(true);

        instructionText.text = details.instructionText;
        headerText.text      = details.locationText;

        mayChooseFewer = details.mayChooseLess;

        if (details.numberOfCardsToPick > details.cardsToDisplay.Count && !mayChooseFewer)
        {
            neededCards = details.cardsToDisplay.Count;
            Debug.LogError("WARNING! Only " + neededCards + " may be chosen!");
            errorText.text = "WARNING!  Only " + neededCards + " may be chosen!";
            errorText.gameObject.SetActive(true);
        }
        else
        {
            neededCards = details.numberOfCardsToPick;
        }

        Debug.Log("Please choose " + neededCards);

        //Checks to be sure there is something for the CardPicker to do after you pick cards.
        if (details.effectToActivate == null)
        {
            Debug.LogError("WARNING! No event given to the CardPicker!  What do you want it to do?");
            errorText.text += "WARNING! This action will have no effect!";

            /*
             * if (actionToTake == null)
             * {
             *  actionToTake = new MyCardListEvent();
             * }
             */
        }
        else
        {
            //actionToTake.RemoveAllListeners();
            actionToTake = details.effectToActivate;
        }

        for (int i = 0; i < details.cardsToDisplay.Count; i++)
        {
            GameObject newToggle = toggleObjectPool.GetObject();
            newToggle.transform.SetParent(contentPanel);

            CardToggle toggle = newToggle.GetComponent <CardToggle>();
            toggle.toggleComponent.isOn = false;                        //resets all CardToggles to off.
            toggle.Setup(details.cardsToDisplay[i]);
        }

        confirmButton.onClick.RemoveAllListeners();
        confirmButton.onClick.AddListener(OnConfirm);
    }
Exemplo n.º 8
0
    //recheck the trigger conditions in case the board state changed after the last ability.  Repeat until all cards are resolved.
    public void RecheckTrigger()
    {
        //only proceed if there are some listeners
        if (listenerList.Count > 0)
        {
            //create a list of triggered cards
            List <BasicCard> activeCards = new List <BasicCard>(listenerList.Count);

            //check the Trigger Skill conditions on each card and if met add that card to the list of "triggered"/active cards
            //unless the card has already been resolved.
            foreach (BasicCard listener in listenerList)
            {
                if (listener.CheckTriggerSkillCondition(triggeringCard) && !listener.triggerResolved)
                {
                    activeCards.Add(listener);
                }
            }

            //if only one active card, call its Trigger skill,
            //else if there is more than one triggered card have the player choose which card's ability to activate next,
            if (activeCards.Count == 1)
            {
                CallTriggerSkill(activeCards);
            }
            else if (activeCards.Count > 1)
            {
                //This sets up the method to call after the CardPicker finishes.
                MyCardListEvent eventToCall = new MyCardListEvent();
                eventToCall.AddListener(CallTriggerSkill);

                //makes the player choose one of the triggered/active cards to resolve next.
                CardPickerDetails details = new CardPickerDetails
                {
                    cardsToDisplay      = activeCards,
                    numberOfCardsToPick = 1,
                    locationText        = GameManager.instance.turnPlayer.playerName + "'s Cards",
                    instructionText     = "The below cards have a skill triggered by " + triggeringCard.CharName + "'s deployment.  Please choose one card to resolve first.",
                    mayChooseLess       = false,
                    effectToActivate    = eventToCall
                };

                CardPickerWindow cardPicker = CardPickerWindow.Instance();
                cardPicker.ChooseCards(details);
            }
            else    //no active cards.
            {
                //reset the resolution bool on each of the listeners for the next triggering event.
                foreach (BasicCard listener in listenerList)
                {
                    listener.triggerResolved = false;
                }
            }
        }
    }
Exemplo n.º 9
0
    //This method actually identifies a target for the Prince of Light skill by running the card picker.
    //Note that this method contains a soft cancel if no card is chosen.
    private void ChooseHoLTarget()
    {
        //This sets up the method to call after the CardPicker finishes.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(ActivateHoL);

        //makes the player choose an opponent's back row card for the skill's effect.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = Owner.Opponent.BackLineCards,
            numberOfCardsToPick = 1,
            locationText        = Owner.Opponent.playerName + "'s Back Line",
            instructionText     = "Please choose one card to move using Marth's Prince of Light skill.",
            mayChooseLess       = true,
            effectToActivate    = eventToCall
        };

        CardPickerWindow cardPicker = CardPickerWindow.Instance();

        cardPicker.ChooseCards(details);
    }
Exemplo n.º 10
0
    //This method actually identifies a target for the Wyvern Whip skill by running the card picker.
    //Note that this method contains a soft cancel if no card is chosen.
    private void ChooseWWTarget()
    {
        //This sets up the method to call after the CardPicker finishes.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(ActivateWW);

        //makes the player choose among their own allies for the skill's effect.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = Owner.FieldCards,
            numberOfCardsToPick = Owner.FieldCards.Count,
            locationText        = Owner.playerName + "'s Field",
            instructionText     = "Please choose the allies to move using Caeda's Wyvern Whip skill.",
            mayChooseLess       = true,
            effectToActivate    = eventToCall
        };

        CardPickerWindow cardPicker = CardPickerWindow.Instance();

        cardPicker.ChooseCards(details);
    }
Exemplo n.º 11
0
    //Choose a friendly target for Elysian Emblem.  Can be soft canceled.
    private static void TargetElysianEmblem()
    {
        //This sets up the method to call after the CardPicker finishes.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(ActivateElysianEmblem);

        //makes the player choose another ally for the skill's effect.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = GameManager.instance.CurrentAttacker.OtherAllies,
            numberOfCardsToPick = 1,
            locationText        = GameManager.instance.CurrentAttacker.Owner.playerName + "'s Field",
            instructionText     = "Please choose one ally to move using Elysian Emblem.",
            mayChooseLess       = true,
            effectToActivate    = eventToCall
        };

        CardPickerWindow cardPicker = CardPickerWindow.Instance();

        cardPicker.ChooseCards(details);
    }
Exemplo n.º 12
0
    //Heal [ACT] [TAP, FLIP 2] Choose 1 non-"Lena" card from your Retreat Area, and add it to your hand.
    private void ChooseHealTarget()
    {
        //removes the callback
        Owner.FinishBondFlipEvent.RemoveListener(ChooseHealTarget);

        //determines the possible targets for heal
        List <BasicCard> theRetreat = Owner.Retreat;
        List <BasicCard> targets    = new List <BasicCard>(theRetreat.Count);

        foreach (BasicCard ally in theRetreat)
        {
            //all targets must not share Lena's name.
            if (!CompareNames(ally))
            {
                targets.Add(ally);
            }
        }

        //This sets up the method to call after the CardPicker finishes.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(Heal);

        //makes the player choose a card from their retreat to heal.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = targets,
            numberOfCardsToPick = 1,
            locationText        = Owner.playerName + "'s Retreat",
            instructionText     = "Please choose one card to return to your hard using Lena's Heal skill.",
            mayChooseLess       = false,
            effectToActivate    = eventToCall
        };

        CardPickerWindow cardPicker = CardPickerWindow.Instance();

        cardPicker.ChooseCards(details);
    }
Exemplo n.º 13
0
    //Can be soft canceled.
    protected override void PayActionSkillCost()
    {
        //choose a second card to be tapped.

        //Identify which cards are possible to be tapped
        List <BasicCard> otherAllies   = OtherAllies;
        List <BasicCard> tappableCards = new List <BasicCard>(otherAllies.Count);

        for (int i = 0; i < otherAllies.Count; i++)
        {
            if (!otherAllies[i].Tapped)
            {
                tappableCards.Add(otherAllies[i]);
            }
        }

        //This sets up the method to call after the CardPicker finishes.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(FinishPayCost);

        //makes the player choose a tappable card for the skill's cost.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = tappableCards,
            numberOfCardsToPick = 1,
            locationText        = Owner.playerName + "'s Field",
            instructionText     = "Please choose one unit to tap to activate " + CharName + "'s Princess's Charisma.\n\n" +
                                  "Princess's Charisma [ACT] [TAP, Tap 1 other ally] Choose 1 other ally. Until the end of the turn, that unit gains +10 attack.",
            mayChooseLess    = true,
            effectToActivate = eventToCall
        };

        CardPickerWindow cardPicker = CardPickerWindow.Instance();

        cardPicker.ChooseCards(details);
    }
Exemplo n.º 14
0
    //Can be soft canceled
    protected override void PayActionSkillCost()
    {
        //choose a second card to be tapped.

        //Identify which cards are possible to be tapped
        List <BasicCard> otherAllies   = OtherAllies;
        List <BasicCard> tappableCards = new List <BasicCard>(otherAllies.Count);

        for (int i = 0; i < otherAllies.Count; i++)
        {
            if (!otherAllies[i].Tapped)
            {
                tappableCards.Add(otherAllies[i]);
            }
        }

        //This sets up the method to call after the CardPicker finishes.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(FinishPayCost);

        //makes the player choose a tappable card for the skill's cost.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = tappableCards,
            numberOfCardsToPick = 1,
            locationText        = Owner.playerName + "'s Field",
            instructionText     = "Please choose one other unit to tap to activate " + CharName + "'s Young Hero skill.\n\n" +
                                  "Young Hero [ACT] [TAP, Tap 1 other ally] Choose 1 enemy, and move them. This skill cannot be used unless this unit is in the Front Line.",
            mayChooseLess    = true,
            effectToActivate = eventToCall
        };

        CardPickerWindow cardPicker = CardPickerWindow.Instance();

        cardPicker.ChooseCards(details);
    }
Exemplo n.º 15
0
    //This is where the target of the effect will be chosen.
    //can be soft canceled.
    protected override void PayActionSkillCost()
    {
        //choose an ally to be moved.

        //This sets up the method to call after the CardPicker finishes.
        MyCardListEvent eventToCall = new MyCardListEvent();

        eventToCall.AddListener(ActivateEffect);

        //makes the player choose another ally for the skill's effect.
        CardPickerDetails details = new CardPickerDetails
        {
            cardsToDisplay      = OtherAllies,
            numberOfCardsToPick = 1,
            locationText        = "Player's Field",
            instructionText     = "Please choose one unit to move with " + CharName + "'s Elysian Deliverer.",
            mayChooseLess       = true,
            effectToActivate    = eventToCall
        };

        CardPickerWindow cardPicker = CardPickerWindow.Instance();

        cardPicker.ChooseCards(details);
    }