using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.EX2 { public class EX2_011 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.None) { bool Condition() { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { return true; } } return false; } cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: false, card: card, condition: Condition)); } if (timing == EffectTiming.None) { ChangeDPDeleteEffectMaxDPClass changeDPDeleteEffectMaxDPClass = new ChangeDPDeleteEffectMaxDPClass(); changeDPDeleteEffectMaxDPClass.SetUpICardEffect("Maximum DP of DP-based deletion effects gets +2000 DP", CanUseCondition, card); changeDPDeleteEffectMaxDPClass.SetUpChangeDPDeleteEffectMaxDPClass(changeMaxDP: ChangeMaxDP); cardEffects.Add(changeDPDeleteEffectMaxDPClass); bool CanUseCondition(Hashtable hashtable) { if (isExistOnField(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard())) { if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardColors.Contains(CardColor.Red) && permanent.IsTamer)) { return true; } } } } return false; } int ChangeMaxDP(int maxDP, ICardEffect cardEffect) { if (cardEffect != null) { if (cardEffect.EffectSourceCard != null) { if (cardEffect.EffectSourceCard.Owner == card.Owner) { maxDP += 2000; } } } return maxDP; } } if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete Digimon whose total DP adds up to 6000 or less", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Attacking] Choose any number of your opponent's Digimon whose total DP adds up to 6000 or less and delete them."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass)) { return true; } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (isExistOnField(card)) { if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard())) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { int maxCount = Math.Min(card.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectPermanentCondition), CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList, 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 permanents) { if (permanents.Count <= 0) { return false; } int sumDP = 0; foreach (Permanent permanent1 in permanents) { sumDP += permanent1.DP; } if (sumDP > card.Owner.MaxDP_DeleteEffect(6000, activateClass)) { return false; } return true; } bool CanTargetCondition_ByPreSelecetedList(List permanents, Permanent permanent) { int sumDP = 0; foreach (Permanent permanent1 in permanents) { sumDP += permanent1.DP; } sumDP += permanent.DP; if (sumDP > card.Owner.MaxDP_DeleteEffect(6000, activateClass)) { return false; } return true; } } } } } } return cardEffects; } } }