using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.EX7 { public class EX7_058 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.CardNames.Contains("LadyDevimon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Shared On Play/When Digivolving bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool CanActivateSecondEffectCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("LadyDevimon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1) { return true; } } return false; } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Give effects to opponent's Digimon and play a Token", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] 1 of your opponent's Digimon gains \"[End of Attack] Delete this Digimon.\" until the end of their turn. Then, if this Digimon has [LadyDevimon]/[X Antibody] in its digivolution cards, you may play 1 [Volée & Zerdrücken] Token (Digimon/Lv.4/Purple/5000 DP//)."; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) return CardEffectCommons.CanTriggerOnPlay(hashtable, card); return false; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { 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 [End of Attack] Delete this Digimon.", "The opponent is selecting 1 Digimon that will get [End of Attack] Delete this Digimon."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { if (permanent != null) { yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateDebuffEffect(permanent)); ActivateClass activateClass1 = new ActivateClass(); activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition1, permanent.TopCard); activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1()); activateClass1.SetEffectSourcePermanent(permanent); permanent.UntilOwnerTurnEndEffects.Add(GetCardEffect); if (!permanent.TopCard.CanNotBeAffected(activateClass)) { yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateDebuffEffect(permanent)); } string EffectDiscription1() { return "[End of Attack] Delete this Digimon."; } bool CanUseCondition1(Hashtable hashtable1) { if (CardEffectCommons.IsOpponentTurn(card)) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, permanent.TopCard)) { if (CardEffectCommons.CanTriggerOnEndAttack(hashtable1, permanent.TopCard)) { return true; } } } return false; } bool CanActivateCondition1(Hashtable hashtable1) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { if (!permanent.TopCard.CanNotBeAffected(activateClass)) { return true; } } return false; } IEnumerator ActivateCoroutine1(Hashtable _hashtable1) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass( new List() { permanent }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy()); } } ICardEffect GetCardEffect(EffectTiming _timing) { if (_timing == EffectTiming.OnEndAttack) { return activateClass1; } return null; } } } } if (CanActivateSecondEffectCondition(hashtable)) { List> selectionElements = new List>() { new SelectionElement(message: $"Play Token", value : true, spriteIndex: 0), new SelectionElement(message: $"Not Play Token", value : false, spriteIndex: 1), }; string selectPlayerMessage = "Will you play a token?"; string notSelectPlayerMessage = "The opponent is choosing to play a token."; GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool canPlay = GManager.instance.userSelectionManager.SelectedBoolValue; if (canPlay) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayVoleeZerdrucken(activateClass)); } } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Give effects to opponent's Digimon and play a Token", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] 1 of your opponent's Digimon gains \" Delete this Digimon.\" until the end of their turn. Then, if this Digimon has [LadyDevimon]/[X Antibody] in its digivolution cards, you may play 1 [Volée & Zerdrücken] Token (Digimon/Lv.4/Purple/5000 DP//)."; } bool CanUseCondition(Hashtable hashtable) { if(CardEffectCommons.IsExistOnBattleAreaDigimon(card)) return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); return false; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { 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 [End of Attack] Delete this Digimon.", "The opponent is selecting 1 Digimon that will get [End of Attack] Delete this Digimon."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { if (permanent != null) { yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateDebuffEffect(permanent)); ActivateClass activateClass1 = new ActivateClass(); activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition1, permanent.TopCard); activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1()); activateClass1.SetEffectSourcePermanent(permanent); permanent.UntilOwnerTurnEndEffects.Add(GetCardEffect); if (!permanent.TopCard.CanNotBeAffected(activateClass)) { yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateDebuffEffect(permanent)); } string EffectDiscription1() { return "[End of Attack] Delete this Digimon."; } bool CanUseCondition1(Hashtable hashtable1) { if (CardEffectCommons.IsOpponentTurn(card)) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, permanent.TopCard)) { if (CardEffectCommons.CanTriggerOnEndAttack(hashtable1, permanent.TopCard)) { return true; } } } return false; } bool CanActivateCondition1(Hashtable hashtable1) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { if (!permanent.TopCard.CanNotBeAffected(activateClass)) { return true; } } return false; } IEnumerator ActivateCoroutine1(Hashtable _hashtable1) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass( new List() { permanent }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy()); } } ICardEffect GetCardEffect(EffectTiming _timing) { if (_timing == EffectTiming.OnEndAttack) { return activateClass1; } return null; } } } } if (CanActivateSecondEffectCondition(hashtable)) { List> selectionElements = new List>() { new SelectionElement(message: $"Play Token", value : true, spriteIndex: 0), new SelectionElement(message: $"Not Play Token", value : false, spriteIndex: 1), }; string selectPlayerMessage = "Will you play a token?"; string notSelectPlayerMessage = "The opponent is choosing to play a token."; GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool canPlay = GManager.instance.userSelectionManager.SelectedBoolValue; if(canPlay) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayVoleeZerdrucken(activateClass)); } } } #endregion #region Inherit if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 level 4 or lower purple Digimon from your trash", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("PlayLevel4_EX7_058"); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[Opponent's Turn] [Once per turn] When an opponent's Digimon is deleted, you may play 1 purple level 4 or lower Digimon card from your trash without paying the cost."; } bool CanSelectCardInTrash(CardSource cardSource) { if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass)) { if (cardSource.HasCardColor(CardColor.Purple)) { if (cardSource.IsDigimon) { if (cardSource.Level <= 4) { if (cardSource.HasLevel) { return true; } } } } } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.IsOpponentTurn(card)) { if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition)) { return true; } } } return false; } bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.IsDigimon) { return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardInTrash(cardSource))) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardInTrash)) { int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardInTrash)); List selectedCards = new List(); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardInTrash, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to play.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectCardEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards( cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true)); } } } #endregion return cardEffects; } } }