using System; using System.Collections; using System.Collections.Generic; using System.Linq; // Sorcermon namespace DCGO.CardEffects.EX7 { public class EX7_019 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Blocker if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Unsuspend your digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] If your opponent has no Digimon with digivolution cards, unsuspend 1 of your Digimon."; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) return CardEffectCommons.CanTriggerOnPlay(hashtable, card); return false; } bool CanSelectDigimonCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (!CardEffectCommons.HasMatchConditionOpponentsPermanent(card,(permanent) => permanent.IsDigimon && !permanent.HasNoDigivolutionCards)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimonCondition)) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigimonCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectDigimonCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.UnTap, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will unsuspend", "The opponent is selecting 1 Digimon to unsuspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } #endregion #region When Attacking if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Trash digivolution cards", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("Unsuspend_EX7_019"); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Attacking] Trash 1 digivolution card at the top of 1 of your opponent's Digimon."; } bool CanSelectDigimonCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { return true; } return false; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectDigimonCondition)) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigimonCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectDigimonCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { Permanent selectedPermanent = permanent; yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 1, isFromTop: true, activateClass: activateClass)); } } } } #endregion return cardEffects; } } }