using System; using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.BT17 { public class BT17_029 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region When Attacking if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend one tamer to draw", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Attacking] By suspending 1 of your yellow Tamers, ."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)) { if (permanent.IsTamer && permanent.TopCard.CardColors.Contains(CardColor.Yellow)) { 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) { Permanent selectedPermanent = null; if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Yellow Tamer to suspend.", "The opponent is selecting 1 to suspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } } if (selectedPermanent != null) { if (selectedPermanent.TopCard != null) { if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass)) { if (!selectedPermanent.IsSuspended && selectedPermanent.CanSuspend) { Permanent suspendTargetPermanent = selectedPermanent; yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List() { suspendTargetPermanent }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap()); if (suspendTargetPermanent.TopCard != null) { if (suspendTargetPermanent.IsSuspended) { yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw()); } } } } } } } } #endregion #region Inherit if (timing == EffectTiming.None) { bool CardCondition(CardSource cardSource) { return cardSource.Owner == card.Owner.Enemy; } bool Condition() { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { return true; } } return false; } cardEffects.Add(CardEffectFactory.ChangeSecurityDigimonCardDPStaticEffect( cardCondition: CardCondition, changeValue: -3000, isInheritedEffect: true, card: card, condition: Condition, effectName: "Opponent's Security Digimon gains DP -3000")); } #endregion return cardEffects; } } }