private void PlayCard(int index)
        {
            var card = Hand.GetAt(index);

            if (card == null)
            {
                return;
            }

            var lastPlayedCard = LocationPile.Cards.LastOrDefault();

            if (lastPlayedCard != null && card.Suit == lastPlayedCard.Suit)
            {
                return;
            }

            Hand.RemoveAt(index);
            LocationPile.Add(card);

            if (LocationPile.CheckDoorUnlocked())
            {
                var door = Deck.FindDoor(lastPlayedCard.Color);
                if (door != null)
                {
                    DoorPile.Add(door);
                }
                bool win;
                if (CheckGameOver(out win))
                {
                    return;
                }
            }

            DrawUp();
        }
 public OnirimGame()
 {
     DiscardPile  = new DiscardPile();
     LocationPile = new LocationPile();
     LimboPile    = new LimboPile();
     DoorPile     = new DoorPile();
     Hand         = new Hand();
     Deck         = new Deck();
 }
 private void Print()
 {
     Console.Clear();
     DiscardPile.Print();
     LimboPile.Print();
     DoorPile.Print();
     LocationPile.Print();
     Hand.Print();
     Deck.Print();
 }
Example #4
0
 public MoveCardEvent(Card card, LocationPile pile)
     : this(card, new Location(pile, card.owner.side))
 {
 }
Example #5
0
 public MoveTo(TargetRule t, LocationPile pile)
     : base(t)
 {
     this.pile = pile;
 }
Example #6
0
 public MoveToCost(LocationPile from, LocationPile to, int cardsToMove)
 {
     this.to = to;
     this.from = from;
     this.cardsToMove = cardsToMove;
 }
Example #7
0
 public MoveThisCost(LocationPile from, LocationPile to, int cardsToMove, Card sacMe)
     : base(from, to, cardsToMove)
 {
     this.sacMe = sacMe;
 }
Example #8
0
 public Pile getPile(LocationPile p)
 {
     return piles[(int)p];
 }