using System; using System.Collections; using System.Collections.Generic; using System.Linq; // Whamon namespace DCGO.CardEffects.BT23 { public class BT23_023 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternative Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasCSTraits && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel4; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region AT Shared IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass, bool IsTopCard) { bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 4 && (cardSource.HasCSTraits || cardSource.HasCardColor(CardColor.Blue)) && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass); } Permanent thisPermament = null; if (IsTopCard) thisPermament = card.PermanentOfThisCard(); else thisPermament = card.PermanentOfThisCard().TopCard.PermanentOfThisCard(); if (thisPermament.StackCards.Exists(CanSelectCardCondition)) { CardSource selectedCard = null; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); int maxCount = Math.Min(1, thisPermament.StackCards.Count(CanSelectCardCondition)); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 digivolution card to play.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: thisPermament.DigivolutionCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play."); selectCardEffect.SetUpCustomMessage_ShowCard("Selected Card"); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards( cardSources: new List() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true) ); } } #endregion #region All Turns - OPT if (timing == EffectTiming.WhenRemoveField) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 level 4 or lower Blue or [CS] digimon from sources", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass, true), 1, true, EffectDiscription()); activateClass.SetHashString("BT23-023_AT"); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When this Digimon would leave the battle area other than by your effects, you may play 1 level 4 or lower blue or [CS] trait Digimon card from its digivolution cards without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } } #endregion #region ESS - All Turns - OPT if (timing == EffectTiming.WhenRemoveField) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 level 4 or lower Blue or [CS] digimon from sources", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass, false), 1, true, EffectDiscription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("BT23-023_ESS_AT"); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When this Digimon would leave the battle area other than by your effects, you may play 1 level 4 or lower blue or [CS] trait Digimon card from its digivolution cards without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnField(card) && CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, ThisPermamentCondition); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnField(card); } bool ThisPermamentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.StackCards.Contains(card); } } #endregion return cardEffects; } } }