using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.BT16 { public class BT16_027 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternate Digivolution, Blast Digivolve if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Imperialdramon: Dragon Mode"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } if (timing == EffectTiming.OnCounterTiming) { cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null)); } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Bottom Deck 1 of your opponent's Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Return 1 of your opponent's Digimon with as many or fewer digivolution cards as this Digimon to the bottom of the deck."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { return permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count; } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { return CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition); } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition_ByPreSelecetedList: null, canTargetCondition: CanSelectPermanentCondition, canEndSelectCondition: null, maxCount: 1, 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 #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Bottom Deck 1 of your opponent's Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] Return 1 of your opponent's Digimon with as many or fewer digivolution cards as this Digimon to the bottom of the deck."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { return permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count; } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { return CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition); } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition_ByPreSelecetedList: null, canTargetCondition: CanSelectPermanentCondition, canEndSelectCondition: null, maxCount: 1, 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 #region End of Attack if (timing == EffectTiming.OnEndAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Unsuspend this Digimon/Return a suspended Digimon to the bottom of the deck.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription()); activateClass.SetHashString("EndofAttack_BT16_027"); cardEffects.Add(activateClass); string EffectDiscription() { return "[End of Attack] [Once Per Turn] Unsuspend this Digimon. Then, if [Imperialdramon: Dragon Mode] is in this Digimon's digivolution cards, return 1 of your opponent's suspended Digimon to the bottom of the deck."; } bool HasSourceCondition(CardSource cardSource) { return cardSource.EqualsCardName("Imperialdramon: Dragon Mode") || cardSource.EqualsCardName("Imperialdramon Dragon Mode"); } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { return permanent.IsSuspended; } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnEndAttack(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List() { card.PermanentOfThisCard() }, activateClass).Unsuspend()); if (card.PermanentOfThisCard().DigivolutionCards.Count(HasSourceCondition) >= 1) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition_ByPreSelecetedList: null, canTargetCondition: CanSelectPermanentCondition, canEndSelectCondition: null, maxCount: 1, 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; } } }