Ejemplo n.º 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>();
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 3
0
 public Card demandCard(GameState g)
 {
     int i = demandSelection();
     return g.getCardById(i);
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 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();
 }
Ejemplo n.º 6
0
 public void resolveResolveTargets(GameInterface gi, GameState gstate, Card resolving, Target[] last)
 {
     targetRule.resolveResolveTargets(gi, gstate, resolving, last);
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 8
0
 public Target[] resolveCastTargets(GameInterface ginterface, GameState gstate, bool cancellable)
 {
     return targetRule.resolveCastTargets(ginterface, gstate, cancellable);
 }