using System; using System.Collections; using System.Collections.Generic; using System.Linq; // Rosemon namespace DCGO.CardEffects.ST24 { public class ST24_11 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alt Digivolution Condition if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Lilamon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsTraits("DATA SQUAD"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 5, permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Shared WD/WA string SharedEffectName = "May suspend up to 2 enemy Digimon or Tamers, then may trash bottom face-down card from your Tamer so enemy Digimon cannot unsuspend until their turn ends"; string SharedEffectHash = "ST24_11_SharedEffect"; CardEffectFactory.ActivateClassesForSharedEffects (ref cardEffects, timing, card, SharedEffectName, SharedActivateCoroutine, SharedEffectDescription, optional: false, maxCountPerTurn: 1, hashValue: SharedEffectHash, whenDigivolving: true, whenAttacking: true); string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] You may suspend up to 2 of your opponent's Digimon or Tamers. Then, by trashing the bottom face-down card from under any of your Tamers, none of their Digimon can unsuspend until their turn ends."; bool TamerWithOneFaceDownSource(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card) && permanent.DigivolutionCards.Any(CanSelectTrashSourceCardCondition); } bool CanSelectTrashSourceCardCondition(CardSource cardSource) { return cardSource.IsFlipped; } bool CanSelectOpponentPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) && (permanent.IsDigimon || permanent.IsTamer); } IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition)) { int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectOpponentPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: true, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Tap, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } bool trashed = false; SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent(); selectPermanentEffect1.SetUp( selectPlayer: card.Owner, canTargetCondition: TamerWithOneFaceDownSource, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: true, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect1.SetUpCustomMessage("Select 1 Tamer to trash 1 bottom face-down card from", "The opponent is selecting 1 Tamer to trash 1 bottom face-down card from"); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate()); IEnumerator AfterSelectPermanentCoroutine(List permanents) { if (permanents.Count == 1) { trashed = true; yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: permanents[0], trashCount: 1, isFromTop: false, activateClass: activateClass, CanSelectTrashSourceCardCondition)); } } if (trashed) { bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && !permanent.TopCard.CanNotBeAffected(activateClass); } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect( permanentCondition: PermanentCondition, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, isOnlyActivePhase: false, effectName: "Your Digimon can't unsuspend")); } } #endregion #region Shared All Turns string SharedEffectName1 = "Trash your opponent's top security card"; string SharedHashString = "ST24_11_AT"; string SharedEffectDescription1() => "[All Turns] [Once Per Turn] When any of your opponent's Digimon or Tamers suspend, or effects trash cards from under your Tamers, trash your opponent's top security card."; bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleArea(card); IEnumerator SharedActivateCoroutine1(Hashtable hashtable, ActivateClass activateClass) { yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity( player: card.Owner.Enemy, destroySecurityCount: 1, cardEffect: activateClass, fromTop: true).DestroySecurity()); } #endregion #region All turns Trigger - On Suspend if (timing == EffectTiming.OnTappedAnyone) { ActivateClass activateClass = new(); activateClass.SetUpICardEffect(SharedEffectName1, CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine1(hash, activateClass), 1, false, SharedEffectDescription1()); activateClass.SetHashString(SharedHashString); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition); } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) && (permanent.IsDigimon || permanent.IsTamer); } } #endregion #region All Turns Trigger - On Trashed if (timing == EffectTiming.OnDigivolutionCardDiscarded) { ActivateClass activateClass = new(); activateClass.SetUpICardEffect(SharedEffectName1, CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine1(hash, activateClass), 1, false, SharedEffectDescription1()); activateClass.SetHashString(SharedHashString); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanTriggerOnTrashDigivolutionCard(hashtable, PermanentCondition, cardEffect => cardEffect != null, cardSource => true); } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card); } } #endregion return cardEffects; } } }