| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- 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<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #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<Func<CardSource, bool>> Levels = new List<Func<CardSource, bool>> { 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>();
- 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<CardSource> selectedCards = new List<CardSource>();
- foreach (Func<CardSource, bool> level in Levels)
- {
- bool exitLoop = false;
- if (CardEffectCommons.HasMatchConditionOpponentsCardInTrash(card, level))
- {
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- 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<CardSource> cardSources)
- {
- if (cardSources.Count == 0)
- {
- exitLoop = true;
- }
- yield return null;
- }
- if (exitLoop)
- break;
- }
- if (selectedCards.Count >= 1)
- {
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- 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<CardSource> 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>();
- 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<CardSource> 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<CardSource> cardSources)
- {
- if (cardSources.Count(CanSelectCardConditionKimeramon) == 0)
- {
- return false;
- }
- if (cardSources.Count(CanSelectCardConditionMachinedramon) == 0)
- {
- return false;
- }
- return true;
- }
- IEnumerator AfterSelectCardCoroutine1(List<CardSource> cardSources)
- {
- if (cardSources.Count == 2)
- {
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Cards", true, true));
- returned = true;
- }
- }
- if (returned)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardConditionMilleniummon))
- {
- List<CardSource> selectedCards = new List<CardSource>();
- SelectCardEffect selectPlayEffect = GManager.instance.GetComponent<SelectCardEffect>();
- 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<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>()
- { elementKimeramon, elementMachinedramon };
- DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
- return digiXrosCondition;
- }
- return null;
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|