public override void PrintData() { base.PrintData(); Debug.Log("Name: " + _name.Property + ", Power: " + _power.Property + ",draw count: " + _drawCount.Property + "Card Deck: " + CardDeck.GetCount() + ",Hand: " + _handheldSet.GetCount() + ",Graveyard: " + _graveyard.GetCount()); if (CardDeck.GetCount() > 0) { Debug.Log("Card Deck"); foreach (ElementCardInstance card in _cardDeck.GetAll()) { card.PrintData(); } } if (_graveyard.GetCount() > 0) { Debug.Log("Graveyard"); foreach (ElementCardInstance card in _graveyard.GetAll()) { card.PrintData(); } } if (_handheldSet.GetCount() > 0) { Debug.Log("Hand card"); foreach (ElementCardInstance card in _handheldSet.GetAll()) { card.PrintData(); } } }
public void RunAction(Actor source, Actor target, Card card, BattleContext manager) { if (target is PlayerInstance) { PlayerInstance player = (PlayerInstance)target; ListenableList <ElementCardInstance> handheldList = player.HandheldSet; List <ElementCardInstance> changeList = new List <ElementCardInstance>(); // if drop count greater than 0 if (_count > 0) { for (int cnt = 0; cnt < _count; cnt++) { changeList.Add(handheldList.Get(cnt)); } //if drop count smaller than 0, drop all } else if (_count < 0) { changeList.AddRange(handheldList.GetAll()); } //move card from handheld to graveard foreach (ElementCardInstance item in changeList) { handheldList.RemoveItem(item); } player.Graveyard.AddItems(changeList); } }
public void Bind(ListenableList <EnemyInstance> enemyList) { this._enemyList = enemyList; this._enemyList.AddListener(this); foreach (EnemyInstance enemyInstance in enemyList.GetAll()) { OnItemAdd(enemyInstance); } }
// Binding UI and ViewModel public void Bind(ListenableList <ElementCardInstance> cardList) { this._cardList = cardList; this._cardList.AddListener(this); // Update Cards foreach (ElementCardInstance card in cardList.GetAll()) { OnItemAdd(card); } }
public void RunAction(Actor source, Actor target, Card card, BattleContext manager) { if (target is PlayerInstance) { PlayerInstance player = (PlayerInstance)target; ListenableList <ElementCardInstance> handheldSet = player.HandheldSet; ListenableList <ElementCardInstance> cardDeck = player.CardDeck; List <ElementCardInstance> filteredList = null; // filter if (null != _element) { filteredList = cardDeck.GetAll().FindAll(item => item.Element.Equals(_element)); } else { filteredList = cardDeck.GetAll(); } // random List <ElementCardInstance> drawList = new List <ElementCardInstance>(); if (filteredList.Count > 0) { for (int cnt = 0; cnt < _drawCount; cnt++) { int random = Random.Range(0, filteredList.Count - 1); drawList.Add(filteredList[random]); filteredList.RemoveAt(random); } } // update foreach (ElementCardInstance instance in drawList) { cardDeck.RemoveItem(instance); handheldSet.AddItem(instance); } } }