示例#1
0
 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
        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
 public Card demandCard(GameState g)
 {
     int i = demandSelection();
     return g.getCardById(i);
 }
示例#4
0
        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
 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
 public void resolveResolveTargets(GameInterface gi, GameState gstate, Card resolving, Target[] last)
 {
     targetRule.resolveResolveTargets(gi, gstate, resolving, last);
 }
示例#7
0
        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
 public Target[] resolveCastTargets(GameInterface ginterface, GameState gstate, bool cancellable)
 {
     return targetRule.resolveCastTargets(ginterface, gstate, cancellable);
 }