| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Linq;
- using Photon;
- using System;
- using Photon.Pun;
- public class Dukemon_EX2_011 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- 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 Digimons 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>();
- 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<Permanent> 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<Permanent> 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;
- }
- }
|