using System; using System.Collections; using System.Collections.Generic; using System.Linq; // SkullSeadramon namespace DCGO.CardEffects.BT24 { public class BT24_074 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.IsLevel4 && (targetPermanent.TopCard.HasTSTraits || targetPermanent.TopCard.HasAquaTraits); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Shared OP/WD string SharedEffectName() => "Trash 3 sources, if by effect, delete 1 sourceless."; string SharedEffectDescription(string tag) => $"[{tag}] Trash any 3 digivolution cards from 1 of your opponent's Digimon. Then, if played by effects, delete 1 of your opponent's Digimon with no digivolution cards."; bool SharedCanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool CanSelectNoSourcePermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.HasNoDigivolutionCards; } IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { bool CanSelectCardCondition(CardSource cardSource) { return !cardSource.CanNotTrashFromDigivolutionCards(activateClass); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1; } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards( permanentCondition: CanSelectPermanentCondition, cardCondition: CanSelectCardCondition, maxCount: 3, canNoTrash: false, isFromOnly1Permanent: true, activateClass: activateClass )); } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectNoSourcePermanentCondition) && CardEffectCommons.IsByEffect(hashtable, null) && CardEffectCommons.CanTriggerOnPlay(hashtable, card)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectNoSourcePermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } #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 On Deletion if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("You may play 1 level 4 or lower Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[On Deletion] You may play 1 level 4 or lower Digimon card with [Seadramon] in it's name or the [TS] trait from your trash without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass); } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsDigimon && (cardSource.EqualsTraits("TS") || cardSource.ContainsCardName("Seadramon")) && cardSource.HasLevel && cardSource.Level <= 4 && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.CanActivateOnDeletion(card, activateClass) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition); } IEnumerator ActivateCoroutine(Hashtable hashtable) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectCardCondition)); List selectedCards = new List(); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 Digimon card to play.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 Digimon card to play.", "The opponent is selecting 1 Digimon card to play."); selectCardEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards( cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true)); } } #endregion #region When Attacking - ESS if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Place 1 of your other Digimon as this Digimon's bottom digivolution card to unsuspend this Digimon.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("Attacking_BT24_074"); cardEffects.Add(activateClass); string EffectDescription() { return "[When Attacking] [Once Per Turn] By placing 1 of your other Digimon as this Digimon's bottom digivolution card, it unsuspends."; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent != card.PermanentOfThisCard() && !permanent.TopCard.Equals(card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && !card.PermanentOfThisCard().IsToken && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition); } IEnumerator ActivateCoroutine(Hashtable hashtable) { List selectedCards = new List(); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage( "Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedCards.Add(permanent.TopCard); yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards( new List() { new Permanent[] { permanent, card.PermanentOfThisCard() } }, false, activateClass).PlacePermanentToDigivolutionCards()); } if (selectedCards.Count >= 1) { yield return ContinuousController.instance.StartCoroutine( new IUnsuspendPermanents(new List() { card.PermanentOfThisCard() }, activateClass).Unsuspend()); } } } #endregion return cardEffects; } } }