using System.Collections; using System.Collections.Generic; using System.Linq; // Veemon namespace DCGO.CardEffects.BT22 { public class BT22_019 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternative Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.HasCSTraits; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region Your Turn if (timing == EffectTiming.BeforePayCost) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetHashString("DigivoltuionCost-1_BT22_019"); cardEffects.Add(activateClass); string EffectDiscription() { return "[Your Turn] When this Digimon would digivolve into a Digimon card with [Veedramon] in its name, reduce the digivolution cost by 1."; } bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)) { if (permanent == card.PermanentOfThisCard()) { return true; } } return false; } bool CardCondition(CardSource cardSource) { return cardSource.IsDigimon && cardSource.ContainsCardName("Veedramon"); } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentCondition, CardCondition)) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { Hashtable hashtable = new Hashtable(); hashtable.Add("CardEffect", activateClass); ContinuousController.instance.PlaySE(GManager.instance.GetComponent().BuffSE); ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, card); changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true); card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass); yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable)); bool CanUseCondition1(Hashtable hashtable) { return true; } int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List targetPermanents) { if (CardSourceCondition(cardSource)) { if (RootCondition(root)) { if (PermanentsCondition(targetPermanents)) { Cost -= 1; } } } return Cost; } bool PermanentsCondition(List targetPermanents) { if (targetPermanents != null) { if (targetPermanents.Count(PermanentCondition) >= 1) { return true; } } return false; } bool PermanentCondition(Permanent targetPermanent) { if (targetPermanent.TopCard != null) { if (targetPermanent.TopCard.Owner == card.Owner) { if (targetPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(targetPermanent)) { return true; } } } return false; } bool CardSourceCondition(CardSource cardSource) { if (cardSource != null) { if (cardSource.Owner == card.Owner) { return CardCondition(cardSource); } } return false; } bool RootCondition(SelectCardEffect.Root root) { return true; } bool isUpDown() { return true; } } } #endregion #region ESS if (timing == EffectTiming.WhenRemoveField) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend to prevent this Digimon from leaving", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("Substitute_BT22_019"); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When this Digimon with [Veedramon] in its name would leave the battle area by your opponent's effects, by suspending this Digimon, it doesn't leave."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card) && CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOpponentEffect(cardEffect, card)); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanActivateSuspendCostEffect(card) && card.PermanentOfThisCard().TopCard.ContainsCardName("Veedramon"); } IEnumerator ActivateCoroutine(Hashtable hashtable) { Permanent thisCardPermanent = card.PermanentOfThisCard(); IEnumerator StopFieldRemoval() { thisCardPermanent.willBeRemoveField = false; thisCardPermanent.HideDeleteEffect(); thisCardPermanent.HideHandBounceEffect(); thisCardPermanent.HideDeckBounceEffect(); thisCardPermanent.HideWillRemoveFieldEffect(); yield return null; } yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List { thisCardPermanent }, hashtable).Tap()); yield return ContinuousController.instance.StartCoroutine(StopFieldRemoval()); } } #endregion return cardEffects; } } }