using System; using System.Collections; using System.Collections.Generic; using System.Linq; public class EX5_026 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.CardNames.Contains("MetalGarurumon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null)); } if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); } if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Opponent's Digimon gain effects", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] If [MetalGarurumon] or [X Antibody] is in this Digimon's digivolution cards, until the end of your opponent's turn, all of their Digimon gain \"[When Attacking] Lose 4 memory\"."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("MetalGarurumon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (!permanent.TopCard.CanNotBeAffected(activateClass)) { return true; } } return false; } foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaPermanents()) { if (PermanentCondition(permanent)) { yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateDebuffEffect(permanent)); } } AddSkillClass addSkillClass = new AddSkillClass(); addSkillClass.SetUpICardEffect("Memory -4", CanUseCondition1, card); addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects); card.Owner.UntilOpponentTurnEndEffects.Add((_timing) => addSkillClass); bool CanUseCondition1(Hashtable hashtable) { return true; } bool CardSourceCondition(CardSource cardSource) { if (PermanentCondition(cardSource.PermanentOfThisCard())) { if (cardSource == cardSource.PermanentOfThisCard().TopCard) { return true; } } return false; } List GetEffects(CardSource cardSource, List cardEffects, EffectTiming _timing) { if (_timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass1 = new ActivateClass(); activateClass1.SetUpICardEffect("Memory -4", CanUseCondition2, cardSource); activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1()); cardEffects.Add(activateClass1); if (cardSource.PermanentOfThisCard() != null) { activateClass1.SetEffectSourcePermanent(cardSource.PermanentOfThisCard()); } string EffectDiscription1() { return "[When Attacking] Lose 4 memory."; } bool CanUseCondition2(Hashtable hashtable) { if (CardSourceCondition(cardSource)) { if (CardEffectCommons.CanTriggerOnAttack(hashtable, cardSource)) { return true; } } return false; } bool CanActivateCondition1(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(cardSource)) { return true; } return false; } IEnumerator ActivateCoroutine1(Hashtable _hashtable) { yield return ContinuousController.instance.StartCoroutine(cardSource.Owner.AddMemory(-4, activateClass1)); } } return cardEffects; } } } if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Return 1 card from trash to the bottom of deck to delete 1 Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Attacking] By returning 1 Digimon card from your trash to the bottom of the deck, delete 1 of your opponent's Digimon with the same level as that card."; } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsDigimon; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { CardSource deckBottomCard = null; if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 1) { int maxCount = 1; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource), canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine, message: "Select cards to place at the bottom of the deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).", maxCount: maxCount, canEndNotMax: false, isShowOpponent: false, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetNotShowCard(); selectCardEffect.SetNotAddLog(); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); IEnumerator AfterSelectCardCoroutine(List cardSources) { if (cardSources.Count == 1) { yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources)); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().ShowCardEffect(cardSources, "Deck Bottom Card", true, true)); deckBottomCard = cardSources[0]; } } } if (deckBottomCard != null) { bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.Level == deckBottomCard.Level) { if (permanent.TopCard.HasLevel) { if (deckBottomCard.HasLevel) { return true; } } } } return false; } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition)); 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.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } } return cardEffects; } }