using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.EX8 { public class EX8_072 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Trash Your Turn if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Return this to bottom of deck, Activate Main", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Trash] [Your Turn] When your Digimon digivolves into [Barbamon (X Antibody)], by returning this card to the bottom of the deck, activate this card's [Main] effect."; } bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)) { if (permanent.TopCard.CardNames.Contains("Barbamon (X Antibody)")) { return true; } if (permanent.TopCard.CardNames.Contains("Barbamon(XAntibody)")) { return true; } } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnTrash(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition)) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnTrash(card); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.IsExistOnTrash(card)) { List cardSources = new List() { card }; yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources)); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().ShowCardEffect2(cardSources, "Deck Bottom Card", true, true)); ActivateClass mainActivateClass = CardEffectCommons.OptionMainEffect(card); if (mainActivateClass != null) { yield return ContinuousController.instance.StartCoroutine(mainActivateClass.Activate(CardEffectCommons.OptionMainCheckHashtable(card))); } } } } #endregion #region Main if (timing == EffectTiming.OptionSkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Opponent trashes 1 card, then delete 1 Digimon.", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Main] If your opponent has 5 or more cards in their hand, they trash 1 card in their hand. Then, delete 1 of your opponent's level 7 or lower Digimon. For every 3 cards in your opponent's hand, remove 1 from this effect's level maximum."; } bool SelectOpponentsDigimon(Permanent permanent) { var levelMax = 7 - (card.Owner.Enemy.HandCards.Count / 3); if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.TopCard.HasLevel && permanent.Level <= levelMax) { return true; } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (card.Owner.Enemy.HandCards.Count >= 5) { SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner.Enemy, canTargetCondition: (CardSource) => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: null, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Discard, cardEffect: activateClass); yield return StartCoroutine(selectHandEffect.Activate()); } if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SelectOpponentsDigimon)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: SelectOpponentsDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } yield return null; } } #endregion #region Security Effect if (timing == EffectTiming.SecuritySkill) { CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: "Opponent trashes 1 card, then delete 1 Digimon."); } #endregion return cardEffects; } } }