コード例 #1
0
ファイル: GameEvent.cs プロジェクト: shtonki/cardstone
 public ResolveEvent(StackWrapper xd)
     : base(GameEventType.RESOLVE)
 {
     xdd = xd;
 }
コード例 #2
0
ファイル: GameEvent.cs プロジェクト: shtonki/cardstone
 public CastEvent(StackWrapper x)
     : base(GameEventType.CAST)
 {
     xd = x;
 }
コード例 #3
0
ファイル: GameController.cs プロジェクト: shtonki/cardstone
        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);

            }
        }
コード例 #4
0
ファイル: GameEvent.cs プロジェクト: shtonki/cardstone
 public CastEvent(Card c, Ability ability, params Target[] cs)
     : base(GameEventType.CAST)
 {
     xd = new StackWrapper(c, ability , cs);
 }
コード例 #5
0
ファイル: GameController.cs プロジェクト: shtonki/cardstone
        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);
                    }
                }
            }
        }