using System; using System.Collections; using System.Collections.Generic; using System.Linq; // Mienumon namespace DCGO.CardEffects.EX10 { public class EX10_017 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Static Effects #region Alternative Digivolution Condition - Stnd. if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasStandardAppTraits; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region App Fusion (Mirrormon & Kabemon & Copipemon) if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.AddAppfuseMethodByName(new List() {"Mirrormon", "Kabemon","Copipemon"},card)); } #endregion #region Link if (timing == EffectTiming.OnDeclaration) { cardEffects.Add(CardEffectFactory.LinkEffect(card)); } #endregion #region Link Condition if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasAppmonTraits; } cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card)); } #endregion #region Jamming if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region Retaliation if (timing == EffectTiming.OnDestroyedAnyone) { cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #endregion #region When Linked if (timing == EffectTiming.WhenLinked) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 Tamer with [Leviathan] trait", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("EX10_017_WhenLinked"); cardEffects.Add(activateClass); string EffectDiscription() { return "[Your Turn] [Once Per Turn] When this Digimon gets linked, if you have 1 or fewer Tamers, you may play 1 Tamer card with the [Leviathan] trait from your hand without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenLinked(hashtable, perm => perm == card.PermanentOfThisCard(), null); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.OwnerHas1OrLessTamers(card) && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition); } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsTamer && cardSource.HasLeviathanTraits && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition)) { CardSource selectedCard = null; #region Select Tamer int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectCardCondition)); SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectHandEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectHandEffect.Activate()); #endregion if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards( cardSources: new List() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true)); } } } #endregion #region Link Effect if (timing == EffectTiming.OnTappedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("By trashing 1 link card, draw 1 & gain 1 memory", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetIsLinkedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] When any of your opponent's Digimon suspend, by trashing 1 of this Digimon's link cards, (Draw 1 card from your deck.) and gain 1 memory."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermamentCondition); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && HasLinkedCards(card.PermanentOfThisCard().TopCard.PermanentOfThisCard()); } bool PermamentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool HasLinkedCards(Permanent permanent) { return !permanent.HasNoLinkCards; } IEnumerator ActivateCoroutine(Hashtable hashtable) { Permanent thisCardPermament = card.PermanentOfThisCard().TopCard.PermanentOfThisCard(); if (HasLinkedCards(thisCardPermament)) { CardSource selectedCard = null; #region Select Link Card int maxCount = Math.Min(1, thisCardPermament.LinkedCards.Count); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: _ => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 linked card to trash.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: thisCardPermament.LinkedCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } selectCardEffect.SetUpCustomMessage("Select 1 linked card to trash.", "The opponent is selecting 1 linked card to trash."); yield return StartCoroutine(selectCardEffect.Activate()); #endregion if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashLinkCardsAndProcessAccordingToResult( targetPermanent: thisCardPermament, targetLinkCards: new List() { selectedCard }, activateClass: activateClass, successProcess: SuccessProcess, failureProcess: null)); IEnumerator SuccessProcess(List trashedLinkCards) { if (trashedLinkCards.Any()) { yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw()); if (card.Owner.CanAddMemory(activateClass)) yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass)); } } } } } #endregion return cardEffects; } } }