using System.Collections; using System.Collections.Generic; // Keramon (X Antibody) namespace DCGO.CardEffects.BT24 { public class BT24_052 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternative Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Keramon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region WM/WD Shared string SharedEffectName() => "Play Diaboromon Token"; string EffectDescriptionShared(string tag) => $"[{tag}] You may play 1 [Diaboromon] Token without paying the cost. (Digimon/Cost 14/Lv.6/White/Mega/Unknown/Unidentified/3000 DP)."; bool CanActivateConditionShared(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayDiaboromonToken(activateClass)); } #endregion #region When Moving if (timing == EffectTiming.OnMove) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateConditionShared, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, true, EffectDescriptionShared("When Moving")); cardEffects.Add(activateClass); bool PermanentCondition(Permanent permanent) { return permanent == card.PermanentOfThisCard(); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition); } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateConditionShared, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, true, EffectDescriptionShared("When Digivolving")); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } } #endregion #region ESS if (timing == EffectTiming.WhenRemoveField) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete 1 of your other [Diaboromon] to prevent this Digimon from leaving", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription()); activateClass.SetHashString("Substitute_BT24_052"); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDescription() { return "[All Turns] [Once Per Turn] When this Digimon with [Diaboromon] in its text would leave the battle area, by deleting 1 of your other [Diaboromon], it doesn't leave."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && card.PermanentOfThisCard().TopCard.HasText("Diaboromon") && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent != card.PermanentOfThisCard() && permanent.TopCard.EqualsCardName("Diaboromon"); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { Permanent thisCardPermanent = card.PermanentOfThisCard(); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { yield return ContinuousController.instance.StartCoroutine( CardEffectCommons.DeletePeremanentAndProcessAccordingToResult( targetPermanents: new List() { permanent }, activateClass: activateClass, successProcess: _ => SuccessProcess(), failureProcess: null)); IEnumerator SuccessProcess() { thisCardPermanent.willBeRemoveField = false; thisCardPermanent.HideDeleteEffect(); thisCardPermanent.HideHandBounceEffect(); thisCardPermanent.HideDeckBounceEffect(); thisCardPermanent.HideWillRemoveFieldEffect(); yield return null; } } } } } #endregion return cardEffects; } } }