using System; using System.Collections; using System.Collections.Generic; using System.Linq; // Yao Qinglan namespace DCGO.CardEffects.EX11 { public class EX11_058 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); bool OwnAquaDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.HasAquaTraits; #region Start of your Main Phase if (timing == EffectTiming.OnStartMainPhase) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("By placing a card from hand under your Digimon, gain 1 memory", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() => "[Start of Your Main Phase] By placing 1 level 5 or lower card with [Aqua] or [Sea Animal] in any of its traits from your hand as the bottom digivolution card of any of your Digimon with [Aqua] or [Sea Animal] in any of their traits, gain 1 memory."; bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOwnerTurn(card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && card.Owner.HandCards.Count(CanSelectCardCondition) > 0 && CardEffectCommons.HasMatchConditionOwnersPermanent(card, OwnAquaDigimon); } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.HasLevel && cardSource.Level <= 5 && cardSource.HasAquaTraits; } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool added = false; CardSource selectedCard = null; int maxCount = 1; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 card to place at the bottom of digivolution cards.", "The opponent is selecting 1 card to place at the bottom of digivolution cards."); yield return StartCoroutine(selectHandEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } if (selectedCard != null) { maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(OwnAquaDigimon)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: OwnAquaDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { Permanent selectedPermanent = permanent; if (selectedPermanent != null) { yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List() { selectedCard }, activateClass)); added = true; } } } if (added) { yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass)); } } } #endregion #region All Turns if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Draw 1. If played by Decode, 1 enemy can't suspend.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() => "[All Turns] When your Digimon are played or digivolve, if any of them have [Aqua] or [Sea Animal] in any of their traits, by suspending this Tamer, . If played by , 1 of your opponent's Digimon can't suspend until their turn ends."; bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, OwnAquaDigimon) || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, OwnAquaDigimon)); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanActivateSuspendCostEffect(card); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List { card.PermanentOfThisCard() }, hashtable).Tap()); yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw()); if (CardEffectCommons.IsByEffect(hashtable, effect => effect.EffectName.StartsWith("Decode"))) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to suspend.", "The opponent is selecting 1 Digimon that will get unable to suspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } IEnumerator SelectPermanentCoroutine(Permanent permanent) { Permanent selectedPermanent = permanent; if (selectedPermanent != null) { CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass(); canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card); canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition); selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass); if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass)) { yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateDebuffEffect(selectedPermanent)); } bool CanUseCondition1(Hashtable hashtable) { if (selectedPermanent.TopCard != null) { if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass)) { return true; } } return false; } bool PermanentCondition(Permanent permanent) { if (permanent == selectedPermanent) { return true; } return false; } } } } } } #endregion #region Security if (timing == EffectTiming.SecuritySkill) { cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card)); } #endregion return cardEffects; } } }