using System.Collections; using System.Collections.Generic; using System; // Dalphomon namespace DCGO.CardEffects.EX11 { public class EX11_036 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alt Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.HasText("Maquinamon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Vortex if (timing == EffectTiming.OnEndTurn) { cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region Shared OP / WD /WA string SharedHashString = "EX11_036_OP_WD_WA"; string SharedEffectName = "Suspend 2 Opponent's digimon or Tamers. 1 of their Digimon or Tamers can't unsuspend"; string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] Suspend 2 of your opponent's Digimon or Tamers. Then, 1 of their Digimon or Tamers can't unsuspend until their turn ends."; bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card); bool SharedCanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) && (permanent.IsDigimon || permanent.IsTamer); } IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedCanSelectPermanentCondition)) { int maxCount = Math.Min(2, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, SharedCanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent(); selectPermanentEffect1.SetUp( selectPlayer: card.Owner, canTargetCondition: SharedCanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Tap, cardEffect: activateClass); selectPermanentEffect1.SetUpCustomMessage($"Select {maxCount} Digimon or Tamers to Suspend.", $"The opponent is selecting {maxCount} Digimon or Tamers to Suspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate()); SelectPermanentEffect selectPermanentEffect2 = GManager.instance.GetComponent(); selectPermanentEffect2 = GManager.instance.GetComponent(); selectPermanentEffect2.SetUp( selectPlayer: card.Owner, canTargetCondition: SharedCanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect2.SetUpCustomMessage("Select 1 Digimon or Tamer that can't unsuspend.", "The opponent is selecting 1 Digimon or Tamer that can't unsuspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect2.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd( targetPermanent: permanent, activateClass: activateClass )); } } } #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")); activateClass.SetHashString(SharedHashString); 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")); activateClass.SetHashString(SharedHashString); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } } #endregion #region When Attacking if(timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card); activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("When Attacking")); activateClass.SetHashString(SharedHashString); cardEffects.Add(activateClass); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnAttack(hashtable, card); } } #endregion #region End of Your Turn if (timing == EffectTiming.OnEndTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("1 other digimon may digivolve into a black card w/[Maquinamon] in text for free", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription()); activateClass.SetHashString("EX11_036_EOYT"); cardEffects.Add(activateClass); string EffectDescription() => "[End of Your Turn] [Once Per Turn] 1 of your other Digimon may digivolve into a black Digimon card with [Maquinamon] in its text in the hand without paying the cost."; bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanDigivolvePermanentCondition); } bool CanDigivolvePermanentCondition(Permanent permanent) { return permanent != card.PermanentOfThisCard() && CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) && CardEffectCommons.HasMatchConditionOwnersHand(card, cardSource => CanDigivolveCardCondition(cardSource, permanent)); } bool CanDigivolveCardCondition(CardSource cardSource, Permanent permanent) { return CanSelectCardCondition(cardSource) && cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass); } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.HasText("Maquinamon") && cardSource.HasCardColor(CardColor.Black); } IEnumerator ActivateCoroutine(Hashtable hashtable) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanDigivolvePermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve.", "Opponent is selecting a Digimon to digivolve."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( targetPermanent: permanent, cardCondition: CanSelectCardCondition, payCost: false, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: -1, isHand: true, activateClass: activateClass, successProcess: null )); } } } #endregion #region Assembly if (timing == EffectTiming.None) { AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass(); addAssemblyConditionClass.SetUpICardEffect($"Assembly", CanUseCondition, card); addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly); addAssemblyConditionClass.SetNotShowUI(true); cardEffects.Add(addAssemblyConditionClass); bool CanUseCondition(Hashtable hashtable) { return true; } AssemblyCondition GetAssembly(CardSource cardSource) { if (cardSource == card) { AssemblyConditionElement element = new AssemblyConditionElement(CanSelectCardCondition); bool CanSelectCardCondition(CardSource cardSource) { return cardSource != null && cardSource.Owner == card.Owner && cardSource.IsDigimon && cardSource.HasCardColor(CardColor.Green) && cardSource.HasText("Maquinamon"); } AssemblyCondition assemblyCondition = new AssemblyCondition( element: element, CanTargetCondition_ByPreSelecetedList: null, selectMessage: "5 Green Digimon cards with [Maquinamon] in text", elementCount: 5, reduceCost: 5); return assemblyCondition; } return null; } } #endregion #region ESS if (timing == EffectTiming.WhenLinked) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend 1 Digimon, then this may attack", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("EX11_036_YT_ESS"); cardEffects.Add(activateClass); string EffectDescription() => "[Your Turn] [Once Per Turn] When this Digimon gets linked, suspend 1 of your opponent's Digimon. Then, this Digimon may attack."; bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.CanTriggerWhenLinked(hashtable, PermanentCondition, null); } bool PermanentCondition(Permanent permanent) => permanent == card.PermanentOfThisCard(); bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool IsOpponentsDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon)) { SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent(); selectPermanentEffect1.SetUp( selectPlayer: card.Owner, canTargetCondition: IsOpponentsDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Tap, cardEffect: activateClass); selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon to Suspend.", "The opponent is selecting 1 Digimon to Suspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate()); } if (card.PermanentOfThisCard().CanAttack(activateClass)) { SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent(); selectAttackEffect.SetUp( attacker: card.PermanentOfThisCard(), canAttackPlayerCondition: () => true, defenderCondition: _ => true, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate()); } } } #endregion return cardEffects; } } }