| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- using System.Collections;
- using System.Collections.Generic;
- using System;
- using System.Linq;
- namespace DCGO.CardEffects.LM
- {
- public class LM_021 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alternate Digivolution
- if (timing == EffectTiming.None)
- {
- bool DigivolutionCondition()
- {
- return card.Owner.SecurityCards.Count <= 2;
- }
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.EqualsCardName("Agumon");
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
- digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: DigivolutionCondition));
- }
- #endregion
- #region Ace - Blast Digivolve
- if (timing == EffectTiming.OnCounterTiming)
- {
- cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
- }
- #endregion
- #region On Play/ When Digivolving Shared
- int MaxDP()
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) ? card.PermanentOfThisCard().DP : 0;
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect($"Delete opponent's Digimon whose total DP adds up to {MaxDP()} or less", CanUseCondition,
- card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[On Play] Delete any number of your opponent’s Digimon whose total DP adds up to equal or less than this Digimon’s DP.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
- permanent.DP <= card.Owner.MaxDP_DeleteEffect(MaxDP(), activateClass);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- int maxCount = Math.Min(card.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectPermanentCondition),
- CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: CanTargetConditionByPreSelectedList,
- canEndSelectCondition: CanEndSelectCondition,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: true,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- bool CanEndSelectCondition(List<Permanent> permanents)
- {
- if (permanents.Count <= 0) return false;
- int sumDP = permanents.Sum(permanent => permanent.DP);
- return sumDP <= card.Owner.MaxDP_DeleteEffect(MaxDP(), activateClass);
- }
- bool CanTargetConditionByPreSelectedList(List<Permanent> permanents, Permanent permanent)
- {
- int sumDP = permanents.Sum(permanent1 => permanent1.DP);
- sumDP += permanent.DP;
- return sumDP <= card.Owner.MaxDP_DeleteEffect(MaxDP(), activateClass);
- }
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect($"Delete opponent's Digimon whose total DP adds up to {MaxDP()} or less", CanUseCondition,
- card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[When Digivolving] Delete any number of your opponent’s Digimon whose total DP adds up to equal or less than this Digimon’s DP.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
- permanent.DP <= card.Owner.MaxDP_DeleteEffect(MaxDP(), activateClass);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- int maxCount = Math.Min(card.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectPermanentCondition),
- CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: CanTargetConditionByPreSelectedList,
- canEndSelectCondition: CanEndSelectCondition,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: true,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- bool CanEndSelectCondition(List<Permanent> permanents)
- {
- if (permanents.Count <= 0) return false;
- int sumDP = permanents.Sum(permanent => permanent.DP);
- return sumDP <= card.Owner.MaxDP_DeleteEffect(MaxDP(), activateClass);
- }
- bool CanTargetConditionByPreSelectedList(List<Permanent> permanents, Permanent permanent)
- {
- int sumDP = permanents.Sum(permanent1 => permanent1.DP);
- sumDP += permanent.DP;
- return sumDP <= card.Owner.MaxDP_DeleteEffect(MaxDP(), activateClass);
- }
- }
- }
- #endregion
- #region When Attacking
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect($"Trash the top card of your opponent's security stack", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
- activateClass.SetHashString("TrashTopSec_LM_021");
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[When Attacking] (Once Per Turn) If you have a Tamer, trash the top card of your opponent’s security stack.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.HasMatchConditionOwnersPermanent(card, permanent => permanent.IsTamer) &&
- card.Owner.Enemy.SecurityCards.Count >= 1;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
- player: card.Owner.Enemy,
- destroySecurityCount: 1,
- cardEffect: activateClass,
- fromTop: true).DestroySecurity());
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|