| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System;
- //Lilithmon
- namespace DCGO.CardEffects.EX10
- {
- public class EX10_058 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Digixros
- if (timing == EffectTiming.None)
- {
- AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
- addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", 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 element = new DigiXrosConditionElement(CanSelectCardCondition, "[Bagra Army] trait");
- bool CanSelectCardCondition(CardSource cardSource)
- {
- if (cardSource != null)
- {
- if (cardSource.Owner == card.Owner)
- {
- if (cardSource.IsDigimon)
- {
- if (cardSource.HasBagraArmyTraits)
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element };
- DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
- return digiXrosCondition;
- }
- return null;
- }
- }
- #endregion
- #region Shared On Play/When Digivolving
- string SharedEffectDiscription(string tag)
- {
- return $"[{tag}] Until your opponent's turn ends, give 1 of their Digimon or Tamers \"[End of Your Turn] Delete 1 of your Digimon.\"";
- }
- bool SharedCanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- bool PermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
- || CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaTamer(permanent, card);
- }
- if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
- {
- Permanent selectedPermanent = null;
- #region Select Permanent
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: PermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon/Tamer to gain effect", "The opponent is selecting 1 Digimon/Tamer to gain effect");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- #endregion
- #region Gain Effect
- if (selectedPermanent != null)
- {
- ActivateClass activateClass1 = new ActivateClass();
- activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition1, selectedPermanent.TopCard);
- activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
- activateClass1.SetEffectSourcePermanent(selectedPermanent);
- selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
- if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
- }
- string EffectDiscription1()
- {
- return "[End of Your Turn] Delete this Digimon.";
- }
- bool CanUseCondition1(Hashtable hashtable1)
- {
- if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
- {
- if (selectedPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(selectedPermanent))
- {
- if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner)
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanActivateCondition1(Hashtable hashtable1)
- {
- if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
- {
- if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
- {
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, selectedPermanent.TopCard);
- }
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: selectedPermanent.TopCard.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- }
- ICardEffect GetCardEffect(EffectTiming _timing)
- {
- if (_timing == EffectTiming.OnEndTurn)
- {
- return activateClass1;
- }
- return null;
- }
- }
- #endregion
- }
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("1 Digimon gains \"[End of Turn] Delete 1 of your Digimon\"", CanUseCondition, card);
- activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDiscription("On Play"));
- cardEffects.Add(activateClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("1 Digimon gains \"[End of Turn] Delete 1 of your Digimon\"", CanUseCondition, card);
- activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDiscription("On Play"));
- cardEffects.Add(activateClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- }
- #endregion
- #region All Turns - OPT
- if (timing == EffectTiming.OnEnterFieldAnyone || timing == EffectTiming.OnDestroyedAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("by trashing any 2 sources, Play a level 4 from trash", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
- activateClass.SetHashString("AT_EX10_058");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[All Turns] [Once Per Turn] When any of your opponent's Digimon are played or deleted, by trashing any 2 of this Digimon's digivolution cards, you may play 1 level 4 or lower purple Digimon card from your trash without paying the cost.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
- {
- if (card.PermanentOfThisCard().DigivolutionCards.Count >= 2)
- {
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- return CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, OpponentsDigimon);
- }
- if (timing == EffectTiming.OnDestroyedAnyone)
- return CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, OpponentsDigimon);
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- bool OpponentsDigimon(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- bool CanSelectTrashCard(CardSource source)
- {
- return source.IsDigimon &&
- source.CardColors.Contains(CardColor.Purple) &&
- source.HasLevel && source.Level <= 4 &&
- CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass, SelectCardEffect.Root.Trash);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- Permanent thisPermanent = card.PermanentOfThisCard();
- List<CardSource> selectedCards = new List<CardSource>();
- #region Trash Digivolution Cards
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: _ => true,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => false,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select 2 digivolution cards to trash.",
- maxCount: 2,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Custom,
- customRootCardList: thisPermanent.DigivolutionCards,
- canLookReverseCard: false,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- selectCardEffect.SetUseFaceDown();
- selectCardEffect.SetUpCustomMessage("Select 2 digivolution cards to trash.", "The opponent is selecting 2 digivolution cards to trash.");
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- #endregion
- if (selectedCards.Count == 2)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsAndProcessAccordingToResult(
- targetPermanent: thisPermanent,
- targetDigivolutionCards: selectedCards,
- activateClass: activateClass,
- successProcess: SuccessProcess,
- failureProcess: null));
- IEnumerator SuccessProcess(List<CardSource> trashedSources)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectTrashCard(cardSource)))
- {
- int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectTrashCard(cardSource)));
- List<CardSource> selectedCards = new List<CardSource>();
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectTrashCard,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to play.",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
- selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
- yield return StartCoroutine(selectCardEffect.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
- return cardEffects;
- }
- }
- }
|