public CommanderData(string characterName, GameConstants.CardCommanderType cardCommanderType, int commanderHP, int startingHandSize, string prefabResourcePath, GameConstants.CommanderAbilityChargeType abilityChargeType, int abilityChargeCost, GameConstants.CommanderAbilityTargetType abilityTargetType, List <CardEntry> deck) { this._charName = characterName; this._cardCommanderType = cardCommanderType; this._hp = commanderHP; this._startingHandSize = startingHandSize; this._prefabPath = prefabResourcePath; //Initialize other values this._currentHandSize = this._startingHandSize; this._maxHp = this._hp; this._abilityChargeType = abilityChargeType; this._abilityChargeCost = abilityChargeCost; this._abilityTargetType = abilityTargetType; this._deck = deck; }
public void UpdateSelectionCards() { //Start with creating list to hold all card entries GameConstants.CardCommanderType type = GlobalObject.instance.humanPlayerCommanderData.CardCommanderType; //filter to only have cards matching commander type List <CardEntry> filteredCardEntries = GlobalObject.instance.allCardEntries.FindAll(c => c.CommanderType == type || c.CommanderType == GameConstants.CardCommanderType.All); List <string> randomSelection = new List <string>(); //Grab random cards from list for (int i = 0; i < this.NumCardsForSelection; i++) { int randomIndex = Random.Range(0, filteredCardEntries.Count); randomSelection.Add(filteredCardEntries[randomIndex].Card.ToString()); //Splice out the entry from original list to avoid repeats filteredCardEntries.RemoveAt(randomIndex); //Break loop if we have exhausted all careds if (filteredCardEntries.Count == 0) { break; } } //Set the cards list from our random selection this.SetCardsForSelect(randomSelection); }
public CardEntry(GameConstants.Card card, int cardAmount, GameConstants.CardCommanderType commanderType) { Card = card; CardAmount = cardAmount; CommanderType = commanderType; }