using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.BT21 { public class BT21_024 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Shared OP / WD string SharedEffectName = "Opponent places 1 card from hand in security bottom. Trash their security top"; string SharedEffectDescription(string tag) => $"[{tag}] If your opponent has 5 or fewer security cards, they place 1 card from their hand as the bottom security card. Then, trash their top security card."; bool CanSelectCardCondition(CardSource cardSource) => true; bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card); IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { CardSource selectedCard = null; if (card.Owner.Enemy.SecurityCards.Count <= 5 && card.Owner.Enemy.HandCards.Count() >= 1) { int maxCount = 1; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner.Enemy, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, isShowOpponent: false, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage( "Select 1 card to place at the bottom of security.", "The opponent is selecting 1 card to place at the bottom of security."); selectHandEffect.SetNotShowCard(); yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } } if (selectedCard != null) { yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(selectedCard, toTop: false)); } yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity( player: card.Owner.Enemy, destroySecurityCount: 1, cardEffect: activateClass, fromTop: true).DestroySecurity()); } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play")); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnPlay(hashtable, card); } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Digivolving")); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } } #endregion #region Your Turn Inherited if (timing == EffectTiming.None) { bool Condition() { return CardEffectCommons.IsOwnerTurn(card); } cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect( changeValue: 4000, isInheritedEffect: true, card: card, condition: Condition)); } #endregion return cardEffects; } } }