예제 #1
0
 /// <summary>
 /// Add one card to the stack.
 /// </summary>
 /// <param name="newCard">The card to add to the stack</param>
 public void add(Card newCard)
 {
     if (mNextAdd >= mCards.Length)
     {
         shift();
     }
     if (mNextAdd < mCards.Length)
     {
         mCards[mNextAdd] = newCard;
         mNextAdd++;
     }
 }
예제 #2
0
        /*
            Populates the list of cards and calls the method to shuffle the deck.
        */
        public DeckOfCards()
        {
            int imgIdx = 0; //The index of the Card's corresponding image in the imageList.

            foreach (SuitType tempSuit in Enum.GetValues(typeof(SuitType)))
            {
                foreach (PipType tempPip in Enum.GetValues(typeof(PipType)))
                {
                    Card newCard = new Card(tempSuit, tempPip, imgIdx);
                    masterList.Add(newCard);
                    imgIdx++;
                }
            }

            ShuffleDeck();
        }
예제 #3
0
 public void AddCard(Card card)
 {
     in_deck[card.index] = true;
 }
예제 #4
0
파일: Player.cs 프로젝트: kyuuuyki/CardGame
 public void addPile(Card cardin)
 {
     pile.Add(cardin);
 }
예제 #5
0
파일: Player.cs 프로젝트: kyuuuyki/CardGame
 public void addCard(Card cardin)
 {
     deck.Add(cardin);
 }
예제 #6
0
파일: Player.cs 프로젝트: dentych/I4SWD
 public void DealCard(Card card)
 {
     cards.Add(card);
 }
예제 #7
0
파일: Player.cs 프로젝트: dentych/I4SWD
 public void DealCard(Card card)
 {
     cards.Add(card);
     if (++cardsHold > 3)
     {
         cards.RemoveAt(0);
         cardsHold--;
     }
 }
