using System.Collections; using System.Collections.Generic; using System.Linq; using System; // Lamiamon namespace DCGO.CardEffects.BT24 { public class BT24_016 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Hand Main if (timing == EffectTiming.OnDeclaration) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Place 1 [Dimetromon] from trash under 1 [Elizamon], to digivolve for 3", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[Hand] [Main] If you have [Owen Dreadnought], by placing 1 [Dimetromon] from your trash as any of your [Elizamon]'s bottom digivolution card, it digivolves into this card for a digivolution cost of 3, ignoring digivolution requirements."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnHand(card) && CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwen) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsElizamon) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsDimetromon); } bool IsOwen(Permanent permanent) { return permanent.IsTamer && permanent.TopCard.EqualsCardName("Owen Dreadnought"); } bool IsElizamon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.EqualsCardName("Elizamon"); } bool IsDimetromon(CardSource source) { return source.IsDigimon && source.EqualsCardName("Dimetromon"); } bool IsLamiamon(CardSource cardSource) { return CardEffectCommons.IsExistOnHand(cardSource) && cardSource == card; } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwen)) { Permanent Elizamon = null; CardSource Dimetromon = null; #region Select Dimetromon From Trash int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, IsDimetromon)); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: IsDimetromon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 [Dimetromon] to add as digivolution source", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); IEnumerator SelectCardCoroutine(CardSource cardSource) { Dimetromon = cardSource; yield return null; } selectCardEffect.SetUpCustomMessage("Select 1 [Dimetromon] to add as digivolution source.", "The opponent is selecting 1 [Dimetromon] to add as digivolution source."); yield return StartCoroutine(selectCardEffect.Activate()); #endregion if (Dimetromon != null) { #region Select Elizamon Permanent int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, IsElizamon)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: IsElizamon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); IEnumerator SelectPermanentCoroutine(Permanent permanent) { Elizamon = permanent; yield return null; } selectPermanentEffect.SetUpCustomMessage("Select 1 [Elizamon] to add digivolution sources.", "The opponent is selecting 1 [Elizamon] to add digivolution sources."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); #endregion if (Elizamon != null) { yield return ContinuousController.instance.StartCoroutine(Elizamon.AddDigivolutionCardsBottom(new List() { Dimetromon }, activateClass)); if (Elizamon.DigivolutionCards.Contains(Dimetromon)) { #region Digivolve into Lamiamon yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( Elizamon, IsLamiamon, payCost: true, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: 3, isHand: true, activateClass: activateClass, successProcess: null, ignoreSelection: true, failedProcess: FailureProcess())); #endregion } IEnumerator FailureProcess() { List discardHands = new List() { new IDiscardHand(card, null) }; yield return ContinuousController.instance.StartCoroutine(new IDiscardHands(discardHands, null).DiscardHands()); } } } } } } #endregion #region Shared WD/WA IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { bool CanSelectCardCondition(CardSource cardSource) { return true; } CardSource selectedCard = null; if (card.Owner.Enemy.HandCards.Count() >= 1 && card.Owner.CanAddSecurity(activateClass)) { 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."); 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()); } string SharedEffectDescription(string tag) { return $"[{tag}] [Once Per Turn] Your opponent places 1 card from their hand as the bottom security card. Then, trash their top security card."; } bool SharedCanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } #endregion #region When Attacking if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Opponent places 1 card from hand in security bottom. Trash their security top", CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("When Attacking")); activateClass.SetHashString("WAWD_BT24-016"); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnAttack(hashtable, card); } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Opponent places 1 card from hand in security bottom. Trash their security top", CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("When Digivolving")); activateClass.SetHashString("WAWD_BT24-016"); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } } #endregion #region All Turns - ESS if (timing == EffectTiming.OnLoseSecurity) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 [Reptile] or [Dragonkin] from hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("PlayDigimon_BT24_016"); cardEffects.Add(activateClass); string EffectDescription() => "[All Turns] [Once Per Turn] When your opponent's security stack is removed from, you may play 1 5000 DP or lower [Reptile] or [Dragonkin] trait Digimon card from your hand without paying the cost."; bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, PlayerCondition)) { if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition)) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { return true; } return false; } bool PlayerCondition(Player player) { if (player == card.Owner.Enemy) { return true; } return false; } bool CanSelectCardCondition(CardSource source) { if (source.IsDigimon) { if (source.EqualsTraits("Reptile") || source.EqualsTraits("Dragonkin")) { if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: source, payCost: false, cardEffect: activateClass)) { if (source.CardDP <= 5000) { return true; } } } } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { CardSource selectedCard = null; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectHandEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectHandEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } if (selectedCard != null) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true)); } } } #endregion return cardEffects; } } }