using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.BT17 { public class BT17_060 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Rush, Reboot, Blocker if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false,card: card,condition: null)); } #endregion #region On Play/When Digivolving Shared int maxCost = 15; bool CanSelectOpponentsPermanent(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.TopCard.GetCostItself <= maxCost) { if (permanent.TopCard.HasPlayCost) { return true; } } } return false; } bool CanEndSelectCondition(List permanents) { if (permanents.Count <= 0) return false; int sumCost = 0; foreach (Permanent permanent1 in permanents) { sumCost += permanent1.TopCard.GetCostItself; } if (sumCost > maxCost) return false; return true; } bool CanTargetCondition_ByPreSelecetedList(List permanents, Permanent permanent) { int sumCost = 0; foreach (Permanent permanent1 in permanents) { sumCost += permanent1.TopCard.GetCostItself; } sumCost += permanent.TopCard.GetCostItself; if (sumCost > maxCost) return false; return true; } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete up to 15 play cost's worth of your opponent's Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Delete up to 15 play cost's worth of your opponent's Digimon."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { int destroyCount = card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectOpponentsPermanent); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectOpponentsPermanent, canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList, canEndSelectCondition: CanEndSelectCondition, maxCount: destroyCount, canNoSelect: false, canEndNotMax: true, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete up to 15 play cost's worth of your opponent's Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] Delete up to 15 play cost's worth of your opponent's Digimon."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { int destroyCount = card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectOpponentsPermanent); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectOpponentsPermanent, canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList, canEndSelectCondition: CanEndSelectCondition, maxCount: destroyCount, canNoSelect: false, canEndNotMax: true, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } #endregion #region Your Turn - Can attack unsuspended if (timing == EffectTiming.None) { CanAttackTargetDefendingPermanentClass canAttackTargetDefendingPermanentClass = new CanAttackTargetDefendingPermanentClass(); canAttackTargetDefendingPermanentClass.SetUpICardEffect($"Can attack unsuspended Digimon", CanUseCondition, card); canAttackTargetDefendingPermanentClass.SetUpCanAttackTargetDefendingPermanentClass( attackerCondition: AttackerCondition, defenderCondition: DefenderCondition, cardEffectCondition: CardEffectCondition); cardEffects.Add(canAttackTargetDefendingPermanentClass); bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { return true; } } return false; } bool AttackerCondition(Permanent attacker) { return attacker == card.PermanentOfThisCard(); } bool DefenderCondition(Permanent defender) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(defender, card)) { if (!defender.IsSuspended) { return true; } } return false; } bool CardEffectCondition(ICardEffect cardEffect) { return true; } } #endregion #region Reduce Cost - Effect if (timing == EffectTiming.BeforePayCost) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Bottom deck card to reduce Cost -1", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetHashString("PlayCost-1_BT17_060"); cardEffects.Add(activateClass); string EffectDiscription() { return "When this card would be played from the hand, by returning up to 13 cards with the [Unidentified] trait or [Diaboromon] in their text from your trash to the bottom of the deck, for each card returned, reduce the play cost by 1."; } bool CanSelectCardInTrash(CardSource source) { if (source.HasText("Diaboromon")) return true; if (source.ContainsTraits("Unidentified")) return true; return false; } bool CardCondition(CardSource cardSource) { if (cardSource == card) { if (CardEffectCommons.IsExistOnHand(cardSource)) { return true; } } return false; } bool CanEndSelectCostCondition(List cardSources) { if (card.BasePlayCostFromEntity - cardSources.Count > card.Owner.MaxMemoryCost) return false; return true; } bool CanNoSelect(CardSource cardSource) { if (cardSource != null) { if (cardSource.PayingCost(SelectCardEffect.Root.Hand, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost) { return false; } } return true; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition)) { return true; } return false; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardInTrash); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { bool canNoSelect = CanNoSelect(CardEffectCommons.GetCardFromHashtable(_hashtable)); List selectedCards = new List(); if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardInTrash)) { int maxCount = 13; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardInTrash, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: CanEndSelectCostCondition, canNoSelect: () => canNoSelect, selectCardCoroutine: null, afterSelectCardCoroutine: SelectCardCoroutine, message: "Select up to 13 cards to bottom of deck.", 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 up to 13 card(s) to bottom deck.", "The opponent is selecting up to 13 card(s) to bottom deck."); selectCardEffect.SetUpCustomMessage_ShowCard("Card(s) Bottom Decked"); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(List sources) { if(sources.Count > 0) { selectedCards = sources.Clone(); selectedCards.Reverse(); yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(selectedCards)); } } if(selectedCards.Count > 0) { if (card.Owner.CanReduceCost(null, card)) { ContinuousController.instance.PlaySE(GManager.instance.GetComponent().BuffSE); } ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect("Play Cost -1", CanUseCondition1, card); changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true); card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass); bool CanUseCondition1(Hashtable hashtable) { return true; } int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List targetPermanents) { if (CardSourceCondition(cardSource)) { if (RootCondition(root)) { if (PermanentsCondition(targetPermanents)) { Cost -= selectedCards.Count; } } } return Cost; } bool PermanentsCondition(List targetPermanents) { if (targetPermanents == null) { return true; } else { if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0) { return true; } } return false; } bool CardSourceCondition(CardSource cardSource) { return cardSource == card; } bool RootCondition(SelectCardEffect.Root root) { return true; } bool isUpDown() { return true; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable)); } } } } #endregion #region Reduce Cost - Not Shown if (timing == EffectTiming.None) { ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect("Play Cost -", CanUseCondition, card); changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true); changeCostClass.SetNotShowUI(true); cardEffects.Add(changeCostClass); bool CanSelectCardInTrash(CardSource source) { if (source.HasText("Diaboromon")) return true; if (source.ContainsTraits("Unidentified")) return true; return false; } bool CanUseCondition(Hashtable hashtable) { if (card.Owner.HandCards.Contains(card)) { ICardEffect activateClass = card.EffectList(EffectTiming.BeforePayCost).Find(cardEffect => cardEffect.EffectName == "Bottom deck card to reduce Cost -1"); if (activateClass != null) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardInTrash)) { return true; } } } return false; } int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List targetPermanents) { if (CardSourceCondition(cardSource)) { if (RootCondition(root)) { if (PermanentsCondition(targetPermanents)) { Cost -= CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectCardInTrash); } } } return Cost; } bool PermanentsCondition(List targetPermanents) { if (targetPermanents == null) { return true; } else { if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0) { return true; } } return false; } bool CardSourceCondition(CardSource cardSource) { if (cardSource != null) { if (cardSource == card) { return true; } } return false; } bool RootCondition(SelectCardEffect.Root root) { return true; } bool isUpDown() { return true; } } #endregion return cardEffects; } } }