public Ability(PlayerController cardOwner, CardOnBoardController card, int abilityAmount, int abilityCharges) { this.cardOwner = cardOwner; this.card = card; this.abilityAmount = abilityAmount; this.abilityCharges = abilityCharges; }
public override void ExecuteCommand() { GameObject target = IDHolder.GetGameObjectWithID(TargetID); CardOnBoardController targetCard = CardOnBoardController.CardsPlayedThisGame[TargetID]; int currentTargetedCardHealth = targetCard.CardHealth; if (currentTargetedCardHealth > DamageDealt) { targetCard.CardHealth -= DamageDealt; targetCard.cardOwner.PlayerHealth -= DamageDealt; } else { int healthToSubtract = targetCard.CardHealth; targetCard.CardHealth -= healthToSubtract; targetCard.cardOwner.PlayerHealth -= healthToSubtract; } if (targetCard.CardHealth <= 0) { new DestroyObjectCommand(target).AddToQueue(); } if (GameManager.IsHeadlessMode == false) { if (GameManager.IsHeadlessMode == false) { target.GetComponent <CardOnBoardView>().healthText.text = targetCard.CardHealth.ToString(); targetCard.cardOwner.playerView.playerHealth.playerHealth.text = targetCard.cardOwner.PlayerHealth.ToString(); } } CommandExecutionComplete(); }
public GiveActivatedAbilityCommand(PlayerController cardOwner, CardOnBoardController cardReceivingAbility, int abilityCharges, int abilityAmount, bool isDamaging) { CardOwner = cardOwner; CardReceivingAbility = cardReceivingAbility; AbilityCharges = abilityCharges; AbilityAmount = abilityAmount; IsDamaging = isDamaging; }
public override void ExecuteCommand() { GameObject target = IDHolder.GetGameObjectWithID(TargetID); CardOnBoardController targetCard = CardOnBoardController.CardsPlayedThisGame[TargetID]; targetCard.CardHealth += HealingDealt; targetCard.cardOwner.PlayerHealth += HealingDealt; if (GameManager.IsHeadlessMode == false) { target.GetComponent <CardOnBoardView>().healthText.text = targetCard.CardHealth.ToString(); targetCard.cardOwner.playerView.playerHealth.playerHealth.text = targetCard.cardOwner.PlayerHealth.ToString(); } CommandExecutionComplete(); }
public override void WhenCardPlayed() { var generator = new System.Random(); List <CardOnBoardController> cardsOnFrontRow = GameManager.Instance.WhoseTurn.otherPlayer.frontRow.CardsOnFrontRow; List <CardOnBoardController> cardsOnBackRow = GameManager.Instance.WhoseTurn.otherPlayer.backRow.CardsOnBackRow; List <CardOnBoardController> allCards = cardsOnFrontRow.Concat(cardsOnBackRow).ToList(); //Get random creature from enemy board if there is one if (allCards.Count > 0) { int targetIndex = generator.Next(allCards.Count); CardOnBoardController target = allCards[targetIndex]; new DealDamageCommand(cardOwner, target.ID, abilityAmount).AddToQueue(); } }
public override void ExecuteCommand() { CardOnBoardController newCardOnBoard = new CardOnBoardController(Player, Card.cardAsset); Player.PlayerHealth += newCardOnBoard.cardAsset.cardHealth; if (ChosenRow == 0) { Player.frontRow.CardsOnFrontRow.Insert(RowPosition, newCardOnBoard); } else { Player.backRow.CardsOnBackRow.Insert(RowPosition, newCardOnBoard); } if (newCardOnBoard.abilityToBeExecuted != null) { newCardOnBoard.abilityToBeExecuted.WhenCardPlayed(); } Player.hand.CardsInHand.Remove(Card); if (GameManager.IsHeadlessMode == false) { HandView PlayerHand = Player.playerView.handView; GameObject card = IDHolder.GetGameObjectWithID(Card.ID); PlayerHand.RemoveCard(card); HoverPreview.PreviewsAllowed = true; if (ChosenRow == 0) { Player.playerView.frontRowView.AddCardAtIndex(Card.cardAsset, newCardOnBoard.ID, RowPosition); } else { Player.playerView.backRowView.AddCardAtIndex(Card.cardAsset, newCardOnBoard.ID, RowPosition); } newCardOnBoard.cardOwner.playerView.playerHealth.playerHealth.text = newCardOnBoard.cardOwner.PlayerHealth.ToString(); new DestroyObjectCommand(card).AddToQueue(); } CommandExecutionComplete(); }
public DealDamageToTarget(PlayerController cardOwner, CardOnBoardController card, int abilityAmount, int abilityCharges) : base(cardOwner, card, abilityAmount, abilityCharges) { }
/// <summary> /// places card on back row /// </summary> /// <param name="index"></param> /// <param name="cardOnBackRow"></param> public void PlaceCardat(int index, CardOnBoardController cardOnBackRow) { CardsOnBackRow.Insert(index, cardOnBackRow); }
public BoostOnGameEnd(PlayerController cardOwner, CardOnBoardController card, int abilityAmount, int abilityCharges) : base(cardOwner, card, abilityAmount, abilityCharges) { }
/// <summary> /// places card on back row /// </summary> /// <param name="index"></param> /// <param name="cardOnFrontRow"></param> public void PlaceCardAt(int index, CardOnBoardController cardOnFrontRow) { CardsOnFrontRow.Insert(index, cardOnFrontRow); }
public HealAllAlliesOnDeath(PlayerController cardOwner, CardOnBoardController card, int abilityAmount, int abilityCharges) : base(cardOwner, card, abilityAmount, abilityCharges) { }