using System.Collections; using System.Collections.Generic; using System.Linq; using System; //Eater EDEN namespace DCGO.CardEffects.BT23 { public class BT23_075 : 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.EqualsCardName("Eater Legion"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Return 1 of your opponent's Digimon or Tamers to the bottom of the deck.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] [When Digivolving] Return 1 of your opponent's play cost 6 or lower Digimon or Tamers to the bottom of the deck. For each of your [Mother Eater]'s digivolution cards in the breeding area, add 1 to this effect's play cost maximum."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool HasMother(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card) && permanent.TopCard.EqualsCardName("Mother Eater"); } bool CanSelectPermanentCondition(Permanent permanent) { int maxCost = 6; if (CardEffectCommons.HasMatchConditionPermanent(HasMother, true)) maxCost += card.Owner.GetBreedingAreaPermanents()[0].DigivolutionCards.Count; return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) && permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= maxCost && !permanent.IsOption; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1) { int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); 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.PutLibraryBottom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will return to the bottom of deck.", "The opponent is selecting 1 Digimon that will return to the bottom of deck."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Return 1 of your opponent's Digimon or Tamers to the bottom of the deck.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] Return 1 of your opponent's play cost 6 or lower Digimon or Tamers to the bottom of the deck. For each of your [Mother Eater]'s digivolution cards in the breeding area, add 1 to this effect's play cost maximum."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool HasMother(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card) && permanent.TopCard.EqualsCardName("Mother Eater"); } bool CanSelectPermanentCondition(Permanent permanent) { int maxCost = 6; if (CardEffectCommons.HasMatchConditionPermanent(HasMother, true)) maxCost += card.Owner.GetBreedingAreaPermanents()[0].DigivolutionCards.Count; return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) && permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= maxCost && !permanent.IsOption; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1) { int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); 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.PutLibraryBottom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will return to the bottom of deck.", "The opponent is selecting 1 Digimon that will return to the bottom of deck."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } #endregion #region All Turns if (timing == EffectTiming.WhenRemoveField) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 [Eater] digimon from hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] When this Digimon would leave the battle area other than by your effects, you may play 1 [Eater] trait Digimon card from your hand without paying the cost."; } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsDigimon && cardSource.HasEaterTraits && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card) && !CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card)); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition); } IEnumerator ActivateCoroutine(Hashtable hashtable) { SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); yield return StartCoroutine(selectHandEffect.Activate()); IEnumerator AfterSelectCardCoroutine(List selectedCards) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards( cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true)); } } } #endregion #region End of Opponents Turn if (timing == EffectTiming.OnEndTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete 1 Digimon with the lowest play cost", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription()); activateClass.SetHashString("Delete_BT23_075"); cardEffects.Add(activateClass); string EffectDiscription() { return "[End of Opponent's Turn] [Once Per Turn] Delete 1 of your opponent's lowest play cost Digimon."; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOpponentTurn(card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } #endregion return cardEffects; } } }