Esempio n. 1
0
 /*
 public bool tryPay(Player p)
 {
     if (checkAll(p))
     {
         payAll(p);
         return true;
     }
     return false;
 }
 */
 public int[][] check(Card card, GameInterface gi)
 {
     gi.setContext("pay shit coach", Choice.Cancel);
     int[][] r = new int[costs.Count][];
     for (int i = 0; i < costs.Count; i++)
     {
         int[] c = costs[i].check(card, gi);
         if (c == null)
         {
             r = null;
             break;
         }
         r[i] = c;
     }
     gi.clearContext();
     return r;
 }
Esempio n. 2
0
        public override int[] check(Card card, GameInterface gi)
        {
            Player owner = card.owner;

            if (CMC > owner.totalMana) { return null; }

            int[] r = new int[CMC];
            int[] cz = costs;
            int c = 0;

            for (int i = 0; i < 5; i++)
            {
                if (cz[i] > owner.getCurrentMana(i))
                {
                    return null;
                }
                while (cz[i]-- > 0)
                {
                    r[c++] = i;
                }
            }

            if (c == CMC) { return r; }

            if (CMC == owner.totalMana)
            {
                for (int i = 0; i < 5; i++)
                {
                    int v = owner.getCurrentMana(i) - Costs[i];
                    while (v-- > 0)
                    {
                        r[c++] = i;
                    }
                }
                return r;
            }
            else
            {
                var paid = costs;

                gi.setFakeManas(Costs);
                gi.setContext("", Choice.Cancel);

                while (c != CMC)
                {
                    gi.changeMessage("Pay " + (CMC - c));

                    GameElement element = gi.getNextGameElementPress();

                    if (element.choice != null && element.choice == Choice.Cancel)
                    {
                        gi.resetFakeMana();
                        gi.clearContext();
                        return null;
                    }

                    else if (element.manaColour != null)
                    {
                        int v = (int)element.manaColour;

                        if (owner.getCurrentMana(v) - paid[v] > 0)
                        {
                            r[c++] = v;
                            gi.decrementFakeMana(v);
                        }
                    }

                }

                gi.resetFakeMana();
                gi.clearContext();
                return r;
            }
        }