| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System;
- // Dianamon
- namespace DCGO.CardEffects.BT25
- {
- public class BT25_028 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alt Digivolution
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent permanent)
- {
- return permanent.TopCard.HasTSTraits;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, true, card, null, level: 5));
- }
- #endregion
- #region Reduce Play Cost
- if (timing == EffectTiming.None)
- {
- bool Condition()
- {
- return CardEffectCommons.HasMatchConditionPermanent(Level6EnemyDigimon);
- }
- bool Level6EnemyDigimon(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
- && permanent.TopCard.HasLevel
- && permanent.Level >= 6;
- }
- cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
- }
- #endregion
- #region Shared OP / WD
- string SharedEffectName = "None of your opponent's Digimon with 1 or less Digivolution cards can suspend until end of their turn. Delete 1 of their unsuspended Digimon";
- string SharedEffectDescription(string tag)
- => $"[{tag}] None of your opponent's Digimon with 1 or fewer digivolution cards can suspend until their turn ends. Then, delete 1 of your opponent's unsuspended Digimon.";
- bool CanDeleteCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
- && !permanent.IsSuspended;
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
- canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
- canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
- card.Owner.UntilOpponentTurnEndEffects.Add((_timing) => canNotSuspendClass);
- bool CanUseCondition1(Hashtable hashtable)
- {
- return true;
- }
- bool PermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
- && permanent.DigivolutionCards.Count <= 1
- && !permanent.TopCard.CanNotBeAffected(activateClass);
- }
- if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanDeleteCondition))
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanDeleteCondition,
- 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());
- }
- }
- CardEffectFactory.ActivateClassesForSharedEffects
- (ref cardEffects, timing, card,
- SharedEffectName,
- SharedActivateCoroutine,
- SharedEffectDescription,
- optional: false,
- onPlay: true,
- whenDigivolving: true);
- #endregion
- #region All Turns
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("May trash 4 digivolution cards and then DNA into GraceNovamon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
- activateClass.SetIsSkippable(true);
- activateClass.SetHashString("BT25_028_AT");
- cardEffects.Add(activateClass);
- string EffectDescription()
- => "[All Turns] [Once Per Turn] When any Digimon are played or digivolve, you may trash any 4 digivolution cards from your opponent's Digimon, Then, 2 of your Digimon may DNA digivolve into [GraceNovamon] in the hand.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsDigimonCondition)
- || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, IsDigimonCondition));
- }
- bool IsDigimonCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
- bool IsOpponentsDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- bool CanSelectDNACardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon
- && cardSource.CanPlayJogress(true)
- && cardSource.EqualsCardName("GraceNovamon");
- }
- bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleArea(card);
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- bool executed = false;
-
- if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
- permanentCondition: IsOpponentsDigimon,
- cardCondition: _ => true,
- maxCount: 4,
- canNoTrash: true,
- isFromOnly1Permanent: false,
- activateClass: activateClass,
- afterSelectionCoroutine: AfterSelectCoroutine
- ));
- IEnumerator AfterSelectCoroutine(Permanent permanent, List<CardSource> cardSources)
- {
- if (cardSources.Count > 0)
- executed = true;
- yield return null;
- }
- }
- yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
- CanSelectDNACardCondition,
- payCost: true,
- isHand: true,
- activateClass,
- successProcess: SuccessProcess
- ));
- IEnumerator SuccessProcess(CardSource cardSource)
- {
- executed = true;
- yield return null;
- }
- if (!executed) activateClass.RemoveUse();
- }
- }
- #endregion
- #region When Attacking ESS
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("1 of your opponent's Digimon or Tamers can't suspend", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
- activateClass.SetIsInheritedEffect(true);
- activateClass.SetHashString("BT25_028_WA_ESS");
- cardEffects.Add(activateClass);
- string EffectDescription()
- => "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon or Tamers can't suspend until their turn ends.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool CanSelectOpponentPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
- && (permanent.IsDigimon || permanent.IsTamer);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentPermanentCondition))
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition_ByPreSelecetedList: null,
- canTargetCondition: CanSelectOpponentPermanentCondition,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon/Tamer that will be unable to suspend.",
- "The opponent is selecting 1 Digimon/Tamer that will be unable to suspend.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- Permanent selectedPermanent = permanent;
- CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
- canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCanNotSuspendCondition, card);
- canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCanNotSuspendCondition);
- selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => canNotSuspendClass);
- if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- yield return ContinuousController.instance.StartCoroutine(GManager.instance
- .GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
- }
- bool CanUseCanNotSuspendCondition(Hashtable hashtableCanNotSuspend)
- {
- return selectedPermanent.TopCard != null
- && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
- }
- bool PermanentCanNotSuspendCondition(Permanent permanentCanNotSuspend)
- {
- return permanentCanNotSuspend == selectedPermanent;
- }
- }
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|