private void OnDicePlacement(DiceHolder holder, AbilityCard card) { int diceAmount = 0; foreach (DiceHolder dh in _diceHolders) { if (dh.ContainedDice != null) { diceAmount++; } } if (diceAmount == _diceHolders.Length) { UseAbility(Fight); var dices = Fight.GetPlayerDice(); foreach (DiceHolder dh in _diceHolders) { if (_hideDiceOnUse) { dices.Remove(dh.ContainedDice); } dh.DeselectDice(_hideDiceOnUse); } CheckAvailable(); } }
public static void SetPlayerSlot(AbilityCard abilityCard, PlayerAbilitySlot.SlotType slotType = PlayerAbilitySlot.SlotType.Cycling) { if (mainHud != null) { mainHud.quickBar.SetQuickBarSlot(abilityCard, slotType); } }
public bool UseCard(AbilityCard card) { SpawnPlayEffect spawnEffect = card.PlayEffect as SpawnPlayEffect; if (spawnEffect != null) { if (Creature) { return(false); } // this is hard to debug because card.Play()'s use of the play effect depends on CurrentTarget TargetController.CurrentTarget = GetComponent <ITargetable>(); card.Play(); return(true); } else { if (!Creature) { return(false); } TargetController.CurrentTarget = Creature.gameObject.GetComponent <ITargetable>(); card.Play(); return(true); } }
void PlayTopCard() { LeanTween.scale(playCard, new Vector3(2, 2, 2), .5f).setLoopPingPong(1); playSound.Play(); decidingnum = Random.Range(1, 10); AbilityCard targetCard = _playerHand.TopItem; targetCard.Play(); //TODO consider expanding Remove to accept a deck position _playerHand.Remove(_playerHand.LastIndex); _abilityDiscard.Add(targetCard); Debug.Log("Card added to discard: " + targetCard.Name); if (decidingnum <= 7) { StartCoroutine(turnChange()); myPlayer.TakeDamage(enemyDamage); } else { StartCoroutine(turnChange()); _creature.EnemyHeal(healAMount); } }
public void ClearQuickBarSlot(AbilityCard abilityCard, SlotType slotType = SlotType.Cycling) { //if (slotIndex > quickbarSlots.Count) { // Debug.LogError("[PlayerQuickBar] index out of range. " + slotIndex + " is more than 4"); //} GetSlotByCard(abilityCard, slotType).RemoveSlotAbility(); }
public void RemoveSlotAbility() { CurrentCard = null; recovery = null; icon.sprite = parent.emptySlotImage; IsEmpty = true; }
public void DiscardTopCard() { AbilityCard targetCard = _playerHand.TopItem; _playerHand.Remove(_playerHand.LastIndex); _abilityDiscard.Add(targetCard); Debug.Log("Card added to discard: " + targetCard.Name); }
public static AbilityCard CreateCard(List <SpecialAbilityData> abilities, Entity owner, SlotType cardSlotType = SlotType.None, int itemID = -1) { //Debug.Log("Create Card is recieving " + abilities.Count + " abilities in the card factory"); AbilityCard newCard = new AbilityCard(abilities, owner, cardSlotType, itemID); return(newCard); }
void SetupPlayerCards(CardPlayer player) { for (int i = 0; i < player.Hand.Count; i++) { AbilityCard newCard = player.Hand.GetCard(i); _playerView.AddNewCard(newCard); } }
// TODO I don't think it's best that this goes here, but I don't know a better way to organize it yet // TODO these if checks are kinda disgusting IEnumerator AbilityCardSelection(AbilityCard card, int index) { SelectedAbilityCard?.Invoke(card); if (_selectedAudio) { AudioHelper.PlayClip2D(_selectedAudio, 0.5f); } yield return(new WaitForEndOfFrame()); while (true) { if (Input.GetMouseButtonDown(0)) { RaycastHit hit = GetPointerRaycast(); BoardSpace space = hit.collider?.GetComponent <BoardSpace>(); if (space != null) // && hit.collider.gameObject.layer == LayerMask.NameToLayer("PlayerSpace")) { if (!space.UseCard(card)) { EndedSelection?.Invoke(); _abilityRoutine = null; yield break; } Actions -= card.Cost; Hand.Remove(index); AbilityDiscard.Add(card); RaiseActions(Actions); RaiseDiscard(AbilityDiscard); RaiseHand(Hand); EndedSelection?.Invoke(); _abilityRoutine = null; yield break; } else { if (_clickFailAudio) { AudioHelper.PlayClip2D(_clickFailAudio, 0.5f); } } } else if (Input.GetMouseButtonDown(1)) { EndedSelection?.Invoke(); if (_droppedAudio) { AudioHelper.PlayClip2D(_droppedAudio, 0.5f); } _abilityRoutine = null; yield break; } yield return(null); } }
public void Display(AbilityCard abilityCard) { _nameText.text = abilityCard.Name; //_costText.text = abilityCard.Cost.ToString(); _graphicUI.sprite = abilityCard.Graphic; _descriptionText.text = abilityCard.Description; _bgColor = abilityCard.Color; _bgImage.color = _bgColor; }
private void Draw() { AbilityCard newCard = _abilityDeck.Draw(DeckPosition.Top); Debug.Log("Drew card: " + newCard.Name); _playerHand.Add(newCard, DeckPosition.Top); _abilityCardView.Display(newCard); }
private void SetupAbilityDeck() { foreach (AbilityCardData abilityData in _abilityDeckConfig) { AbilityCard newAbilityCard = new AbilityCard(abilityData); _abilityDeck.Add(newAbilityCard); } _abilityDeck.Shuffle(); }
public void AddNewCard(AbilityCard card) { AbilityCardView cardView = Instantiate(_cardViewPrefab, this.transform, false); _cardViews.Add(cardView); cardView.Setup(this, _deckStyleData); cardView.LoadNewCard(card); }
public void Draw() { if (_playerHand.LastIndex < handMax) { AbilityCard newCard = _abilityDeck.Draw(DeckPosition.Top); Debug.Log("Drew card: " + newCard.Name); _playerHand.Add(newCard, DeckPosition.Top); // _abilityCardView.Display(newCard); } }
public void PlayTopCard() { AbilityCard targetCard = _enemyHand.TopItem; targetCard.Play(); //TODO consider expanding Remove to accept a deck position _enemyHand.Remove(_enemyHand.LastIndex); _enemyAbilityDiscard.Add(targetCard); Debug.Log("Card added to discard: " + targetCard.Name); }
public void PlayCard(AbilityCard card, Controller2D.CollisionInfo colInfo, PlayerAbilitySlot.SlotType slotType = PlayerAbilitySlot.SlotType.Cycling) { if (card.Activate(colInfo)) { if (slotType == PlayerAbilitySlot.SlotType.Cycling) { TransferCard(card, DeckType.Library); } } }
public void Display(AbilityCard abilityCard) { //_button.onClick.AddListener(SelectCard); _nameTextUI.text = abilityCard.Name; _costTextUI.text = abilityCard.Cost.ToString(); _graphicUI.sprite = abilityCard.Graphic; //_cardPosition.position = abilityCard.UIPosition; }
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 PlayAbilityCard(List <ITargetable> possibleTargets, int targetIndex) { AbilityCard targetCard = Hand.GetCard(targetIndex); //TODO figure out how to get possible targets //List<ITargetable> possibleTargets = ?? //targetCard.Play(possibleTargets, CurrentTarget); // card should no longer exist in 'hand' Hand.Remove(targetIndex); // allow the next thing to grab it, if desired PlayedCard.Invoke(targetCard); }
public override void PlayAbilityCard(int index) { AbilityCard targetCard = Hand.GetCard(index); if (targetCard != null && Actions > 0 && Actions >= targetCard.Cost) { if (_abilityRoutine == null) { _abilityRoutine = StartCoroutine(AbilityCardSelection(targetCard, index)); } } }
private void SetupAbilityDeck() { Debug.Log("Creating Ability Cards..."); foreach (AbilityCardData abilityData in _abilityDeckConfig) { AbilityCard newAbilityCard = new AbilityCard(abilityData); _abilityDeck.Add(newAbilityCard); } _abilityDeck.Shuffle(); }
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); }
public void ReshuffleDiscarded() { for (int i = 0; i <= _abilityDiscard.LastIndex; i++) { AbilityCard targetCard = _abilityDiscard.TopItem; //TODO consider expanding REmove to accept a deck position _abilityDiscard.Remove(_abilityDiscard.LastIndex); _abilityDeck.Add(targetCard); } _abilityDeck.Shuffle(); Debug.Log("Discard pile shuffled back into ability deck."); }
public void SetSlotAbility(AbilityCard abilityCard) { this.CurrentCard = abilityCard; recovery = abilityCard.abilities[0].Recovery; SetIcon(); //Debug.Log("Adding a card to a slot"); if (abilityCard != null) { IsEmpty = false; } }
private void Draw() { AbilityCard newCard = _abilityDeck.Draw(DeckPosition.Top); //Instantiate(newCard, new Vector3(i * 2.0F, 0, 0), Quaternion.identity); Debug.Log("Drew card: " + newCard.Name); _playerHand.Add(newCard, DeckPosition.Top); //newCard._cardPosition = new Vector3(); //_abilityCardView.Display(newCard); PrintPlayerHand(); }
void PlayTopCard() { AbilityCard targetCard = _playerHand.TopItem; targetCard.Play(); //TODO consider expanding Remove to accept a deck position Destroy(_displayedHand[_playerHand.LastIndex]); _displayedHand.RemoveAt(_playerHand.LastIndex); _playerHand.Remove(_playerHand.LastIndex); _abilityDiscard.Add(targetCard); Debug.Log("Card added to discard: " + targetCard.Name); }
private void CreateAblityCards() { int count = ItemData.itemCards.Count; for (int i = 0; i < count; i++) { AbilityCard card = CardFactory.CreateCard(ItemData.itemCards[i].abiliites, GameManager.GetPlayer(), ItemData.itemCards[i].cardSlotType, ItemID); //Debug.Log(ItemData.itemCards[i].abiliites.Count + " abilities found"); abilityCards.Add(card); } }
public void ApplyAbilityCardToUnit(AbilityCard card, Unit unit) { var ability = (UnitAbility)card.Data; var removedAbility = unit.EquipAbility(ability); if (removedAbility != null) { GameState.PlayerCards.Add(new AbilityCard(removedAbility)); } var gameUnit = Level.GameUnits.Single(x => x.Agent.OwnerContext.Id == unit.Id); AgentService.RefreshAgent(gameUnit.Agent); }
void InitializeCards(RectTransform panel, List <Ability> abilities) { foreach (Ability _ability in abilities) { if (!AllAbilities.Contains(_ability)) { AllAbilities.Add(_ability); } AbilityCard newCard = Instantiate(abilityCard, panel); newCard.InitializeCard(_ability); newCard.cardButton.onClick.AddListener(delegate { AddToSelectedAbilities(_ability); }); newCard.cardButton.onClick.AddListener(delegate { OnLoadoutEdited(); }); } }