| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- namespace DCGO.CardEffects.BT18
- {
- public class BT18_015 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #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>();
- 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>() { 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>();
- 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>() { 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>();
- 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>();
- 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>();
- 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<CardSource>() { 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<CardSource>() { 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;
- }
- }
- }
|