| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- // Angemon
- namespace DCGO.CardEffects.EX9
- {
- public class EX9_026 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Digivolution condition
- if (timing == EffectTiming.None)
- {
- bool Condition(Permanent permanent)
- {
- return permanent.TopCard.IsLevel3 && permanent.TopCard.EqualsTraits("DM");
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(Condition, 2, false, card, null));
- }
- #endregion
- #region Training
- if (timing == EffectTiming.OnDeclaration)
- {
- cardEffects.Add(CardEffectFactory.TrainingEffect(card: card));
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Place a card face down as source, to give 1 digimon SEC -1 & -3k DP", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[On Play] By placing 1 card in your hand face down as this Digimon's bottom digivolution card, give 1 of your opponent's Digimon <Security A. -1> (This Digimon checks 1 fewer security card) and -3000 DP until their turn ends.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- card.Owner.HandCards.Count > 0;
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Place a card face down as source, to give 1 digimon SEC -1 & -3k DP", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Digivolving] By placing 1 card in your hand face down as this Digimon's bottom digivolution card, give 1 of your opponent's Digimon <Security A. -1> (This Digimon checks 1 fewer security card) and -3000 DP until their turn ends.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); ;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- card.Owner.HandCards.Count > 0;
- }
- }
- #endregion
- #region OP/WD Shared
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- CardSource selectedCard = null;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: (cardSource) => true,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: false,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- yield return StartCoroutine(selectHandEffect.Activate());
- selectHandEffect.SetUpCustomMessage("Select a card to add face down as a source", "Opponent is selecting a card to add face down as a source");
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- if (selectedCard != null)
- {
- Permanent permanent = card.PermanentOfThisCard();
- yield return ContinuousController.instance.StartCoroutine(permanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
- if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
- {
- Permanent selectedPermanent = null;
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass
- );
- selectPermanentEffect.SetUpCustomMessage("Select a Digimon to give SEC -1 & -3k DP", "Opponent is selecting a Digimon to give SEC -1 & -3k DP");
- selectHandEffect.SetUpCustomMessage_ShowCard("Selected Digimon");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if (selectedPermanent != null)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: selectedPermanent, changeValue: -1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: selectedPermanent, changeValue: -3000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
- }
- }
- }
- }
- #endregion
- #region ESS
- if (timing == EffectTiming.OnDestroyedAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- activateClass.SetIsInheritedEffect(true);
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[On Deletion] If you have 3 or fewer security cards, <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack).";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (card.Owner.CanAddSecurity(activateClass))
- {
- if (card.Owner.LibraryCards.Count >= 1)
- {
- if (card.Owner.SecurityCards.Count <= 3)
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|