using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.BT14 { public class BT14_091 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.OptionSkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Main] Trash any 2 digivolution cards from your opponent's Digimon. Then, if you have a Tamer with [Joe Kido] in its name, choose 1 of your Digimon. If your opponent has no Digimon with more digivolution cards than the chosen Digimon, unsuspend it."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1) { return true; } } return false; } bool CanSelectCardCondition(CardSource cardSource) { return !cardSource.CanNotTrashFromDigivolutionCards(activateClass); } bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)) { if (permanent.IsTamer) { if (permanent.TopCard.ContainsCardName("Joe Kido")) { return true; } } } return false; } bool CanSelectPermanentCondition1(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards( permanentCondition: CanSelectPermanentCondition, cardCondition: CanSelectCardCondition, maxCount: 2, canNoTrash: false, isFromOnly1Permanent: false, activateClass: activateClass )); } if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition)) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1)) { Permanent selectedPermanent = null; int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition1, 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 unsuspend.", "The opponent is selecting 1 Digimon that will unsuspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { bool PermanentCondition1(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.DigivolutionCards.Count >= selectedPermanent.DigivolutionCards.Count) { return true; } } return false; } if (card.Owner.Enemy.GetBattleAreaDigimons().Count(PermanentCondition1) == 0) { yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List() { selectedPermanent }, activateClass).Unsuspend()); } } } } } } if (timing == EffectTiming.SecuritySkill) { string EffectDiscription() { return "[Security] Trash any 2 digivolution cards from your opponent's Digimon. Then, if you have a Tamer with [Joe Kido] in its name, choose 1 of your Digimon. If your opponent has no Digimon with more digivolution cards than the chosen Digimon, unsuspend it. Then, add this card to your hand."; } IEnumerator AfterMainEffect(ICardEffect activateClass) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass)); } CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Trash digivolution cards, unsuspend your 1 Digimon and add this card to hand", effectDiscription: EffectDiscription(), afterMainEffect: AfterMainEffect); } return cardEffects; } } }