using System; using System.Collections; using System.Collections.Generic; // MetalGarurumon namespace DCGO.CardEffects.BT22 { public class BT22_026 : 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.HasLevel && targetPermanent.TopCard.IsLevel5 && (targetPermanent.TopCard.ContainsCardName("Garurumon") || targetPermanent.TopCard.HasCSTraits); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Hand Main if (timing == EffectTiming.OnDeclaration) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolve 1 [Gabumon] into this card for 6", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Hand] [Main] If you have [Nokia Shiramine], 1 of your [Gabumon] digivolves into this card for a digivolution cost of 6, ignoring digivolution requirements."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnHand(card) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsNokiaShiramine) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsGabumon); } bool IsNokiaShiramine(Permanent permanent) { return permanent.IsTamer && permanent.TopCard.EqualsCardName("Nokia Shiramine"); } bool IsGabumon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.EqualsCardName("Gabumon") && card.CanPlayCardTargetFrame(permanent.PermanentFrame, true, activateClass, fixedCost: 6, ignore: CardEffectCommons.IgnoreRequirement.All); } bool IsMetalGarurumon(CardSource cardSource) { return cardSource == card; } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsNokiaShiramine)) { Permanent gabumon = null; #region Select Gabumon Permanent SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: IsGabumon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); IEnumerator SelectPermanentCoroutine(Permanent permanent) { gabumon = permanent; yield return null; } selectPermanentEffect.SetUpCustomMessage("Select 1 [Gabumon] to digivolve", "The opponent is selecting 1 [Gabumon] to digivolve."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); #endregion if (gabumon != null) { #region Digivolve into MetalGarurumon yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( gabumon, IsMetalGarurumon, payCost: true, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: 6, isHand: true, activateClass: activateClass, successProcess: null, failedProcess: OnFail(), isOptional: false, ignoreRequirements: CardEffectCommons.IgnoreRequirement.All)); IEnumerator OnFail() { yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(card)); } #endregion } } } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolve 1 [Agumon] into [WarGreymon], or bounce lowest level digimon to hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] Activate 1 of the effects below: 1 of your [Agumon] may digivolve into [WarGreymon] in the hand, ignoring digivolution requirements and without paying the cost. or Return 1 of your opponent's Digimon with the lowest level to the hand."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool IsAgumon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.EqualsCardName("Agumon"); } bool IsWarGreymon(CardSource cardSource) { return CardEffectCommons.IsExistOnHand(cardSource) && cardSource.EqualsCardName("WarGreymon"); } bool CanSelectOpponentDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && CardEffectCommons.IsMinLevel(permanent, card.Owner.Enemy); } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool canDigivolve = CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsAgumon) && CardEffectCommons.HasMatchConditionOwnersHand(card, IsWarGreymon); bool canBounce = CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentDigimon); #region Option Selection if (canBounce || canDigivolve) { List> selectionElements = new List>() { new(message: "Return 1 of your opponent's Digimon with the lowest level to the hand.", value: 0, spriteIndex: 0), new(message: "1 of your [Agumon] may digivolve into [WarGreymon] in the hand, ignoring digivolution requirements and without paying the cost.", value: 1, spriteIndex: 0), }; string selectPlayerMessage = "Which effect will you activate?"; string notSelectPlayerMessage = "The opponent is choosing which effect to activate."; GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); int actionID = GManager.instance.userSelectionManager.SelectedIntValue; #region Bounce digimon to hand if (actionID == 0 && canBounce) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentDigimon)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectOpponentDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Bounce, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to bounce to hand.", "The opponent is selecting a digimon to bounce to hand.."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } #endregion #region Digivolve if (actionID == 1 && canDigivolve) { Permanent agumon = null; int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsAgumon)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: IsAgumon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 [Agumon] to digivolve.", "The opponent is selecting 1 [Agumon] to digivolve."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { agumon = permanent; yield return null; } if (agumon != null) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( targetPermanent: agumon, cardCondition: IsWarGreymon, payCost: false, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: -1, isHand: true, activateClass: activateClass, successProcess: null, ignoreRequirements: CardEffectCommons.IgnoreRequirement.All)); } } #endregion } #endregion } } #endregion #region When Attacking if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Unsuspend this digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription()); activateClass.SetHashString("BT22_026_Unsuspend"); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Attacking] [Once Per Turn] If this Digimon has [Omnimon] in its name, it unsuspends."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && card.PermanentOfThisCard().TopCard.ContainsCardName("Omnimon"); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard())) yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List() { card.PermanentOfThisCard() }, activateClass).Unsuspend()); } } #endregion return cardEffects; } } }