using System.Collections; using System.Collections.Generic; using System.Linq; using System; namespace DCGO.CardEffects.BT24 { public class BT24_102 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Start of your Main if (timing == EffectTiming.OnStartMainPhase) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Gain 1 Memory. If 5+ Memory, suspend and Draw 1.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Start of Your Main Phase] Gain 1 memory. Then, if you have 5 or more memory, suspend this Tamer and <Draw 1>."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOwnerTurn(card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass)); if (card.Owner.MemoryForPlayer >= 5) { yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap()); yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw()); } } } #endregion #region All turns if (timing == EffectTiming.None) { string EffectDiscription() { return "[All Turns] All of your [TS] trait Digimon get +1000 DP."; } bool Condition() { return CardEffectCommons.IsExistOnBattleArea(card); } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.HasTSTraits; } cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect( permanentCondition: PermanentCondition, changeValue: 1000, isInheritedEffect: false, card: card, condition: Condition, effectName: EffectDiscription)); } #endregion #region End of your turn if (timing == EffectTiming.OnEndTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend this tamer to use an On Play or When Digivolving", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[End of Your Turn] By suspending this Tamer, you may activate 1 [On Play] or [When Digivolving] effect of 1 of your [Olympos XII] trait Digimon."; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.EqualsTraits("Olympos XII") && permanent.EffectList(EffectTiming.OnEnterFieldAnyone).Any(CanBeEffectCandidate); } bool CanBeEffectCandidate(ICardEffect cardEffect) { if (cardEffect != null && cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect) { if (cardEffect.IsOnPlay) { Hashtable onPlayHashtable = CardEffectCommons.OnPlayCheckHashtableOfCard(cardEffect.EffectSourceCard); return cardEffect.CanUse(onPlayHashtable); } if (cardEffect.IsWhenDigivolving) { Hashtable digivolvingHashtable = CardEffectCommons.WhenDigivolvingCheckHashtableOfCard(cardEffect.EffectSourceCard); return cardEffect.CanUse(digivolvingHashtable); } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOwnerTurn(card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanActivateSuspendCostEffect(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap()); Permanent selectedPermanent = null; int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectCardCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 of your [Olympos XII] digimon to use their effect.", "Your opponent is selecting an effect to use."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectCardCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { List candidateEffects = selectedPermanent.EffectList(EffectTiming.OnEnterFieldAnyone) .Clone() .Filter(CanBeEffectCandidate); if (candidateEffects.Count >= 1) { ICardEffect selectedEffect = null; if (candidateEffects.Count == 1) { selectedEffect = candidateEffects[0]; } else { List skillInfos = new List(); foreach (ICardEffect effect in candidateEffects) { ICardEffect cardEffect = new ChangeBaseDPClass(); cardEffect.SetUpICardEffect((effect.IsOnPlay ? "On Play: " : "When Digivolving: ") + effect.EffectName, null, effect.EffectSourceCard); skillInfos.Add(new SkillInfo(cardEffect, null, EffectTiming.None)); } List cardSources = candidateEffects .Map(cardEffect => cardEffect.EffectSourceCard); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: (cardSource) => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: null, afterSelectCardCoroutine: null, message: "Select 1 effect to activate.", maxCount: 1, canEndNotMax: false, isShowOpponent: false, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: cardSources, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetNotShowCard(); selectCardEffect.SetUpSkillInfos(skillInfos); selectCardEffect.SetUpAfterSelectIndexCoroutine(AfterSelectIndexCoroutine); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); IEnumerator AfterSelectIndexCoroutine(List selectedIndexes) { if (selectedIndexes.Count == 1) { selectedEffect = candidateEffects[selectedIndexes[0]]; yield return null; } } } if (selectedEffect != null) { if (selectedEffect.EffectSourceCard != null) { if (selectedEffect.EffectSourceCard.PermanentOfThisCard() != null) { selectedEffect.SetIsDigimonEffect(true); Hashtable onPlayHashtable = CardEffectCommons.OnPlayCheckHashtableOfCard(selectedEffect.EffectSourceCard); Hashtable digivolvingHashtable = CardEffectCommons.WhenDigivolvingCheckHashtableOfCard(selectedEffect.EffectSourceCard); if (selectedEffect.CanUse(digivolvingHashtable)) { yield return ContinuousController.instance.StartCoroutine(((ActivateICardEffect)selectedEffect).Activate_Optional_Effect_Execute(digivolvingHashtable)); } else if (selectedEffect.CanUse(onPlayHashtable)) { yield return ContinuousController.instance.StartCoroutine(((ActivateICardEffect)selectedEffect).Activate_Optional_Effect_Execute(onPlayHashtable)); } } } } } } } } #endregion #region Security if (timing == EffectTiming.SecuritySkill) { cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card)); } #endregion return cardEffects; } } }