using System; using System.Collections; using System.Collections.Generic; // Ryugumon namespace DCGO.CardEffects.EX11 { public class EX11_018 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Evade if (timing == EffectTiming.WhenPermanentWouldBeDeleted) { cardEffects.Add(CardEffectFactory.EvadeSelfEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region Decode if (timing == EffectTiming.WhenRemoveField) { bool SourceCondition(CardSource source) { return source.HasLevel && source.Level <= 5 && source.HasAquaTraits; } string[] decodeStrings = { "(Lv.5 or lower Aqua or Sea Animal)", "Lv.5 or lower w/[Aqua]/[Sea Animal] in any trait" }; cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null)); } #endregion #region Shared OP / WD / WA string SharedHashString = "EX11_018_OP_WD_WA"; string SharedEffectName = "Place an [Aqua] or [Sea Animal] in any of it's traits as this Digimon's bottom source to unsuspend 1 of your digimon."; string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] By placing 1 Digimon card with [Aqua] or [Sea Animal] in any of its traits from your hand as this Digimon's bottom digivolution card, 1 of your Digimon unsuspends."; bool SharedCanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.HasMatchConditionOwnersHand(card, IsAquaDigimonCardCondition); } bool IsAquaDigimonCardCondition(CardSource cardSource) => cardSource.IsDigimon && cardSource.HasAquaTraits; bool IsYourDigimonCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { List selectedCards = new List(); SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: IsAquaDigimonCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 card to place as the bottom digivolution card.", "The opponent is selecting 1 card to place as the bottom digivolution card."); yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } if (selectedCards.Count > 0) { yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: IsYourDigimonCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.UnTap, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition,(hash) => SharedActivateCoroutine(hash, activateClass), 1, true, SharedEffectDescription("On Play")); activateClass.SetHashString(SharedHashString); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card) && CardEffectCommons.IsExistOnBattleArea(card); } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition,(hash) => SharedActivateCoroutine(hash, activateClass), 1, true, SharedEffectDescription("When Digivolving")); activateClass.SetHashString(SharedHashString); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) && CardEffectCommons.IsExistOnBattleArea(card); } } #endregion #region When Attacking if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition,(hash) => SharedActivateCoroutine(hash, activateClass), 1, true, SharedEffectDescription("When Attacking")); activateClass.SetHashString(SharedHashString); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card) && CardEffectCommons.IsExistOnBattleArea(card); } } #endregion #region All Turns if (timing == EffectTiming.OnAddDigivolutionCards) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Bottom deck 1 opponent's digimon with as many or fewer sources", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription()); activateClass.SetHashString("EX11_018_OnAddDigivolutionCards"); cardEffects.Add(activateClass); string EffectDescription() => "[All Turns] [Once Per Turn] When effects add to this Digimon's digivolution cards, return 1 of your opponent's Digimon with as many of fewer digivolution cards as this Digimon to the bottom of the deck."; bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnAddDigivolutionCard( hashtable, permanent => permanent == card.PermanentOfThisCard(), cardEffectCondition: cardEffect => cardEffect.EffectSourceCard != null, null); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count; } IEnumerator ActivateCoroutine(Hashtable hashtable) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.PutLibraryBottom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to bottom deck.", "The opponent is selecting 1 digimon to bottom deck."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } #endregion return cardEffects; } } }