using System; using System.Collections; using System.Collections.Generic; using System.Linq; // GoldNumemon namespace DCGO.CardEffects.BT22 { public class BT22_031 : 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.IsLevel4 && targetPermanent.TopCard.ContainsCardName("Numemon") || targetPermanent.TopCard.IsLevel3 && targetPermanent.TopCard.HasCSTraits); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region OP/WD Shared bool SharedOpponentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool SharedIsPlatinumNumemon(CardSource cardSource) { return CardEffectCommons.IsExistOnHand(cardSource) && cardSource.EqualsCardName("PlatinumNumemon"); } IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedOpponentCondition)) { #region -2 Sec Attack Permanent selectedPermament = null; #region Select Permanent int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, SharedOpponentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: SharedOpponentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermament = permanent; yield return null; } selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to give -2 Sec Atk", "The opponent is selecting 1 Digimon to give -2 Sec Atk"); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); #endregion if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine( CardEffectCommons.ChangeDigimonSAttack(selectedPermament, -2, EffectDuration.UntilOpponentTurnEnd, activateClass)); #endregion } if (card.PermanentOfThisCard().StackCards .Filter(x => !x.IsFlipped) .GroupBy(x => x.Level) .Any(g => g.Count() >= 2) && CardEffectCommons.HasMatchConditionOwnersHand(card, SharedIsPlatinumNumemon)) { #region Digivolve into PlatinumNumemon yield return ContinuousController.instance.StartCoroutine( CardEffectCommons.DigivolveIntoHandOrTrashCard( targetPermanent: card.PermanentOfThisCard(), cardCondition: SharedIsPlatinumNumemon, payCost: true, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: 4, isHand: true, activateClass: activateClass, successProcess: null)); #endregion } } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Give 1 digimon -2 Sec Atk. then if sources has 2 same level digimon, digivolve into [PlatinumNumemon]", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Give 1 of your opponent's Digimon (This Digimon checks 2 additional security cards.) until their turn ends. Then, if this Digimon's stack has 2 or more same-level cards, this Digimon may digivolve into [PlatinumNumemon] in the hand for a digivolution cost of 4, ignoring digivolution requirements."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass)); } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Give 1 digimon -2 Sec Atk. then if sources has 2 same level digimon, digivolve into [PlatinumNumemon]", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] Give 1 of your opponent's Digimon (This Digimon checks 2 additional security cards.) until their turn ends. Then, if this Digimon's stack has 2 or more same-level cards, this Digimon may digivolve into [PlatinumNumemon] in the hand for a digivolution cost of 4, ignoring digivolution requirements."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass)); } } #endregion #region ESS ActivateClass activateClass2 = new ActivateClass(); activateClass2.SetUpICardEffect("Digivolution Cost -1", CanUseCondition2, card); activateClass2.SetUpActivateClass(CanActivateCondition2, ActivateCoroutine2, 1, false, EffectDiscription2()); activateClass2.SetIsInheritedEffect(true); activateClass2.SetNotShowUI(true); activateClass2.SetIsBackgroundProcess(true); activateClass2.SetHashString("BT22_031_ESS"); string EffectDiscription2() { return "[Your Turn] [Once Per Turn] When this Digimon would digivolve into a Digimon card with the [CS] trait, reduce the digivolution cost by 1."; } bool CanUseCondition2(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card)) { List evoRootTops = CardEffectCommons.GetEvoRootTopsFromEnterFieldHashtable( hashtable, permanent => permanent.cardSources.Contains(card)); if (evoRootTops != null) { if (!evoRootTops.Contains(card)) { if (card.PermanentOfThisCard().TopCard.HasCSTraits) { return true; } } } } } } return false; } bool CanActivateCondition2(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card); } IEnumerator ActivateCoroutine2(Hashtable _hashtable) { yield return null; } if (timing == EffectTiming.OnEnterFieldAnyone) { cardEffects.Add(activateClass2); } #region Setup Reduce Cost Class if (timing == EffectTiming.None) { ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect($"Digivolution Cost -1", CanUseCondition, card); changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true); changeCostClass.SetIsInheritedEffect(true); cardEffects.Add(changeCostClass); bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (!card.cEntity_EffectController.isOverMaxCountPerTurn(activateClass2, activateClass2.MaxCountPerTurn)) { return true; } } } return false; } int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List targetPermanents) { if (CardSourceCondition(cardSource)) { if (RootCondition(root)) { if (PermanentsCondition(targetPermanents)) { Cost -= 1; } } } return Cost; } bool PermanentsCondition(List targetPermanents) { if (targetPermanents != null) { if (targetPermanents.Count(PermanentCondition) >= 1) { return true; } } return false; } bool PermanentCondition(Permanent targetPermanent) { return targetPermanent == card.PermanentOfThisCard(); } bool CardSourceCondition(CardSource cardSource) { return cardSource.HasCSTraits; } bool RootCondition(SelectCardEffect.Root root) { return true; } bool isUpDown() { return true; } } #endregion #endregion return cardEffects; } } }