using System; using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.EX6 { public class EX6_041 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete 1 [Diaboromon], Digivolve into a [Diaboromon]", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] By deleting 1 of your Digimon with [Diaboromon] in its name, this Digimon may digivolve into [Diaboromon] in your hand without paying the cost."; } bool HasDiaboromonInNameField(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)) { if (permanent.TopCard.ContainsCardName("Diaboromon")) { return true; } } return false; } bool IsDiaboromon(CardSource cardSource) { return cardSource.EqualsCardName("Diaboromon"); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { return CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasDiaboromonInNameField); } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool deleted = false; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: HasDiaboromonInNameField, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null)); IEnumerator SuccessProcess() { deleted = true; yield return null; } } if (deleted) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( targetPermanent: card.PermanentOfThisCard(), cardCondition: IsDiaboromon, payCost: false, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: -1, isHand: true, activateClass: activateClass, successProcess: null)); } yield return null; } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete 1 [Diaboromon], Digivolve into a [Diaboromon]", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] By deleting 1 of your Digimon with [Diaboromon] in its name, this Digimon may digivolve into [Diaboromon] in your hand without paying the cost."; } bool HasDiaboromonInNameField(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)) { if (permanent.TopCard.ContainsCardName("Diaboromon")) { return true; } } return false; } bool IsDiaboromon(CardSource cardSource) { return cardSource.EqualsCardName("Diaboromon"); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { return CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasDiaboromonInNameField); } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool deleted = false; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: HasDiaboromonInNameField, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null)); IEnumerator SuccessProcess() { deleted = true; yield return null; } } if (deleted) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( targetPermanent: card.PermanentOfThisCard(), cardCondition: IsDiaboromon, payCost: false, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: -1, isHand: true, activateClass: activateClass, successProcess: null)); } yield return null; } } #endregion #region All Turns - ESS if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(" 1 of your opponent's Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription()); activateClass.SetHashString("DeDigivolve_EX6_041"); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When one of your other Digimon with [Diaboromon] in its name is played, 1 of your opponent's Digimon."; } bool HasDiaboromonInName(Permanent permanent) { if(CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)) { return permanent.TopCard.ContainsCardName("Diaboromon"); } return false; } bool CanTargetCondtion(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, HasDiaboromonInName); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanTargetCondtion)) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanTargetCondtion)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanTargetCondtion, 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 to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { Permanent selectedPermanent = permanent; yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration()); } } } } #endregion return cardEffects; } } }