using System; using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.EX4 { public class EX4_047 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Your 1 Digimon gains Blocker and De-Digivolve 1 on 1 Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Until the end of your opponent's turn, 1 of your Digimon gains . If DigiXrosing, 1 of your opponent's Digimon."; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool CanSelectPermanentCondition1(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (isExistOnField(card)) { if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard())) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { return true; } if (hashtable != null) { if (hashtable.ContainsKey("DigiXrosCount")) { if (hashtable["DigiXrosCount"] is int) { int DigiXrosCount = (int)hashtable["DigiXrosCount"]; if (DigiXrosCount >= 1) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1)) { return true; } } } } } } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (isExistOnField(card)) { if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard())) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { 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: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Blocker.", "The opponent is selecting 1 Digimon that will get Blocker."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass)); } } if (_hashtable != null) { if (_hashtable.ContainsKey("DigiXrosCount")) { if (_hashtable["DigiXrosCount"] is int) { int DigiXrosCount = (int)_hashtable["DigiXrosCount"]; if (DigiXrosCount >= 1) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1)) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition1, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: CanEndSelectCondition, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); bool CanEndSelectCondition(List permanents) { if (permanents.Count <= 0) { return false; } return true; } IEnumerator SelectPermanentCoroutine(Permanent permanent) { Permanent selectedPermanent = permanent; if (selectedPermanent != null) { yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration()); } yield return null; } } } } } } } } } } if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Reveal the top 2 cards of deck", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Deletion] Reveal the top 2 cards of your deck. Add 1 card with the [Blue Flare] or [Twilight] trait among them to your hand. Trash the rest."; } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.CardTraits.Contains("Blue Flare") || cardSource.CardTraits.Contains("BlueFlare")) { return true; } if (cardSource.CardTraits.Contains("Twilight")) { return true; } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnTrash(card)) { if (card.Owner.LibraryCards.Count >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect( revealCount: 2, simplifiedSelectCardConditions: new SimplifiedSelectCardConditionClass[] { new SimplifiedSelectCardConditionClass( canTargetCondition:CanSelectCardCondition, message: "Select 1 card with the [Blue Flare] or [Twilight] trait.", mode: SelectCardEffect.Mode.AddHand, maxCount: 1, selectCardCoroutine: null), }, remainingCardsPlace: RemainingCardsPlace.Trash, activateClass: activateClass )); } } if (timing == EffectTiming.None) { AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass(); addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card); addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros); addDigiXrosConditionClass.SetNotShowUI(true); cardEffects.Add(addDigiXrosConditionClass); bool CanUseCondition(Hashtable hashtable) { return true; } DigiXrosCondition GetDigiXros(CardSource cardSource) { if (cardSource == card) { DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "SkullKnightmon"); bool CanSelectCardCondition(CardSource cardSource) { if (cardSource != null) { if (cardSource.Owner == card.Owner) { if (cardSource.IsDigimon) { if (cardSource.CardNames_DigiXros.Contains("SkullKnightmon")) { return true; } } } } return false; } DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "DeadlyAxemon"); bool CanSelectCardCondition1(CardSource cardSource) { if (cardSource != null) { if (cardSource.Owner == card.Owner) { if (cardSource.IsDigimon) { if (cardSource.CardNames_DigiXros.Contains("DeadlyAxemon")) { return true; } } } } return false; } List elements = new List() { element, element1 }; DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2); return digiXrosCondition; } return null; } } if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Switch attack target to this Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("Switch_EX4_047"); cardEffects.Add(activateClass); string EffectDiscription() { return "[Opponent's Turn][Once Per Turn] When an opponent's Digimon attacks, if this Digimon is [GreyKnightsmon], you may switch the target of attack to this Digimon. "; } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsOpponentPermanent(permanent, card); } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOpponentTurn(card)) { if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition)) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.PermanentOfThisCard().TopCard.CardNames.Contains("GreyKnightsmon")) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender( activateClass, false, card.PermanentOfThisCard())); } } } return cardEffects; } } }