|
|
@@ -0,0 +1,534 @@
|
|
|
+using System;
|
|
|
+using System.Collections;
|
|
|
+using System.Collections.Generic;
|
|
|
+
|
|
|
+// Vademon
|
|
|
+namespace DCGO.CardEffects.BT22
|
|
|
+{
|
|
|
+ public class BT22_061 : CEntity_Effect
|
|
|
+ {
|
|
|
+ public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
|
|
|
+ {
|
|
|
+ List<ICardEffect> cardEffects = new List<ICardEffect>();
|
|
|
+
|
|
|
+ #region Static Effects
|
|
|
+
|
|
|
+ #region DM Trait Alternative Digivolution Condition
|
|
|
+
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ bool PermanentCondition(Permanent targetPermanent)
|
|
|
+ {
|
|
|
+ return targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.HasDMTraits;
|
|
|
+ }
|
|
|
+
|
|
|
+ cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
|
|
|
+ permanentCondition: PermanentCondition,
|
|
|
+ digivolutionCost: 4,
|
|
|
+ ignoreDigivolutionRequirement: false,
|
|
|
+ card: card,
|
|
|
+ condition: null)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Veggiemon Alternative Digivolution Condition
|
|
|
+
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ bool PermanentCondition(Permanent targetPermanent)
|
|
|
+ {
|
|
|
+ return targetPermanent.TopCard.EqualsCardName("Veggiemon");
|
|
|
+ }
|
|
|
+
|
|
|
+ cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
|
|
|
+ permanentCondition: PermanentCondition,
|
|
|
+ digivolutionCost: 3,
|
|
|
+ ignoreDigivolutionRequirement: false,
|
|
|
+ card: card,
|
|
|
+ condition: null)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Ver2 Digivolution Cost Reduction
|
|
|
+
|
|
|
+ if (timing == EffectTiming.BeforePayCost)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Reduce the digivolution cost by 1 for each face-down source", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDiscription()
|
|
|
+ => "When any of your [Ver.2] trait Digimon would digivolve into this card, for each of their face-down digivolution cards, reduce the digivolution cost by 1.";
|
|
|
+
|
|
|
+ bool PermanentEvoCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
|
|
|
+ {
|
|
|
+ if (permanent.TopCard.HasVer2Traits)
|
|
|
+ {
|
|
|
+ return card.CanPlayCardTargetFrame(permanent.PermanentFrame, true, activateClass);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CardCondition(CardSource source)
|
|
|
+ {
|
|
|
+ return (source == card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentEvoCondition))
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentEvoCondition, CardCondition))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable _hashtable)
|
|
|
+ {
|
|
|
+ Hashtable hashtable = new Hashtable();
|
|
|
+ hashtable.Add("CardEffect", activateClass);
|
|
|
+
|
|
|
+ Permanent targetPermanent = CardEffectCommons.GetPermanentsFromHashtable(_hashtable)[0];
|
|
|
+
|
|
|
+ ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
|
|
|
+
|
|
|
+ ChangeCostClass changeCostClass = new ChangeCostClass();
|
|
|
+ changeCostClass.SetUpICardEffect($"Digivolution Cost -{ReduceCost()}", CanUseCondition, card);
|
|
|
+ changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
|
|
|
+ card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ int ReduceCost()
|
|
|
+ {
|
|
|
+ return targetPermanent.DigivolutionCards.Filter(x => x.IsFlipped).Count;
|
|
|
+ }
|
|
|
+
|
|
|
+ int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
|
|
|
+ {
|
|
|
+ if (CardSourceCondition(cardSource))
|
|
|
+ {
|
|
|
+ if (RootCondition(root))
|
|
|
+ {
|
|
|
+ if (PermanentsCondition(targetPermanents))
|
|
|
+ {
|
|
|
+ Cost -= ReduceCost();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Cost;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool PermanentsCondition(List<Permanent> targetPermanents)
|
|
|
+ {
|
|
|
+ if (targetPermanents != null)
|
|
|
+ {
|
|
|
+ if (targetPermanents.Exists(PermanentCondition))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool PermanentCondition(Permanent targetPermanent)
|
|
|
+ {
|
|
|
+ if (targetPermanent.TopCard != null)
|
|
|
+ {
|
|
|
+ return PermanentEvoCondition(targetPermanent);
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CardSourceCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ if (cardSource != null)
|
|
|
+ {
|
|
|
+ return CardCondition(cardSource);
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool RootCondition(SelectCardEffect.Root root)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool isUpDown()
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Fragment
|
|
|
+
|
|
|
+ if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
|
|
|
+ {
|
|
|
+ string EffectDiscription()
|
|
|
+ {
|
|
|
+ return "<Fragment <3>> (When this Digimon would be deleted, by trashing any 3 of its digivolution cards, it isn’t deleted.)";
|
|
|
+ }
|
|
|
+
|
|
|
+ cardEffects.Add(CardEffectFactory.FragmentSelfEffect(isInheritedEffect: false, card: card, condition: null, trashValue: 3, effectName: "Fragment <3>", effectDiscription: EffectDiscription()));
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region When Digivolving
|
|
|
+
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("De-Digivolve 1, then by trashing bottom FD source, bounce 1 level 4 or lower digimon or tamer to hand", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
|
|
|
+ activateClass.SetHashString("BT22_061_DeDigivolve1AndBounce");
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDiscription()
|
|
|
+ {
|
|
|
+ return "[When Digivolving] [Once Per Turn] <De-Digivolve 1> 1 of your opponent's Digimon. (Trash the top card. You can't trash past level 3 cards.) Then, by trashing this Digimon's bottom face-down digivolution card, return 1 of your opponent's play cost 4 or lower Digimon or Tamers to the hand.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsExistOnField(card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool DeDigivolveCondition(Permanent targetPermanent)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(targetPermanent, card)
|
|
|
+ && !targetPermanent.ImmuneFromDeDigivolve();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectPermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
|
|
|
+ && permanent.TopCard.HasPlayCost && permanent.TopCard.BasePlayCostFromEntity <= 4
|
|
|
+ && (permanent.TopCard.IsDigimon || permanent.TopCard.IsTamer);
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, DeDigivolveCondition))
|
|
|
+ {
|
|
|
+ Permanent targetDegenPermanent = null;
|
|
|
+
|
|
|
+ #region Select De-Digivolve Permanent
|
|
|
+
|
|
|
+ int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, DeDigivolveCondition));
|
|
|
+ SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
|
|
|
+
|
|
|
+ selectPermanentEffect.SetUp(
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ canTargetCondition: DeDigivolveCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ maxCount: maxCount,
|
|
|
+ canNoSelect: false,
|
|
|
+ canEndNotMax: false,
|
|
|
+ selectPermanentCoroutine: null,
|
|
|
+ afterSelectPermanentCoroutine: null,
|
|
|
+ mode: SelectPermanentEffect.Mode.Destroy,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-digivolve.", "The opponent is selecting 1 Digimon to De-digivolve.");
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ if (targetDegenPermanent != null) yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ new IDegeneration(targetDegenPermanent, 1, activateClass).Degeneration());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (card.PermanentOfThisCard().HasFaceDownDigivolutionCards)
|
|
|
+ {
|
|
|
+ #region Selection to Trash Bottom Face Down Source
|
|
|
+
|
|
|
+ List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
|
|
|
+ {
|
|
|
+ new SelectionElement<bool>(message: $"Yes", value : true, spriteIndex: 0),
|
|
|
+ new SelectionElement<bool>(message: $"No", value : false, spriteIndex: 1),
|
|
|
+ };
|
|
|
+
|
|
|
+ string selectPlayerMessage = "trash bottom FD source to delete 4 cost or less tamer or digimon?";
|
|
|
+ string notSelectPlayerMessage = "The opponent is choosing to trash bottom FD source to delete 4 cost or less tamer or digimon.";
|
|
|
+
|
|
|
+ GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ bool isTrashing = GManager.instance.userSelectionManager.SelectedBoolValue;
|
|
|
+ if (isTrashing)
|
|
|
+ {
|
|
|
+ #region Trash Bottom Face Down Source
|
|
|
+
|
|
|
+ bool CanSelectCardCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ return cardSource.IsFlipped;
|
|
|
+ }
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
|
|
|
+ targetPermanent: card.PermanentOfThisCard(),
|
|
|
+ trashCount: 1,
|
|
|
+ isFromTop: false,
|
|
|
+ activateClass: activateClass,
|
|
|
+ cardCondition: CanSelectCardCondition
|
|
|
+ ));
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
|
|
|
+ {
|
|
|
+ #region Bounce Permanent
|
|
|
+
|
|
|
+ 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: false,
|
|
|
+ canEndNotMax: false,
|
|
|
+ selectPermanentCoroutine: null,
|
|
|
+ afterSelectPermanentCoroutine: null,
|
|
|
+ mode: SelectPermanentEffect.Mode.Bounce,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region When Attacking
|
|
|
+
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("De-Digivolve 1, then by trashing bottom FD source, bounce 1 level 4 or lower digimon or tamer to hand", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
|
|
|
+ activateClass.SetHashString("BT22_061_DeDigivolve1AndBounce");
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDiscription()
|
|
|
+ {
|
|
|
+ return "[When Attacking] [Once Per Turn] <De-Digivolve 1> 1 of your opponent's Digimon. (Trash the top card. You can't trash past level 3 cards.) Then, by trashing this Digimon's bottom face-down digivolution card, return 1 of your opponent's play cost 4 or lower Digimon or Tamers to the hand.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsExistOnField(card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool DeDigivolveCondition(Permanent targetPermanent)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(targetPermanent, card)
|
|
|
+ && !targetPermanent.ImmuneFromDeDigivolve();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectPermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
|
|
|
+ && permanent.TopCard.HasPlayCost && permanent.TopCard.BasePlayCostFromEntity <= 4
|
|
|
+ && (permanent.TopCard.IsDigimon || permanent.TopCard.IsTamer);
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, DeDigivolveCondition))
|
|
|
+ {
|
|
|
+ Permanent targetDegenPermanent = null;
|
|
|
+
|
|
|
+ #region Select De-Digivolve Permanent
|
|
|
+
|
|
|
+ int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, DeDigivolveCondition));
|
|
|
+ SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
|
|
|
+
|
|
|
+ selectPermanentEffect.SetUp(
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ canTargetCondition: DeDigivolveCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ maxCount: maxCount,
|
|
|
+ canNoSelect: false,
|
|
|
+ canEndNotMax: false,
|
|
|
+ selectPermanentCoroutine: null,
|
|
|
+ afterSelectPermanentCoroutine: null,
|
|
|
+ mode: SelectPermanentEffect.Mode.Destroy,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-digivolve.", "The opponent is selecting 1 Digimon to De-digivolve.");
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ if (targetDegenPermanent != null) yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ new IDegeneration(targetDegenPermanent, 1, activateClass).Degeneration());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (card.PermanentOfThisCard().HasFaceDownDigivolutionCards)
|
|
|
+ {
|
|
|
+ #region Selection to Trash Bottom Face Down Source
|
|
|
+
|
|
|
+ List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
|
|
|
+ {
|
|
|
+ new SelectionElement<bool>(message: $"Yes", value : true, spriteIndex: 0),
|
|
|
+ new SelectionElement<bool>(message: $"No", value : false, spriteIndex: 1),
|
|
|
+ };
|
|
|
+
|
|
|
+ string selectPlayerMessage = "trash bottom FD source to delete 4 cost or less tamer or digimon?";
|
|
|
+ string notSelectPlayerMessage = "The opponent is choosing to trash bottom FD source to delete 4 cost or less tamer or digimon.";
|
|
|
+
|
|
|
+ GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ bool isTrashing = GManager.instance.userSelectionManager.SelectedBoolValue;
|
|
|
+ if (isTrashing)
|
|
|
+ {
|
|
|
+ #region Trash Bottom Face Down Source
|
|
|
+
|
|
|
+ bool CanSelectCardCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ return cardSource.IsFlipped;
|
|
|
+ }
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
|
|
|
+ targetPermanent: card.PermanentOfThisCard(),
|
|
|
+ trashCount: 1,
|
|
|
+ isFromTop: false,
|
|
|
+ activateClass: activateClass,
|
|
|
+ cardCondition: CanSelectCardCondition
|
|
|
+ ));
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
|
|
|
+ {
|
|
|
+ #region Bounce Permanent
|
|
|
+
|
|
|
+ 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: false,
|
|
|
+ canEndNotMax: false,
|
|
|
+ selectPermanentCoroutine: null,
|
|
|
+ afterSelectPermanentCoroutine: null,
|
|
|
+ mode: SelectPermanentEffect.Mode.Bounce,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region ESS
|
|
|
+
|
|
|
+ if (timing == EffectTiming.OnAllyAttack)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Change attack target to this card", CanUseCondition, card);
|
|
|
+
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
|
|
|
+
|
|
|
+ activateClass.SetHashString("BT22_061_ChangeAttackTarget");
|
|
|
+ activateClass.SetIsInheritedEffect(true);
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDiscription()
|
|
|
+ {
|
|
|
+ return "[Opponent's Turn] [Once Per Turn] When one of your opponent's Digimon attacks, you may change the attack target to this Digimon.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, IsOpponentDigimon);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsExistOnField(card)
|
|
|
+ && CardEffectCommons.IsOpponentTurn(card)
|
|
|
+ && CanBeSwitched();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool IsOpponentDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
|
|
|
+
|
|
|
+ bool CanBeSwitched()
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(GManager.instance.attackProcess.AttackingPermanent, card)
|
|
|
+ && GManager.instance.attackProcess.IsAttacking
|
|
|
+ && GManager.instance.attackProcess.AttackingPermanent.CanSwitchAttackTarget;
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CanBeSwitched()) yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ GManager.instance.attackProcess.SwitchDefender(activateClass, false, card.TopCardPermanent()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ return cardEffects;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|