| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- // Matt Ishida & T.K. Takaishi
- namespace DCGO.CardEffects.AD1
- {
- public class AD1_019 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Start of Your Main Phase
- if (timing == EffectTiming.OnStartMainPhase)
- {
- cardEffects.Add(CardEffectFactory.Gain1MemoryTamerOpponentDigimonEffect(card));
- }
- #endregion
- #region Your Turn
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ();
- activateClass.SetUpICardEffect("By suspending this tamer, you may play 1[ADVENTURE] Digimon for -1 cost per 2 colors on your Tamers.", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- => "[Your Turn] When any of your Digimon digivolve into an [ADVENTURE] trait Digimon, by suspending this Tamer, you may play 1 [ADVENTURE] trait card from your hand. For every 2 of your Tamers' colors, reduce this effect's play cost by 1.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.IsOwnerTurn(card)
- && CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition);
- }
- bool PermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
- && permanent.TopCard.EqualsTraits("ADVENTURE");
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.CanActivateSuspendCostEffect(card);
- }
- bool IsAdventureDigimon(CardSource cardSource, int reduction)
- {
- return cardSource.HasPlayCost
- && cardSource.EqualsTraits("ADVENTURE")
- && CardEffectCommons.CanPlayAsNewPermanent(cardSource, true, activateClass, fixedCost: Math.Max(0, cardSource.GetCostItself - reduction));
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SuspendPeremanentAndProcessAccordingToResult(
- new List<Permanent>() { card.PermanentOfThisCard() },
- activateClass,
- SuccessProcess,
- null));
- IEnumerator SuccessProcess(List<Permanent> suspendedPermaments)
- {
- List<CardSource> tamerCards = new List<CardSource>();
- foreach (Permanent permanent in card.Owner.GetBattleAreaPermanents())
- {
- if (permanent.IsTamer)
- {
- tamerCards.Add(permanent.TopCard);
- }
- }
- int reduceCost = Combinations.GetDifferenetColorCardCount(tamerCards) / 2;
- if (CardEffectCommons.HasMatchConditionOwnersHand(card, cardSource => IsAdventureDigimon(cardSource, reduceCost)))
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
- canTargetCondition: cardSource => IsAdventureDigimon(cardSource, reduceCost),
- SelectCardEffect.Root.Hand,
- activateClass,
- payCost: true,
- reduceCostTuple: (reduceCost, null)
- ));
- }
- }
- }
- }
- #endregion
- #region Security
- if (timing == EffectTiming.SecuritySkill)
- {
- cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|