using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.BT20 { public class BT20_027 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternate Digivolution if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Wingdramon") || targetPermanent.TopCard.EqualsCardName("Groundramon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Piercing if (timing == EffectTiming.OnDetermineDoSecurityCheck) { cardEffects.Add(CardEffectFactory.PierceSelfEffect( isInheritedEffect: false, card: card, condition: null)); } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Trash digivolution cards and delete 1 Digimon with no digivolution cards", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[On Play] Trash any 3 digivolution cards of 1 of your opponent's Digimon. Then, delete 1 of their Digimon with no digivolution cards."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1; } bool CanSelectCardCondition(CardSource cardSource) { return !cardSource.CanNotTrashFromDigivolutionCards(activateClass); } bool CanSelectNoSourcePermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.HasNoDigivolutionCards; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition) || CardEffectCommons.HasMatchConditionPermanent(CanSelectNoSourcePermanentCondition)); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards( permanentCondition: CanSelectPermanentCondition, cardCondition: CanSelectCardCondition, maxCount: 3, canNoTrash: false, isFromOnly1Permanent: true, activateClass: activateClass )); } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectNoSourcePermanentCondition)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectNoSourcePermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Trash digivolution cards and delete 1 Digimon with no digivolution cards", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[When Digivolving] Trash any 3 digivolution cards of 1 of your opponent's Digimon. Then, delete 1 of their Digimon with no digivolution cards."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1; } bool CanSelectCardCondition(CardSource cardSource) { return !cardSource.CanNotTrashFromDigivolutionCards(activateClass); } bool CanSelectNoSourcePermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.HasNoDigivolutionCards; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition) || CardEffectCommons.HasMatchConditionPermanent(CanSelectNoSourcePermanentCondition)); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards( permanentCondition: CanSelectPermanentCondition, cardCondition: CanSelectCardCondition, maxCount: 3, canNoTrash: false, isFromOnly1Permanent: true, activateClass: activateClass )); } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectNoSourcePermanentCondition)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectNoSourcePermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } #endregion #region All Turns if (timing == EffectTiming.OnLoseSecurity) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Unsuspend 1 of your Digimon with [Dracomon]/[Examon] in its text", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription()); activateClass.SetHashString("Unsuspend_BT20_027"); cardEffects.Add(activateClass); string EffectDescription() { return "[All Turns] (Once Per Turn) When your opponent's security stack is removed from, 1 of your Digimon with [Dracomon]/[Examon] in its text may unsuspend."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner.Enemy); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && (permanent.TopCard.HasText("Dracomon") || permanent.TopCard.HasText("Examon")) && permanent.CanUnsuspend; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition); } IEnumerator ActivateCoroutine(Hashtable hashtable) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.UnTap, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend.", "The opponent is selecting 1 Digimon to unsuspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } #endregion #region All Turns - ESS if (timing == EffectTiming.WhenRemoveField) { List removedPermanents = new List(); ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend this Digimon to prevent Digimon from leaving", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("AllTurns_BT20-027"); cardEffects.Add(activateClass); string EffectDescription() { return "[All Turns] When any of your Digimon with [Dracomon]/[Examon] in their texts would leave the battle area other than in battle by suspending this Digimon, they don't leave."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, CanSelectPermanentCondition) && !CardEffectCommons.IsByBattle(hashtable); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && (permanent.TopCard.HasText("Dracomon") || permanent.TopCard.HasText("Examon")); } bool CanActivateCondition(Hashtable hashtable) { removedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(CanSelectPermanentCondition); return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanActivateSuspendCostEffect(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine( new SuspendPermanentsClass(new List() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap()); foreach (Permanent permanent in removedPermanents) { permanent.willBeRemoveField = false; permanent.HideHandBounceEffect(); permanent.HideDeckBounceEffect(); permanent.HideWillRemoveFieldEffect(); } } } #endregion return cardEffects; } } }