コード例 #1
0
ファイル: GameController.cs プロジェクト: shtonki/cardstone
 public GameController(GameConnection cn, GameInterface g)
 {
     gameInterface = g;
     cn.setGame(this);
     game = new GameState();
     gameInterface.setObservers(game.hero, game.villain, game.stack);
     setupEventHandlers();
     stackxd = new Stack<StackWrapper>();
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: shtonki/cardstone
        public Player(GameState g, LocationPlayer l)
        {
            gameState = g;
            side = l;

            hand = new Pile(new Location(LocationPile.HAND, l));
            graveyard = new Pile(new Location(LocationPile.GRAVEYARD, l));
            exile = new Pile(new Location(LocationPile.EXILE, l));
            field = new Pile(new Location(LocationPile.FIELD, l));
            deck = new Pile(new Location(LocationPile.DECK, l));

            piles = new Pile[5];
            piles[(int)LocationPile.DECK] = deck;
            piles[(int)LocationPile.EXILE] = exile;
            piles[(int)LocationPile.FIELD] = field;
            piles[(int)LocationPile.GRAVEYARD] = graveyard;
            piles[(int)LocationPile.HAND] = hand;

            curMana = new int[5];
            maxMana = new int[5];
            bonusMana = new int[5];

            health = 20;
        }
コード例 #3
0
ファイル: GameInterface.cs プロジェクト: shtonki/cardstone
 public Card demandCard(GameState g)
 {
     int i = demandSelection();
     return g.getCardById(i);
 }
コード例 #4
0
ファイル: Effect.cs プロジェクト: shtonki/cardstone
        public List<GameEvent> resolve(Card c, Target[] ts, GameInterface ginterface, GameState gameState)
        {
            List<GameEvent> r = new List<GameEvent>();
            if (!preResolveCheck()) { return r; }
            Target[] pts = null;
            for (int i = 0; i < subEffects.Length; i++)
            {
                subEffects[i].resolveResolveTargets(ginterface, gameState, c, pts);
                pts = subEffects[i].targets;
            }
            foreach (SubEffect e in subEffects)
            {
                foreach (GameEvent ge in e.resolveEffect(ginterface, gameState, c))
                {
                    r.Add(ge);
                }
            }

            return r;
        }
コード例 #5
0
ファイル: Effect.cs プロジェクト: shtonki/cardstone
 public Target[] aquireTargets(GameInterface ginterface, GameState gstate, bool cancellable)
 {
     List<Target> l = new List<Target>();
     foreach (SubEffect e in subEffects)
     {
         Target[] ts = e.resolveCastTargets(ginterface, gstate, cancellable);
         if (ts == null) return null;
         l.AddRange(ts);
     }
     return l.ToArray();
 }
コード例 #6
0
ファイル: Effect.cs プロジェクト: shtonki/cardstone
 public void resolveResolveTargets(GameInterface gi, GameState gstate, Card resolving, Target[] last)
 {
     targetRule.resolveResolveTargets(gi, gstate, resolving, last);
 }
コード例 #7
0
ファイル: Effect.cs プロジェクト: shtonki/cardstone
        public GameEvent[] resolveEffect(GameInterface ginterface, GameState game, Card resolvingCard)
        {
            List<GameEvent> r = new List<GameEvent>();

            if (!targetRule.check(targetRule.getTargets()))
            {
                return r.ToArray();
            }
            foreach (Target t in targetRule.getTargets())
            {
                foreach (GameEvent e in resolve(ginterface, t, resolvingCard))
                {
                    r.Add(e);
                }
            }
            return r.ToArray();
        }
コード例 #8
0
ファイル: Effect.cs プロジェクト: shtonki/cardstone
 public Target[] resolveCastTargets(GameInterface ginterface, GameState gstate, bool cancellable)
 {
     return targetRule.resolveCastTargets(ginterface, gstate, cancellable);
 }