using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.BT18 { public class BT18_019 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region DNA Digivolution if (timing == EffectTiming.None) { AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass(); addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card); addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress); addJogressConditionClass.SetNotShowUI(true); cardEffects.Add(addJogressConditionClass); bool CanUseCondition(Hashtable hashtable) { return true; } JogressCondition GetJogress(CardSource cardSource) { if (cardSource == card) { bool PermanentCondition1(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.CardNames.Contains("Kimeramon"); } bool PermanentCondition2(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.CardNames.Contains("Machinedramon"); } JogressConditionElement[] elements = new JogressConditionElement[] { new JogressConditionElement(PermanentCondition1, "Kimeramon"), new JogressConditionElement(PermanentCondition2, "Machinedramon"), }; JogressCondition jogressCondition = new JogressCondition(elements, 0); return jogressCondition; } return null; } } #endregion #region OP/WD Shared #region Different Levels Shared List> Levels = new List> { Level3Selection, Level4Selection, Level5Selection, Level6Selection, Level7Selection }; bool Level3Selection(CardSource cardSource) { return cardSource.IsDigimon && cardSource.IsLevel3; } bool Level4Selection(CardSource cardSource) { return cardSource.IsDigimon && cardSource.IsLevel4; } bool Level5Selection(CardSource cardSource) { return cardSource.IsDigimon && cardSource.IsLevel5; } bool Level6Selection(CardSource cardSource) { return cardSource.IsDigimon && cardSource.IsLevel6; } bool Level7Selection(CardSource cardSource) { return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level == 7; } #endregion string SharedEffectName = "Delete 1 enemy Digimon, then if DNA top deck 1 of all trash levels to gain 1 mem per."; CardEffectFactory.ActivateClassesForSharedEffects (ref cardEffects, timing, card, SharedEffectName, SharedActivateCoroutine, SharedEffectDescription, optional: false, onPlay: true, whenDigivolving: true); string SharedEffectDescription(string tag) => $"[{tag}] Delete 1 of your opponent's Digimon. Then, if DNA digivolving, by returning 1 of each Digimon card with different levels from your opponent's trash to the top of the deck, for each card returned, gain 1 memory."; bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } IEnumerator SharedActivateCoroutine(Hashtable _hashtable, ActivateClass activateClass) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { 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()); } if (CardEffectCommons.IsJogress(_hashtable)) { List selectedCards = new List(); foreach (Func level in Levels) { bool exitLoop = false; if (CardEffectCommons.HasMatchConditionOpponentsCardInTrash(card, level)) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: level, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => canSelectNo(), selectCardCoroutine: LevelSelected, afterSelectCardCoroutine: AfterSelectCardCoroutine, message: $"Select level {Levels.IndexOf(level) + 3} Digimon card to add to the top of opponent's deck", maxCount: 1, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: card.Owner.Enemy.TrashCards.Filter(level), canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); yield return StartCoroutine(selectCardEffect.Activate()); } bool canSelectNo() => selectedCards.Count == 0; IEnumerator LevelSelected(CardSource cardSource) { if (cardSource != null) selectedCards.Add(cardSource); yield return null; } IEnumerator AfterSelectCardCoroutine(List cardSources) { if (cardSources.Count == 0) { exitLoop = true; } yield return null; } if (exitLoop) break; } if (selectedCards.Count >= 1) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: (CardSource) => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelection, message: "Select order of cards to add to the top your deck\n(cards will be placed back to the top of the deck so that cards with lower numbers are on top).", maxCount: selectedCards.Count, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: selectedCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator AfterSelection(List sources) { sources.Reverse(); yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(sources)); yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1 * sources.Count, activateClass)); } } } } #endregion #region On Deletion if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play a [Millenniummon] from the trash", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[On Deletion] By returning 1 [Kimeramon] and 1 [Machinedramon] from your trash to the bottom of the deck, you may play 1 [Millenniummon] from your trash without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.CanActivateOnDeletion(card, activateClass) && (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardConditionKimeramon) || CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardConditionMachinedramon)); } bool CanSelectCardConditionKimeramon(CardSource cardSource) { return cardSource != null && cardSource.Owner == card.Owner && cardSource.EqualsCardName("Kimeramon"); } bool CanSelectCardConditionMachinedramon(CardSource cardSource) { return cardSource != null && cardSource.Owner == card.Owner && cardSource.EqualsCardName("Machinedramon"); } bool CanSelectCardConditionMilleniummon(CardSource cardSource) { return cardSource.EqualsCardName("Millenniummon") && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass, root: SelectCardEffect.Root.Trash); } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool returned = false; int maxCount = 2; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: (cardSource) => CanSelectCardConditionKimeramon(cardSource) || CanSelectCardConditionMachinedramon(cardSource), canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList, canEndSelectCondition: CanEndSelectCondition, canNoSelect: () => true, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine1, 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); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); bool CanTargetCondition_ByPreSelecetedList(List cardSources, CardSource cardSource) { if (cardSources.Count(CanSelectCardConditionKimeramon) >= 1 && CanSelectCardConditionKimeramon(cardSource) && !CanSelectCardConditionMachinedramon(cardSource)) { return false; } if (cardSources.Count(CanSelectCardConditionMachinedramon) >= 1 && CanSelectCardConditionMachinedramon(cardSource) && !CanSelectCardConditionKimeramon(cardSource)) { return false; } return true; } bool CanEndSelectCondition(List cardSources) { if (cardSources.Count(CanSelectCardConditionKimeramon) == 0) { return false; } if (cardSources.Count(CanSelectCardConditionMachinedramon) == 0) { return false; } return true; } IEnumerator AfterSelectCardCoroutine1(List cardSources) { if (cardSources.Count == 2) { yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources)); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().ShowCardEffect(cardSources, "Deck Bottom Cards", true, true)); returned = true; } } if (returned) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardConditionMilleniummon)) { List selectedCards = new List(); SelectCardEffect selectPlayEffect = GManager.instance.GetComponent(); selectPlayEffect.SetUp( canTargetCondition: CanSelectCardConditionMilleniummon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to play.", maxCount: 1, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectPlayEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectPlayEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectPlayEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true)); } } } } #endregion #region DigiXros if (timing == EffectTiming.None) { AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass(); addDigiXrosConditionClass.SetUpICardEffect("DigiXros -2", CanUseCondition, card); addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros); addDigiXrosConditionClass.SetNotShowUI(true); cardEffects.Add(addDigiXrosConditionClass); bool CanUseCondition(Hashtable hashtable) { return true; } DigiXrosCondition GetDigiXros(CardSource cardSource) { if (cardSource == card) { DigiXrosConditionElement elementKimeramon = new DigiXrosConditionElement(CanSelectCardCondition, "Kimeramon"); bool CanSelectCardCondition(CardSource conditionCardSource) { return conditionCardSource != null && conditionCardSource.Owner == card.Owner && conditionCardSource.IsDigimon && conditionCardSource.CardNames_DigiXros.Contains("Kimeramon"); } DigiXrosConditionElement elementMachinedramon = new DigiXrosConditionElement(CanSelectCardCondition1, "Machinedramon"); bool CanSelectCardCondition1(CardSource conditionCardSource) { return conditionCardSource != null && conditionCardSource.Owner == card.Owner && conditionCardSource.IsDigimon && conditionCardSource.CardNames_DigiXros.Contains("Machinedramon"); } List elements = new List() { elementKimeramon, elementMachinedramon }; DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2); return digiXrosCondition; } return null; } } #endregion return cardEffects; } } }