using System; using System.Collections; using System.Collections.Generic; using System.Linq; // Alphamon namespace DCGO.CardEffects.BT22 { public class BT22_063 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Static Effects #region CS Alternative Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.HasCSTraits; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region Kyoko Kuremi Alternative Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Kyoko Kuremi"); } bool Condition() { return card.Owner.SecurityCards.Count <= 3; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 5, ignoreDigivolutionRequirement: false, card: card, condition: Condition) ); } #endregion #region Blocker if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region Reboot if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #endregion #region OP/WD/WA Shared string SharedEffectName = "-5K DP to 1 digimon"; string SharedEffectDescription(string tag) => $"[{tag}] 1 of your opponent's Digimon gets -5000 DP for the turn."; bool SharedOpponentDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { Permanent selectedPermanent = null; #region Select Permanent int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, SharedOpponentDigimon)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: SharedOpponentDigimon, 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) { selectedPermanent = permanent; yield return null; } selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to get -5K DP", "The opponent is selecting 1 Digimon to get -5K DP"); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); #endregion if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine( CardEffectCommons.ChangeDigimonDP(selectedPermanent, -5000, EffectDuration.UntilEachTurnEnd, activateClass)); } CardEffectFactory.ActivateClassesForSharedEffects (ref cardEffects, timing, card, SharedEffectName, SharedActivateCoroutine, SharedEffectDescription, optional: false, onPlay: true, whenDigivolving: true, whenAttacking: true); #endregion #region All Turns if (timing == EffectTiming.OnTappedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Gain 3K DP & Unsuspend", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription()); activateClass.SetHashString("BT22_063_UnSuspend"); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When this Digimon suspends, if [Kyoko Kuremi] is in this Digimon's digivolution cards or if this Digimon's stack has 2 or more same-level cards, it gets +3000 DP until your opponent's turn ends. Then, this Digimon unsuspends."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass) && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, IsAlphamon); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass); } bool IsAlphamon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent == card.PermanentOfThisCard(); } bool HasSourceCondition() { Permanent permanent = card.PermanentOfThisCard(); if (permanent.DigivolutionCards.Filter(x => x.EqualsCardName("Kyoko Kuremi")).Count >= 1) return true; if (permanent.StackCards.Filter(x => !x.IsFlipped).GroupBy(x => x.Level).Any(y => y.Count() >= 2)) return true; return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (HasSourceCondition()) { yield return ContinuousController.instance.StartCoroutine( CardEffectCommons.ChangeDigimonDP(card.PermanentOfThisCard(), 3000, EffectDuration.UntilOpponentTurnEnd, activateClass)); } yield return ContinuousController.instance.StartCoroutine( new IUnsuspendPermanents(new List() { card.PermanentOfThisCard() }, activateClass).Unsuspend()); } } #endregion return cardEffects; } } }