| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- //Shock Plasma
- namespace DCGO.CardEffects.BT24
- {
- public class BT24_092 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Static Effects
- #region Ignore Color Requirement
- if (timing == EffectTiming.None)
- {
- IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
- ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
- ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
- cardEffects.Add(ignoreColorConditionClass);
- bool CanUseCondition(Hashtable hashtable)
- => CardEffectCommons.HasMatchConditionPermanent((permanent) => permanent.TopCard.Owner == card.Owner && (permanent.IsTamer || permanent.IsDigimon) && permanent.TopCard.HasTSTraits, true);
- bool CardCondition(CardSource cardSource)
- => cardSource == card;
- }
- #endregion
- #region Link Condition
- if (timing == EffectTiming.None)
- {
- static bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.IsDigimon && targetPermanent.TopCard.HasTSTraits;
- }
- cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 3, card: card));
- }
- #endregion
- #region Link
- if (timing == EffectTiming.OnDeclaration)
- {
- cardEffects.Add(CardEffectFactory.LinkEffect(card));
- }
- #endregion
- #endregion
- #region Security Effect
- if (timing == EffectTiming.SecuritySkill)
- {
- CardEffectCommons.AddActivateMainOptionSecurityEffect(
- card: card,
- cardEffects: ref cardEffects,
- effectName: "1 opponent's Digimon gets -6K DP for the turn. Then, you may link this card.");
- }
- #endregion
- #region Shared DP Reduction
- bool SharedIsOpponentDigimon(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedIsOpponentDigimon))
- {
- Permanent selectedPermament = null;
- #region Select Permanent
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, SharedIsOpponentDigimon));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: SharedIsOpponentDigimon,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermament = permanent;
- yield return null;
- }
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to -6K DP", "The opponent is selecting 1 Digimon to -6K DP");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- #endregion
- if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.ChangeDigimonDP(selectedPermament, -6000, EffectDuration.UntilEachTurnEnd, activateClass));
- }
- }
- #endregion
- #region Main
- if (timing == EffectTiming.OptionSkill)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("1 opponent's Digimon gets -6K DP for the turn. Then, you may link this card.", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- => "[Main] 1 of your opponent's Digimon gets -6000 DP for the turn. Then, you may link this card to 1 of your Digimon on the field without paying the cost.";
- bool CanUseCondition(Hashtable hashtable)
- => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return permanent.IsDigimon
- && CardEffectCommons.IsOwnerPermanent(permanent, card)
- && card.CanLinkToTargetPermanent(permanent, false, true);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
- #region Select Digimon To Link
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition, true))
- {
- Permanent selectedPermanent = null;
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to link.", "The opponent is selecting 1 Digimon to link.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddLinkCard(card, activateClass));
- }
- #endregion
- }
- }
- #endregion
- #region Link ESS
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("1 Opponent's digimon gets -6K DP for the turn.", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
- activateClass.SetIsLinkedEffect(true);
- activateClass.SetHashString("WA_BT24-092");
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -6000 DP for the turn.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedIsOpponentDigimon);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|