public void Add(AbilityDeck ad) { while (ad.Count != 0) { Add(ad.Draw()); } }
public virtual void ClearDecks() { if (!AbilityDiscard.IsEmpty) { AbilityDiscard.Empty(); RaiseDiscard(AbilityDiscard); } if (!AbilityDeck.IsEmpty) { AbilityDeck.Empty(); RaiseMain(AbilityDeck); } if (!Hand.IsEmpty) { Hand.Empty(); RaiseHand(Hand); } if (!BoostDeck.IsEmpty) { BoostDeck.Empty(); RaiseBoost(BoostDeck); } }
// Connects player variables, draws first hand, shows hand panel public void ActivatePanel() { // Show hand panel to set up card panel positions handPanel.SetPosition(ShowKey, false); hidden = false; MatchScreen(); // Lock panels beyond handsize, and properly display deck and graveyard panels for (int i = handSize; i < cardPanels.Count; i++) { cardPanels[i].IsLocked = true; } DiscardPanel.Display(0); DeckPanel.Display(0); // Hide hand until activation handPanel.SetPosition(HideKey, false); SetDrawCooldown(); // Set up (connect) deck, and hand variables with player if (owner.playerUnit.hand == null) { owner.playerUnit.hand = new List <Card>(MaxHandSize); } hand = owner.playerUnit.hand; discards = owner.playerUnit.discards; deck = owner.playerUnit.deck; handSize = owner.playerUnit.handSize; curHandSize = handSize; // Draw hand for (int i = hand.Count - 1; i < MaxHandSize; ++i) { if (i >= curHandSize) { if (!cardPanels[i].IsLocked) { cardPanels[i].IsLocked = true; } cardPanels[i].card = EmptyCard(); } else { deck.Shuffle(); hand.Add(deck.Draw()); } RefreshEntry(i); } DeckPanel.Display(deck.Count); SetSelection(0); SetDrawCooldown(); handPanel.SetPosition(ShowKey, true); hidden = false; }
public virtual void SetupAbilityDeck(List <AbilityCardData> abilityDeckConfig) { foreach (AbilityCardData abilityData in abilityDeckConfig) { AbilityCard newAbilityCard = new AbilityCard(abilityData); AbilityDeck.Add(newAbilityCard); } AbilityDeck.Shuffle(); RaiseMain(AbilityDeck); }
public void Initialize(Entity owner) { this.owner = owner; drawTimer = new Timer(drawTime, true, DrawCardFromLibrary); FindDecks(); InitDecks(); Hand = GetDeck(AbilityDeck.DeckType.Hand); RegisterEventListeners(); }
private void Awake() { if (deckType == DeckType.AllCards) { ALL_CARDS = this; } if (deckType == DeckType.NotInGame) { NOT_IN_GAME = this; } }
public void TransferCard(AbilityCard card, DeckType destination) { AbilityDeck targetDeck = deckManager.GetDeck(destination); if (targetDeck.IsDeckFull()) { Debug.Log("Target Deck is Full"); return; } TransferCard(card, targetDeck); }
// Shuffle Discards back into deck IEnumerator ReshuffleDiscards() { reshuffling = true; yield return(StartCoroutine(MoveDeckPanel(DiscardPanel, DeckKey))); deck.Add(discards); deck.Shuffle(); DeckPanel.Display(deck.Count); discards = new AbilityDeck(new List <Card>()); DiscardPanel.Display(discards.Count); yield return(StartCoroutine(MoveDeckPanel(DiscardPanel, DiscardKey))); reshuffling = false; }
void Start() { owner = GetComponentInParent <Unit>(); if (owner.hand == null) { owner.hand = new List <Card>(); } deck = owner.deck; hand = owner.hand; while (hand.Count < 4) { hand.Add(deck.Draw()); } }
public void TransferCard(AbilityCard card, AbilityDeck destination) { if (destination.IsDeckFull()) { Debug.Log("Target Deck is Full"); return; } //Debug.Log("transfering a card from " + card.currentDeck.deckType + " to " + destination.deckType); card.previousDeck = this; card.currentDeck = destination; RemoveCard(card); destination.Addcard(card); }
private void TransferCardSet(List <AbilityCard> cards, AbilityDeck destination) { int count = cards.Count; for (int i = 0; i < count; i++) { if (cards[i].currentDeck == null) { destination.Addcard(cards[i]); //Debug.Log(cards[i] + " had no current deck. Assigning: " + destination.deckType); } else { //Debug.Log(cards[i] + " is being transfered to " + destination.deckType); cards[i].currentDeck.TransferCard(cards[i], destination); } } }
public void DrawCardFromLibrary() { AbilityDeck library = GetDeck(AbilityDeck.DeckType.Library); AbilityCard targetCard = library.Draw(); if (targetCard == null) { //Debug.Log("Library is empty"); return; } //Debug.Log(targetCard.cardName + " is being drawn "); //Debug.Log(library + " is my lbrary"); library.TransferCard(targetCard, AbilityDeck.DeckType.Hand); //MainHUD.SetPlayerSlot(targetCard); }
public virtual void ReshuffleDiscard() { // add event for reshuffling discard feedback? if (AbilityDiscard.Count > 0) { int _discardCount = AbilityDiscard.Count; for (int i = 0; i < _discardCount; i++) { // TODO might do something more here with the Add(List<T> function) AbilityDeck.Add(AbilityDiscard.Draw()); } RaiseMain(AbilityDeck); RaiseDiscard(AbilityDiscard); } // shuffle ability deck only if it contains more than 1 item if (AbilityDeck.Count > 1) { AbilityDeck.Shuffle(); } }
public virtual void Draw() { if (Hand.Count < CurrentHandSize) { AbilityCard newCard = AbilityDeck.Draw(DeckPosition.Top); if (newCard != null) { Hand.Add(newCard, DeckPosition.Top); RaiseHand(Hand); RaiseMain(AbilityDeck); } if (AbilityDeck.Count == 0) { ReshuffleDiscard(); } } else { // draw fail feedback } }
public DeckEntry(AbilityDeck deck, AbilityDeck.DeckType deckType) { this.deck = deck; this.deckType = deckType; }