using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.EX4 { public class EX4_018 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Opponent's 1 Digimon gets effects", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] 1 of your opponent's Digimon with the lowest level gains \"[When Attacking] Lose 2 memory\" until the end of your opponent's turn."; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsMinLevel(permanent, card.Owner.Enemy); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { int maxCount = 1; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, 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 get effects.", "The opponent is selecting 1 Digimon that will get effects."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { Permanent selectedPermanent = permanent; CardSource topCard = selectedPermanent.TopCard; if (selectedPermanent != null) { ActivateClass activateClass1 = new ActivateClass(); activateClass1.SetUpICardEffect("Memory -2", CanUseCondition1, selectedPermanent.TopCard); activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1()); activateClass1.SetEffectSourcePermanent(selectedPermanent); selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect); if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass)) { yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateDebuffEffect(selectedPermanent)); } string EffectDiscription1() { return "[When Attacking] Lose 2 memory."; } bool CanUseCondition1(Hashtable hashtable1) { if (selectedPermanent.TopCard != null) { if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent)) { if (GManager.instance.attackProcess.AttackingPermanent == selectedPermanent) { if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass)) { return true; } } } } return false; } bool CanActivateCondition1(Hashtable hashtable1) { if (selectedPermanent.TopCard != null) { if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent)) { if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass)) { return true; } } } return false; } IEnumerator ActivateCoroutine1(Hashtable _hashtable1) { if (topCard != null) { yield return ContinuousController.instance.StartCoroutine(topCard.Owner.AddMemory(-2, activateClass1)); } } ICardEffect GetCardEffect(EffectTiming _timing) { if (_timing == EffectTiming.OnAllyAttack) { return activateClass1; } return null; } } } } } if (timing == EffectTiming.OnDestroyedAnyone) { cardEffects.Add(CardEffectFactory.SaveEffect(card: card)); } if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: true, card: card, condition: null)); } return cardEffects; } } }