using System; using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.BT18 { public class BT18_015 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternate Digivolution if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.ContainsTraits("Composite"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete your 1 Digimon to delete 1 of opponent's Digimon with the lowest DP", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] By deleting 1 of your Digimon, delete 1 of your opponent's Digimon with the lowest DP."; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool CanSelectPermanentCondition1(Permanent permanent) { return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy); } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { return true; } } return false; } 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: 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() { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1)) { maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1)); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition1, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } } } } #endregion #region When Attacking if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete your 1 Digimon to delete 1 of opponent's Digimon with the lowest DP", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Attacking] By deleting 1 of your Digimon, delete 1 of your opponent's Digimon with the lowest DP."; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool CanSelectPermanentCondition1(Permanent permanent) { return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy); } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) return CardEffectCommons.CanTriggerOnAttack(hashtable, card); return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { return true; } } return false; } 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: 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() { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1)) { maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1)); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition1, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } } } } #endregion #region On Deletion if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("DNA into [Millenniummon]", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Deletion] 1 of your [Machinedramon] in play and 1 [Kimeramon] in the trash may DNA Digivolve into [Millenniummon] in the hand."; } bool HasMachinedramon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.EqualsCardName("Machinedramon"); } bool HasKimeramon(CardSource source) { return CardEffectCommons.IsExistOnTrash(source) && source.EqualsCardName("Kimeramon"); } bool HasMillenniummon(CardSource source) { return CardEffectCommons.IsExistOnHand(source) && source.EqualsCardName("Millenniummon") && source.jogressCondition.Count > 0; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.CanActivateOnDeletion(card, activateClass) && CardEffectCommons.HasMatchConditionPermanent(HasMachinedramon) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, HasKimeramon) && CardEffectCommons.HasMatchConditionOwnersHand(card, HasMillenniummon); } IEnumerator ActivateCoroutine(Hashtable hashtable) { CardSource dnaTarget = null; Permanent selectedPermanent = null; CardSource selectedCardSource = null; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: HasMillenniummon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectDNACardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 Digimon to DNA digivolve.", "The opponent is selecting 1 Digimon to DNA digivolve."); yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate()); IEnumerator SelectDNACardCoroutine(CardSource source) { dnaTarget = source; yield return null; } SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: HasMachinedramon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to DNA digivolve.", "The opponent is selecting 1 Digimon to DNA digivolve."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: HasKimeramon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 Digimon to DNA digivolve.", maxCount: 1, canEndNotMax: false, isShowOpponent: false, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetNotShowCard(); selectCardEffect.SetNotAddLog(); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); } IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCardSource = cardSource; yield return null; } if (selectedCardSource != null) { #region play card from trash Permanent playedPermanent = null; int frameID = selectedCardSource.PreferredFrame().FrameID; if (0 <= frameID && frameID < card.Owner.fieldCardFrames.Count) { playedPermanent = new Permanent(new List() { selectedCardSource }) { IsSuspended = false }; yield return ContinuousController.instance.StartCoroutine(CardObjectController.CreateNewPermanent(playedPermanent, frameID)); } #endregion int[] JogressEvoRootsFrameIDs = { playedPermanent.PermanentFrame.FrameID, selectedPermanent.PermanentFrame.FrameID }; if (dnaTarget.CanPlayJogress(true)) { PlayCardClass playCard = new PlayCardClass( cardSources: new List() { dnaTarget }, hashtable: CardEffectCommons.CardEffectHashtable(activateClass), payCost: true, targetPermanent: null, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true); playCard.SetJogress(JogressEvoRootsFrameIDs); yield return ContinuousController.instance.StartCoroutine(playCard.PlayCard()); } else { yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(selectedCardSource)); } } } } #endregion #region Inherit - Sec+1 if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: null)); } #endregion return cardEffects; } } }