| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System;
- // Apollomon
- namespace DCGO.CardEffects.BT25
- {
- public class BT25_018 : 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)
- {
- ChangeCostClass changeCostClass = new ChangeCostClass();
- changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
- changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
- changeCostClass.SetNotShowUI(true);
- cardEffects.Add(changeCostClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.HasMatchConditionOpponentsPermanent(card, Level6EnemyDigimon);
- }
- bool Level6EnemyDigimon(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
- && permanent.HasDP
- && permanent.DP >= 12000;
- }
- int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
- List<Permanent> targetPermanents)
- {
- if (CardSourceCondition(cardSource) &&
- RootCondition(root) &&
- PermanentsCondition(targetPermanents))
- {
- cost -= 5;
- }
- return cost;
- }
- bool PermanentsCondition(List<Permanent> targetPermanents)
- {
- return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
- }
- bool CardSourceCondition(CardSource cardSource)
- {
- return cardSource == card;
- }
- bool RootCondition(SelectCardEffect.Root root)
- {
- return true;
- }
- bool isUpDown()
- {
- return true;
- }
- }
- #endregion
- #region Shared Condition and Deletion
- bool IsYourDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
- bool CanDeleteCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
- && permanent.HasDP
- && permanent.DP < card.PermanentOfThisCard().DP;
- }
- IEnumerator DeleteWeakerDigimon(ActivateClass 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());
- }
- }
- #endregion
- #region Shared OP / WD
- string SharedEffectName = "-2k for each of your Digimon to all opponent's digimon until end of the turn. Delete 1 enemy Digimon with equal or less DP than this digimon";
- string SharedEffectDescription(string tag)
- => $"[{tag}] For the turn, all of your opponent's Digimon get -2000 DP for each of your Digimon. Then, delete 1 of their Digimon with as much DP as this Digimon or less.";
-
- bool IsEnemyDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- int reduction = -2000 * CardEffectCommons.MatchConditionPermanentCount(IsYourDigimon);
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
- permanentCondition: IsEnemyDigimon,
- changeValue: reduction,
- effectDuration: EffectDuration.UntilEachTurnEnd,
- activateClass: activateClass));
- yield return ContinuousController.instance.StartCoroutine(DeleteWeakerDigimon(activateClass));
- }
- CardEffectFactory.ActivateClassesForSharedEffects
- (ref cardEffects, timing, card,
- SharedEffectName,
- SharedActivateCoroutine,
- SharedEffectDescription,
- optional: false,
- onPlay: true,
- whenDigivolving: true);
- #endregion
- #region End of your Turn
- if (timing == EffectTiming.OnEndTurn)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("DNA digivolve into [GraceNovamon]. 1 of your Digimon may attack.", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- => "[End of Your Turn] 2 of your Digimon may DNA digivolve into [GraceNovamon] in the hand. Then, 1 of your Digimon may attack.";
- bool CanSelectDNACardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon
- && cardSource.CanPlayJogress(true)
- && cardSource.EqualsCardName("GraceNovamon");
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.IsOwnerTurn(card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card);
- }
- bool YourDigimonThatCanAttack(Permanent permanent)
- {
- return IsYourDigimon(permanent)
- && permanent.CanAttack(activateClass);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- #region DNA digivolve
- yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
- CanSelectDNACardCondition,
- payCost: true,
- isHand: true,
- activateClass
- ));
- #endregion
- #region May Attack
- if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, YourDigimonThatCanAttack))
- {
- SelectPermanentEffect selectPermanentEffect =
- GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: YourDigimonThatCanAttack,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Attack,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.",
- "The opponent is selecting 1 Digimon that will attack.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- #endregion
- }
- }
- #endregion
- #region When Attacking ESS
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Delete 1 enemy digimon with DP equal or less", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, _ => DeleteWeakerDigimon(activateClass), 1, false, EffectDescription());
- activateClass.SetIsInheritedEffect(true);
- activateClass.SetHashString("BT25_018_WA_ESS");
- cardEffects.Add(activateClass);
- string EffectDescription()
- => "[When Attacking] [Once Per Turn] Delete 1 of your opponent's Digimon with as much DP as this Digimon or less.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card);
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|