Beispiel #1
0
 public ResolveEvent(StackWrapper xd)
     : base(GameEventType.RESOLVE)
 {
     xdd = xd;
 }
Beispiel #2
0
 public CastEvent(StackWrapper x)
     : base(GameEventType.CAST)
 {
     xd = x;
 }
Beispiel #3
0
        private void timingListLambda(LinkedList<TriggeredAbility> l)
        {
            foreach (TriggeredAbility ability in l)
            {
                if (ability.card.location.pile != ability.pile) { continue; }
                StackWrapper w;
                    if (ability.card.owner.isHero)
                    {
                        CardPanelControl p = gameInterface.showCards(ability.card);
                        Target[] targets = ability.aquireTargets(gameInterface, game);
                        w = new StackWrapper(Card.createDummy(ability), ability, targets);
                        gameInterface.sendCastAction(new CastAction(w, new int[][] {}));
                        p.closeWindow();
                    }
                    else
                    {
                        var v = gameInterface.demandCastAction();
                        w = v.getStackWrapper();
                        Card c = Card.createDummy(w.ability);
                        w.card = c;
                    }

                waitingTriggeredAbilities.Add(w);

            }
        }
Beispiel #4
0
 public CastEvent(Card c, Ability ability, params Target[] cs)
     : base(GameEventType.CAST)
 {
     xd = new StackWrapper(c, ability , cs);
 }
Beispiel #5
0
        private CastAction gainPriority()
        {
            while (true)
            {
                while (true)
                {
                    GameElement chosenGameElement = gameInterface.getNextGameElementPress();
                    if (chosenGameElement.choice != null)
                    {
                        Choice choice = chosenGameElement.choice.Value;
                        if (choice == Choice.Pass)
                        {
                            return new CastAction();
                        }
                        else
                        {
                            throw new Exception(); //paranoid
                        }
                    }
                    else if (chosenGameElement.card != null)
                    {
                        Card c = chosenGameElement.card;
                        var abilities = c.getAvailableActivatedAbilities(game.heroCanSorc);
                        ActivatedAbility a;
                        if (abilities.Count == 0)
                        {
                            continue;
                        }
                        else if (abilities.Count == 1)
                        {
                            a = abilities[0];
                        }
                        else
                        {
                            throw new Exception("we don't support these things yet");
                        }

                        int[][] v = a.getCost().check(c, gameInterface);
                        if (v == null) { continue; }

                        Target[] targets = a.aquireTargets(gameInterface, game);
                        if (targets == null) { continue; }

                        Card onStack;
                        if (a != c.castAbility)
                        {
                            onStack = Card.createDummy(a);
                        }
                        else
                        {
                            onStack = c;
                        }

                        var sw = new StackWrapper(onStack, a, targets);
                        return new CastAction(sw, v);
                    }
                }
            }
        }