using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.BT20 { public class BT20_062 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Retaliation if (timing == EffectTiming.OnDestroyedAnyone) { cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region On Deletion - ESS if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Trash 1 card from hand to delete 1 of your opponent's level 4 or lower Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription()); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDescription() { return "[On Deletion] By trashing 1 card in your hand, delete 1 of your opponent's level 4 or lower Digimon."; } bool CanSelectOpponentPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.IsDigimon && permanent.TopCard.HasLevel && permanent.Level <= 4; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.CanActivateOnDeletion(card, activateClass) && card.Owner.HandCards.Count >= 1; } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool discarded = false; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( canTargetCondition: _ => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: true, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine, maxCount: 1, canEndNotMax: false, isShowOpponent: true, mode: SelectHandEffect.Mode.Discard, selectPlayer: card.Owner, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 card to discard.", "The opponent is selecting 1 card to discard."); yield return StartCoroutine(selectHandEffect.Activate()); IEnumerator AfterSelectCardCoroutine(List cardSources) { discarded = cardSources.Count > 0; yield return null; } if (discarded && CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectOpponentPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } #endregion return cardEffects; } } }