예제 #8
0
 void Update()
 {
     if(aSleep.a)this.enabled=false;
     // if(aDrag.a&&!control.isHold){
     if(aDrag.a&&!control.isHold){
     dragged=null;
     snap();
     aDrag.s=1000f;
     lookUp();
     }
     _posLook=Vector3.SmoothDamp(_posLook,posLook,ref vels[0],smoothTime);
     pos=Vector3.SmoothDamp(pos,posTarget,ref vels[1],smoothTime);
     tra.LookAt(_posLook);
 }
        public bool IsStraight()
        {
            bool rankInOrder = false;
            bool moreThanOneSuit = false;

            Card[] cArray = new Card[5];

            // Make Counters to count how many of which suit.
            int countSpade = 0;
            int countDiamond = 0;
            int countClub = 0;
            int countHeart = 0;

            // Iterate over the Cards collection to add up Suits in collection.
            foreach (Card x in Cards)
            {
                if (x.Suit == Suit.Spades)
                {
                    countSpade++;
                }
                if (x.Suit == Suit.Diamonds)
                {
                    countDiamond++;
                }
                if (x.Suit == Suit.Clubs)
                {
                    countClub++;
                }
                if (x.Suit == Suit.Hearts)
                {
                    countHeart++;
                }
            }

            // Check to see if we have more than one suit.
            if (countSpade >= 1 && countHeart >= 1 || countDiamond >= 1 || countClub >= 1)
            {
                moreThanOneSuit = true;
            }

            // Iterate 5 times through Cards and add to a collection array of Cards
            // So I can check the index in order if greater or less than.

            // First Sort the deck so its in order.
            Cards.Sort();

            // Add Cards to the Array.
            cArray = Cards.ToArray();

            // Assign the int value of the Rank to temp variables.
            int temp1 = (int)cArray[0].Rank;
            int temp2 = (int)cArray[1].Rank;
            int temp3 = (int)cArray[2].Rank;
            int temp4 = (int)cArray[3].Rank;
            int temp5 = (int)cArray[4].Rank;

            // Check if first card is in order and decend from that.
            if (temp1 -1 == temp2 && temp2 -1 == temp3 && temp3 -1 == temp4 && temp4 -1 == temp5)
            {
                rankInOrder = true;
            }

            // If both rank are in order and there is more than one suit in the deck then its a Straight.
            if (rankInOrder == true && moreThanOneSuit == true)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
예제 #10
0
 /*
     If the deck isn't full, puts a card at the bottom of the deck. Time complexity is O(1).
 */
 public void ReturnCard(Card usedCard)
 {
     if (deck.Count < CARDS_IN_DECK)
         deck.Enqueue(usedCard);
 }
예제 #11
0
 public void TakeCards(Card sentCard)
 {
     _cards.Add(sentCard);
 }
예제 #12
0
        public void Card_Suit_Is_A_Enum_That_Returns()
        {
            var fiveOfHearts = new Card(Value.Five, Suit.Hearts);

            Assert.AreEqual(fiveOfHearts.GetCardSuit(), Suit.Hearts);
        }
예제 #13
0
 private void WriteInformation(string playerName, Card card)
 {
     _consoleLogger.WriteMessage(string.Format("{0} Card Information: {1} {2}", playerName, card.CardRank, card.CardSuite));
 }
예제 #14
0
        public CardData()
        {
            cards = new List<Card>();
            roCards = new ReadOnlyCollection<Card>(cards);

            cards.Add(new NonRangedAttacker
            {
                Name = "Dan Hagar",
                attack = 3,
                hitpoints = 5,
                Points = 10,
                Category = Category.Settler
            });
            cards.Add(HE_GRENADES = new Bomb
            {
                Name = "HE Grenades",
                attack = 2,
                Points = 5
            });
            cards.Add(LOOSUM_HAGAR = new RangedAttacker
            {
                Name = "Loosum Hagar",
                attack = 4,
                hitpoints = 5,
                Points = 15,
                Category = Category.Settler
            });
            cards.Add(new RangedAttacker
            {
                Name = "Ghost Bonestick",
                attack = 3,
                hitpoints = 4,
                Points = 10,
                Category = Category.Ghost
            });

            cards.Add(GHOST_BOSS = new RangedAttacker
            {
                Name = "Ghost Boss",
                attack = 4,
                hitpoints = 6,
                Points = 15,
                Category = Category.Ghost,
                Special = new DamageModifier(Category.Ghost, 1)
            });

           
            cards.Add(JANUS_OUTRIGGER = new Healer
            {
                Name = "Janus Outrigger",
                attack = 2,
                hitpoints = 5,
                Points = 10,
                Category = Category.Settler
            });



            cards.Add(SENTRY_TURRET = new RangedAttacker
            {
                Name = "Sentry Turret",
                attack = 5,
                hitpoints = 2,
                Points = 10,
                Category = Category.Mechanical
            });

            cards.Add(RIKTER_OUTRIGGER = new NonRangedAttacker
            {
                Name = "Rikter Outrigger",
                attack = 4,
                hitpoints = 4,
                Points = 10,
                Category = Category.Settler
            });

            cards.Add(WASTED_CLUB = new NonRangedAttacker
            {
                Name = "Wasted Club",
                attack = 4,
                hitpoints = 4,
                Points = 10,
                Category = Category.Wasted
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Wasted Pistol",
                attack = 3,
                hitpoints = 5,
                Points = 10,
                Category = Category.Wasted
            });

            cards.Add(WASTED_TURRET = new RangedAttacker
            {
                Name = "Wasted Turret",
                attack = 5,
                hitpoints = 5,
                Points = 15,
                Category = Category.Wasted
            });

            cards.Add( new RangedAttacker
            {
                Name = "Dagger Thrower",
                attack = 2,
                hitpoints = 2,
                Points = 5,
                Category = Category.Wasted
            });

            cards.Add( new NonRangedAttacker
            {
                Name = "Ghost Pistol",
                attack = 4,
                hitpoints = 4,
                Points = 10,
                Category = Category.Ghost
            });

            cards.Add(DUNE_BUSTER =  new Vehicle
            {
                Name = "Dune Buster",
                
                hitpoints = 6,
                Points = 15,
                
            });

            cards.Add(MAYOR_CLAYTON = new NonRangedAttacker
            {
                Name = "Mayor Clayton",
                attack = 2,
                hitpoints = 5,
                Points = 10,
                Category = Category.Settler,
                Special = new HealthModifier(Category.Settler, 1)
            });

            cards.Add(SHERRIF_BLACK = new NonRangedAttacker
            {
                Name = "Sheriff Black",
                attack = 3,
                hitpoints = 7,
                Points = 15,
                Category = Category.Settler,
                Special = new DamageModifier(Category.Settler, 1)
            });

            cards.Add(new RangedAttacker
            {
                Name = "City Guard",
                attack = 2,
                hitpoints = 2,
                Points = 5,
                Category = Category.Settler
            });

            cards.Add(new Vehicle
            {
                Name = "Jetter",                
                hitpoints = 4,
                Points = 10
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Club Mutant",
                hitpoints = 2,
                attack = 3,
                Points = 5,
                Category = Category.Mutant
            });

            cards.Add(SALLY = new NonRangedAttacker
            {
                Name = "Sally",
                hitpoints = 7,
                attack = 2,
                Points = 15,
                Category = Category.Settler,
                AttackHandler = new HealOnAttackHandler(1)
                
            });

            cards.Add(CRAZY_JOE = new NonRangedAttacker
            {
                Name = "Crazy Joe",
                hitpoints = 2,
                attack = 2,
                Points = 5,
                Category = Category.Settler,
                AttackHandler = new StunOnAttackHandler()
            });

            cards.Add( new RangedAttacker
            {
                Name = "Scoop Mutant",
                hitpoints = 4,
                attack = 3,
                Points = 10,
                Category = Category.Mutant
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "JK Stiles",
                hitpoints = 7,
                attack = 2,
                Points = 15,
                Category = Category.Mutant,
                Special = new DamageModifier(Category.Mutant, 2)
            });

            cards.Add(CUPRINO = new Vehicle
            {
                Name = "Cuprino",
                hitpoints = 8,
                Points = 20
            });

            cards.Add(new Bomb
            {
                Name = "RC Bomb Car",
                attack = 3,
                Points = 10
            });

            cards.Add(new RangedAttacker
            {
                Name = "Shrouded AR",
                attack = 3,
                hitpoints = 5,
                Points = 10
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Shrouded Heavy",
                attack = 5,
                hitpoints =10,
                Points = 20
            });

            cards.Add(new RangedAttacker
            {
                Name = "Shrouded Minigun",
                attack = 6,
                hitpoints = 10,
                Points = 25
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Sentry Bot",
                attack = 4,
                hitpoints = 3,
                Points = 10,
                Category = Category.Mechanical
            });

            cards.Add(ENFORCER = new RangedAttacker
            {
                Name = "Enforcer",
                attack = 4,
                hitpoints = 7,
                Points = 15,
                Category = Category.Authority
            });

            cards.Add(LARGE_MUTANT = new RangedAttacker
            {
                Name = "Large Mutant",
                attack = 4,
                hitpoints = 10,
                Points = 25,
                Category = Category.Mutant,
                AttackHandler = new AttackImmediateNeighbors(1)
            });

            cards.Add(new RangedAttacker
            {
                Name = "Kraken",
                attack = 4,
                hitpoints = 9,
                Points = 20,
                Category = Category.Mutant,
                AttackHandler = new StunOnAttackHandler()
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Slime Mutant",
                attack = 4,
                hitpoints = 7,
                Points = 15,
                Category = Category.Mutant,
                AttackHandler = new StunOnAttackHandler()
            });

            cards.Add(DROP_MINE = new BombForCategory
            {
                Name = "Drop Mine",
                attack = 6,
                Points = 10,
                TargetToBombCategory = Category.VehicleCat
            });

            cards.Add(new RangedAttacker
            {
                Name = "Valder",
                attack = 4,
                hitpoints = 7,
                Points = 15,
                Category = Category.Settler
            });

            cards.Add(POWER_SUPPLY = new PowerSupply
            {
                Name = "Power Supply",
                
                hitpoints = 7,
                Points = 20,
                Category = Category.Authority,
                Special = new CombinationSpecial(new DamageModifier(Category.Authority, 1),
                new HealthModifier(Category.Authority, 1))
            });

            cards.Add(new RangedAttacker
            {
                Name = "Giant Mutant",
                hitpoints = 14,
                attack = 3,
                Points = 50,
                Category = Category.Mutant,
                AttackHandler = new AttackAll()
            });

            cards.Add(new BombForCategory
            {
                Name = "Emp Grenade",
                attack = 5,
                Points = 10,
                //Todo make categories powers 2, change get cat func in playerhand
                TargetToBombCategory = Category.Mechanical
            });

            cards.Add(new Vehicle
            {
                Name = "Dropship",
                hitpoints = 12,
                Points = 30
                
            });

            cards.Add(new RangedAttacker
            {
                Name = "Captain Marshall",
                Points = 20,
                hitpoints = 9,
                attack = 4,
                Special = new DamageModifier(Category.Settler, 1)
            });

            
            cards.Add(new NonRangedAttacker
            {
                Name = "Shield Guard",
                Points = 15,
                hitpoints = 7,
                attack = 4,
                Category = Category.Authority,
                DamageModifier = new Shield()
            });

            cards.Add(new Healer
            {
                Name = "Elizabeth",
                Points = 15,
                hitpoints = 8,
                attack = 2,
                Category = Category.Settler
            });

            cards.Add(new Healer
            {
                Name = "Drone",
                Points = 10,
                hitpoints = 5,
                attack = 2,
                Category = Category.Authority
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Authority Mutant",
                Points = 15,
                hitpoints = 7,
                attack = 5,
                Category = Category.Authority
            });

            cards.Add(new Bomb
            {
                Name = "Dyno-Mutant",
                Points = 10,
                
                attack = 3,
                Category = Category.Mutant
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Portman",
                Points = 15,
                hitpoints = 7,
                attack = 5,
                Category = Category.Settler
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Adv Sentry Bot",
                Points = 15,
                hitpoints = 6,
                attack = 5,
                Category = Category.Mechanical
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Gearhead Shotgun",
                Points = 15,
                hitpoints = 8,
                attack = 4,
                Category = Category.GearHead
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Gearhead Jet",
                Points = 20,
                hitpoints = 7,
                attack = 7,
                Category = Category.GearHead
            });

            cards.Add(new Vehicle
            {
                Name = "Monarch",
                Points = 25,
                hitpoints = 10
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Gearhead Boss",
                Points = 25,
                hitpoints = 10,
                attack = 6,
                Special = new HealthModifier(Category.GearHead, 1)
            });

            cards.Add(new RangedAttacker
            {
                Name = "Jackal Crossbow",
                Points = 15,
                hitpoints = 7,
                attack = 4,
                Category = Category.Jackal
            });

            cards.Add(new NonRangedAttacker
            {
                Name = "Jackal Club",
                Points = 15,
                hitpoints = 7,
                attack = 5,
                Category = Category.Jackal
            });

            cards.Add(new RangedAttacker
            {
                Name = "Elite Guard",
                Points = 30,
                hitpoints = 12,
                attack = 7,
                Category = Category.Authority
            });

            for (int i = 0; i < cards.Count; ++i)
            {
                cards[i].index = i;
                
            }
        }
예제 #15
0
 public void RemoveCard(Card card)
 {
     in_deck[card.index] = false;
 }
예제 #16
0
 // void OnPress(bool isDown){
 // if(!isDown)return;
 // lCells.Remove(traTarget);
 // }
 void OnDrag()
 {
     selected=false;
     dragged=this;
     wake();
     aDrag.s=0.04f;
     posLook=Camera.main.transform.position;
     // col.enabled=false;
     if(control.isHover){
     pos=control.hit.point+Vector3.up;
     posTarget=pos;
     }
 }
예제 #17
0
        public void Created_Card_Will_Return_Correct_Suit_And_Value(Value testCardValue, Suit testSuitValue)
        {
            var aCard = new Card(testCardValue,testSuitValue);

            Assert.That(aCard.GetCardValue().Equals(testCardValue) && aCard.GetCardSuit().Equals(testSuitValue));
        }
예제 #18
0
 public void TakeCard(Card sentCard)
 {
     Cards.Add(sentCard);
 }