using System; using System.Collections; using System.Collections.Generic; // SkullGreymon namespace DCGO.CardEffects.EX9 { public class EX9_062 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternate Digivolution Requirement if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.EqualsTraits("DM"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Alternative Assembly Level if (timing == EffectTiming.None) { ChangeCardLevelForAssemblyClass changeCardLevelForAssemblyClass = new ChangeCardLevelForAssemblyClass(); changeCardLevelForAssemblyClass.SetUpICardEffect("This card is also treated as level 4 for [Kimeramon]'s assembly.", CanUseCondition, card); changeCardLevelForAssemblyClass.SetUpChangeCardLevelForAssemblyClass(changeCardLevel: changeCardLevel); cardEffects.Add(changeCardLevelForAssemblyClass); bool CanUseCondition(Hashtable hashtable) { return true; } List changeCardLevel(CardSource cardSource, List Level) { if (cardSource == card) { Level.Add(4); } return Level; } } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect($"Trash cards from deck, then return 1 [DM] digimon from trash to hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] For each of this Digimon's face-down digivolution cards, trash the top card of your deck. Then, you may return 1 [DM] trait Digimon card from your trash to the hand."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsDigimon && cardSource.EqualsTraits("DM"); } IEnumerator ActivateCoroutine(Hashtable hashtable) { int trashCount = card.PermanentOfThisCard().DigivolutionCards.Filter(x => x.IsFlipped).Count; if (trashCount >= 1) { IAddTrashCardsFromLibraryTop addTrashCard = new IAddTrashCardsFromLibraryTop(trashCount, card.Owner, activateClass); addTrashCard.SetNotShowCards(); yield return ContinuousController.instance.StartCoroutine(addTrashCard.AddTrashCardsFromLibraryTop()); ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().ShowCardEffect2(addTrashCard.discardedCards, "Your Discarded Cards", true, true)); } if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: null, afterSelectCardCoroutine: null, message: "Select 1 [DM] digimon to add to hand", maxCount: 1, canEndNotMax: true, isShowOpponent: true, mode: SelectCardEffect.Mode.AddHand, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 [DM] digimon to add to hand", "The opponent is selecting 1 digimon to add to hand."); yield return StartCoroutine(selectCardEffect.Activate()); } } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect($"Trash cards from deck, then return 1 [DM] digimon from trash to hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] For each of this Digimon's face-down digivolution cards, trash the top card of your deck. Then, you may return 1 [DM] trait Digimon card from your trash to the hand."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsDigimon && cardSource.EqualsTraits("DM"); } IEnumerator ActivateCoroutine(Hashtable hashtable) { int trashCount = card.PermanentOfThisCard().DigivolutionCards.Filter(x => x.IsFlipped).Count; if (trashCount >= 1) { IAddTrashCardsFromLibraryTop addTrashCard = new IAddTrashCardsFromLibraryTop(trashCount, card.Owner, activateClass); addTrashCard.SetNotShowCards(); yield return ContinuousController.instance.StartCoroutine(addTrashCard.AddTrashCardsFromLibraryTop()); ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().ShowCardEffect2(addTrashCard.discardedCards, "Your Discarded Cards", true, true)); } if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: null, afterSelectCardCoroutine: null, message: "Select 1 [DM] digimon to add to hand", maxCount: 1, canEndNotMax: true, isShowOpponent: true, mode: SelectCardEffect.Mode.AddHand, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 [DM] digimon to add to hand", "The opponent is selecting 1 digimon to add to hand."); yield return StartCoroutine(selectCardEffect.Activate()); } } } #endregion #region On Deletion if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 level 4 or less [DM] Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Deletion] you may play 1 level 4 or lower [DM] trait Digimon card from your trash without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.CanActivateOnDeletion(card, activateClass); } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.IsDigimon && cardSource.Level <= 4 && cardSource.EqualsTraits("DM")) { if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)) { CardSource selectedCard = null; int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectCardCondition)); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 [DM] digimon to play", maxCount: maxCount, canEndNotMax: true, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 [DM] digimon to play", "The opponent is selecting 1 digimon to play."); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true)); } } } #endregion #region ESS if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 level 4 or less [DM] Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Deletion] you may play 1 level 4 or lower [DM] trait Digimon card from your trash without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.CanActivateOnDeletion(card, activateClass); } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.IsDigimon && cardSource.Level <= 4 && cardSource.EqualsTraits("DM")) { if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)) { CardSource selectedCard = null; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 [DM] digimon to play", maxCount: 1, canEndNotMax: true, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 [DM] digimon to play", "The opponent is selecting 1 digimon to play."); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true)); } } } #endregion return cardEffects; } } }