public override IEnumerator UsePower(int index = 0) { //{Rockstar} deals 1 target 1 melee damage. //Increase this Damage by 2 if she has a Stage Presence Card in Play. int targets = GetPowerNumeral(0, 1); int dmg = GetPowerNumeral(1, 1); int boost = GetPowerNumeral(2, 2); ITrigger previewBoost = null; bool isStagePresenceInPlay = GetNumberOfStagePresenceInPlay() > 0; if (isStagePresenceInPlay) { previewBoost = AddIncreaseDamageTrigger((DealDamageAction dd) => !IsRealAction() && dd.CardSource != null && dd.CardSource.Card == Card && dd.CardSource.PowerSource != null, dd => boost); } //select the targets var targetDecision = new SelectTargetsDecision(GameController, DecisionMaker, (Card c) => c.IsInPlayAndHasGameText && c.IsTarget && GameController.IsCardVisibleToCardSource(c, GetCardSource()), targets, false, targets, false, new DamageSource(GameController, CharacterCard), dmg, DamageType.Melee, cardSource: GetCardSource()); IEnumerator coroutine = GameController.SelectCardsAndDoAction(targetDecision, _ => DoNothing()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (isStagePresenceInPlay) { RemoveTrigger(previewBoost); } var selectedTargets = targetDecision.SelectCardDecisions.Select(scd => scd.SelectedCard).Where((Card c) => c != null); if (selectedTargets.Count() == 0) { yield break; } ITrigger boostTrigger = null; if (isStagePresenceInPlay) { boostTrigger = new IncreaseDamageTrigger(GameController, (DealDamageAction dd) => dd.DamageSource != null && dd.DamageSource.Card != null && dd.DamageSource.IsCard && dd.DamageSource.Card == CharacterCard && dd.CardSource != null && dd.CardSource.Card == this.Card && dd.CardSource.PowerSource != null, dd => GameController.IncreaseDamage(dd, boost, false, GetCardSource()), null, TriggerPriority.Medium, false, GetCardSource()); AddToTemporaryTriggerList(AddTrigger(boostTrigger)); } //actually deal the damage coroutine = GameController.DealDamage(DecisionMaker, CharacterCard, (Card c) => selectedTargets.Contains(c), dmg, DamageType.Melee, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (targets > 1) { coroutine = GameController.SelectTargetsAndDealDamage(DecisionMaker, new DamageSource(GameController, CharacterCard), dmg, DamageType.Melee, targets - 1, false, targets - 1, additionalCriteria: (Card c) => !selectedTargets.Contains(c), cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } } if (isStagePresenceInPlay) { RemoveTemporaryTrigger(boostTrigger); } yield break; }
public override IEnumerator UsePower(int index = 0) { //"{Impact} deals 1 target 1 infernal damage. You may destroy 1 hero ongoing card to increase this damage by 2." int numTargets = GetPowerNumeral(0, 1); int numDamage = GetPowerNumeral(1, 1); int numToDestroy = GetPowerNumeral(2, 1); int numBoost = GetPowerNumeral(3, 2); if (numTargets < 1) { yield break; } //select the targets var targetDecision = new SelectTargetsDecision(GameController, DecisionMaker, (Card c) => c.IsInPlayAndHasGameText && c.IsTarget && GameController.IsCardVisibleToCardSource(c, GetCardSource()), 1, false, 1, false, new DamageSource(GameController, this.Card), numDamage, DamageType.Infernal, selectTargetsEvenIfCannotPerformAction: false, cardSource: GetCardSource()); IEnumerator coroutine = GameController.SelectCardsAndDoAction(targetDecision, _ => DoNothing()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } var selectedTargets = targetDecision.SelectCardDecisions.Select(scd => scd.SelectedCard).Where((Card c) => c != null); if (selectedTargets.Count() == 0) { yield break; } //potentially destroy ongoings to boost the upcoming damage ITrigger boostTrigger = null; bool didDestroyCards = false; if (GameController.FindCardsWhere((Card c) => c.IsInPlayAndHasGameText && c.IsOngoing && c.IsHero && GameController.IsCardVisibleToCardSource(c, GetCardSource())).Count() >= numToDestroy) { var storedYesNo = new List <YesNoCardDecision> { }; coroutine = GameController.MakeYesNoCardDecision(DecisionMaker, SelectionType.IncreaseDamage, this.Card, storedResults: storedYesNo, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (DidPlayerAnswerYes(storedYesNo)) { coroutine = GameController.SelectAndDestroyCards(DecisionMaker, new LinqCardCriteria(c => c.IsInPlayAndHasGameText && c.IsOngoing && c.IsHero && GameController.IsCardVisibleToCardSource(c, GetCardSource()), "hero ongoing"), numToDestroy, false, numToDestroy, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } boostTrigger = new IncreaseDamageTrigger(GameController, (DealDamageAction dd) => dd.DamageSource.IsCard && dd.DamageSource.Card == this.Card && dd.CardSource != null && dd.CardSource.Card == this.Card, dd => GameController.IncreaseDamage(dd, numBoost, false, GetCardSource()), null, TriggerPriority.Medium, false, GetCardSource()); AddToTemporaryTriggerList(AddTrigger(boostTrigger)); didDestroyCards = true; } } //actually deal the damage coroutine = GameController.DealDamage(DecisionMaker, this.Card, (Card c) => selectedTargets.Contains(c), numDamage, DamageType.Infernal, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (numTargets > 1) { coroutine = GameController.SelectTargetsAndDealDamage(DecisionMaker, new DamageSource(GameController, this.Card), numDamage, DamageType.Infernal, numTargets - 1, false, numTargets - 1, additionalCriteria: (Card c) => !selectedTargets.Contains(c), cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } } if (didDestroyCards) { RemoveTemporaryTrigger(boostTrigger); } yield break; }
public IEnumerator DowsingCrystalDamage(CardEntersPlayAction cep) { //base.SetCardPropertyToTrueIfRealAction("InUse"); //Log.Debug("DowsingCrystalDamage triggers"); var dcTriggers = GameController.StatusEffectManager .GetStatusEffectControllersInList(CardControllerListType.ActivatesEffects) .Where((StatusEffectController sec) => (sec.StatusEffect as ActivateEffectStatusEffect).EffectName == "Dowsing Crystal trigger") .ToList(); //for each of the various Dowsing Crystal uses that have happened... foreach (StatusEffectController seController in dcTriggers) { var currentTriggerEffect = seController.StatusEffect as ActivateEffectStatusEffect; Card triggeringCrystal = currentTriggerEffect.CardSource; CardSource crystalSource = new CardSource(FindCardController(triggeringCrystal)); if (!IsSpecificTriggerAvailable(seController)) { continue; } _inUseTriggers.Add(seController); if (!crystalSource.Card.IsInPlay) { GameController.RemoveInhibitor(crystalSource.CardController); } //"(one hero target) may..." var storedYesNo = new List <YesNoCardDecision> { }; IEnumerator coroutine = GameController.MakeYesNoCardDecision(DecisionMaker, SelectionType.DealDamage, triggeringCrystal, storedResults: storedYesNo, cardSource: crystalSource); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (DidPlayerAnswerYes(storedYesNo)) { //"one hero target (may deal damage...)" var storedDamageSource = new List <SelectTargetDecision> { }; var heroTargets = GameController.FindCardsWhere(new LinqCardCriteria((Card c) => c != null && c.IsTarget && c.IsHero && c.IsInPlayAndHasGameText), visibleToCard: crystalSource); coroutine = GameController.SelectTargetAndStoreResults(DecisionMaker, heroTargets, storedDamageSource, damageAmount: (Card c) => 2, selectionType: SelectionType.HeroToDealDamage, cardSource: crystalSource); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } var selectedDecision = storedDamageSource.FirstOrDefault(); if (selectedDecision != null && selectedDecision.SelectedCard != null) { var damageSource = selectedDecision.SelectedCard; //"...of a type of their choosing." var damageTypeDecision = new List <SelectDamageTypeDecision> { }; coroutine = GameController.SelectDamageType(FindHeroTurnTakerController(damageSource.Owner.ToHero()), damageTypeDecision, cardSource: crystalSource); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } var selectedDamage = DamageType.Melee; if (damageTypeDecision.FirstOrDefault() != null && damageTypeDecision.FirstOrDefault().SelectedDamageType != null) { selectedDamage = (DamageType)damageTypeDecision.FirstOrDefault().SelectedDamageType; } //Log.Debug("Dowsing Crystal's trigger-on-Mara approach works so far."); //attempts to give the damage a destroy-dowsing-crystal-for-boost effect //does not seem to be needed yet, causes warnings in multiple-play-reactions //may be required in some future scenario //var damageSourceTempVar = (Card)AddTemporaryVariable("DowsingCrystalDamageSource", damageSource); var boostDamageTrigger = new IncreaseDamageTrigger(GameController, (DealDamageAction dd) => LogAndReturnTrue(dd) && dd.DamageSource.Card == damageSource && dd.CardSource == crystalSource && triggeringCrystal.IsInPlay, DestroyCrystalToBoostDamageResponse, null, TriggerPriority.Low, false, crystalSource); AddTrigger(boostDamageTrigger); //"deal a non-hero target 2 damage" coroutine = GameController.SelectTargetsAndDealDamage(DecisionMaker, new DamageSource(GameController, damageSource), 2, selectedDamage, 1, false, 1, additionalCriteria: ((Card c) => !c.IsHero), cardSource: crystalSource); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine)); } else { GameController.ExhaustCoroutine(coroutine); } RemoveTrigger(boostDamageTrigger); //RemoveTemporaryVariables(); } //"Once before your next turn..." coroutine = GameController.ExpireStatusEffect(currentTriggerEffect, crystalSource); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine)); } else { GameController.ExhaustCoroutine(coroutine); } _hasBeenUsedTriggers.Add(seController); } _inUseTriggers.Remove(seController); } yield break; }