using System; using System.Collections; using System.Collections.Generic; using System.Linq; // Phascomon namespace DCGO.CardEffects.P { public class P_201 : 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.IsLevel2 && targetPermanent.TopCard.EqualsCardName("Kapurimon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region OP/OD Shared bool CanSelectCardCondition(CardSource cardSource) { return cardSource.HasText("Belphemon") || cardSource.HasText("Gizmon"); } IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect( revealCount: 3, simplifiedSelectCardConditions: new SimplifiedSelectCardConditionClass[] { new SimplifiedSelectCardConditionClass( canTargetCondition:CanSelectCardCondition, message: "Select 1 card with [Belphemon] or [Gizmon] in its text.", mode: SelectCardEffect.Mode.AddHand, maxCount: 1, selectCardCoroutine: null) }, remainingCardsPlace: RemainingCardsPlace.DeckBottom, activateClass: activateClass )); if (card.Owner.HandCards.Any()) { SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: _ => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: null, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Discard, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 card in your hand to trash.", "The opponent is selecting 1 card to trash."); selectHandEffect.SetUpCustomMessage_ShowCard("Selected card."); yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate()); } } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Reveal top 3, then trash 1 from hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with [Belphemon] or [Gizmon] in its text among them to the hand. Return the rest to the bottom of the deck. Then, trash 1 card in your hand."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } } #endregion #region On Deletion if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Reveal top 3, then trash 1 from hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Deletion] Reveal the top 3 cards of your deck. Add 1 card with [Belphemon] or [Gizmon] in its text among them to the hand. Return the rest to the bottom of the deck. Then, trash 1 card in your hand."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.CanActivateOnDeletion(card, activateClass); } } #endregion #region EOOT - OPT if (timing == EffectTiming.OnEndTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("By trashing 1 card, suspend 1 digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("P_201_EOT"); cardEffects.Add(activateClass); string EffectDiscription() { return "[End of Opponent's Turn] [Once Per Turn] By trashing 1 card in your hand, suspend 1 of your opponent's Digimon."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && card.Owner.HandCards.Count > 0 && CardEffectCommons.IsOpponentTurn(card); } bool CanSelectPermament(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool trashed = false; if (card.Owner.HandCards.Any()) { SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: _ => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine, mode: SelectHandEffect.Mode.Discard, cardEffect: activateClass); IEnumerator AfterSelectCardCoroutine(List cardSources) { if (cardSources.Any()) trashed = true; yield return null; } selectHandEffect.SetUpCustomMessage("Select 1 card in your hand to trash.", "The opponent is selecting 1 card to trash."); selectHandEffect.SetUpCustomMessage_ShowCard("Selected card."); yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate()); } if (trashed && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermament)) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermament)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermament, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Tap, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 of your opponent's Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } #endregion return cardEffects; } } }