|
|
@@ -0,0 +1,381 @@
|
|
|
+using System.Collections;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System;
|
|
|
+
|
|
|
+namespace DCGO.CardEffects.EX8
|
|
|
+{
|
|
|
+ public class Whamon_EX8_025 : CEntity_Effect
|
|
|
+ {
|
|
|
+ public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
|
|
|
+ {
|
|
|
+ List<ICardEffect> cardEffects = new List<ICardEffect>();
|
|
|
+
|
|
|
+ #region Alternate Digivolution Requirement
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ static bool PermanentCondition(Permanent targetPermanent)
|
|
|
+ {
|
|
|
+ return targetPermanent.TopCard.EqualsTraits("DS") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4;
|
|
|
+ }
|
|
|
+
|
|
|
+ cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region DNA Digivolve
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
|
|
|
+ addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
|
|
|
+ addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
|
|
|
+ addJogressConditionClass.SetNotShowUI(true);
|
|
|
+ cardEffects.Add(addJogressConditionClass);
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ JogressCondition GetJogress(CardSource cardSource)
|
|
|
+ {
|
|
|
+ if (cardSource == card)
|
|
|
+ {
|
|
|
+ bool PermanentCondition1(Permanent permanent) => permanent.TopCard.CardColors.Contains(CardColor.Blue) && permanent.Levels_ForJogress(card).Contains(4);
|
|
|
+
|
|
|
+ bool PermanentCondition2(Permanent permanent) => permanent.TopCard.CardColors.Contains(CardColor.Black) || permanent.TopCard.CardColors.Contains(CardColor.Purple) &&
|
|
|
+ permanent.Levels_ForJogress(card).Contains(4);
|
|
|
+
|
|
|
+ JogressConditionElement[] elements = new JogressConditionElement[]
|
|
|
+ {
|
|
|
+ new JogressConditionElement(PermanentCondition1, "a level 4 blue Digimon"),
|
|
|
+
|
|
|
+ new JogressConditionElement(PermanentCondition2, "a level 4 black/purple Digimon"),
|
|
|
+ };
|
|
|
+
|
|
|
+ JogressCondition jogressCondition = new JogressCondition(elements, 0);
|
|
|
+
|
|
|
+ return jogressCondition;
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region On Play
|
|
|
+ if (timing == EffectTiming.OnEnterFieldAnyone)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Place 1 of your other Digimon as this Digimon's bottom digivolution card to unsuspend this Digimon.", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDescription()
|
|
|
+ {
|
|
|
+ return "[On Play] You may place 1 Digimon card with the [DS] trait from your trash as this Digimon's bottom digivolution card.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectPermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
|
|
|
+ {
|
|
|
+ if (permanent != card.PermanentOfThisCard())
|
|
|
+ {
|
|
|
+ if (permanent.TopCard.EqualsTraits("DS"))
|
|
|
+ {
|
|
|
+ if (!permanent.TopCard.Equals(card))
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
|
|
|
+ {
|
|
|
+ if (!card.PermanentOfThisCard().IsToken)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ List<CardSource> selectedCards = new List<CardSource>();
|
|
|
+
|
|
|
+ SelectPermanentEffect selectPermanentEffect =
|
|
|
+ GManager.instance.GetComponent<SelectPermanentEffect>();
|
|
|
+
|
|
|
+ selectPermanentEffect.SetUp(
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ canTargetCondition: CanSelectPermanentCondition,
|
|
|
+ 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 card to place on bottom of digivolution cards.",
|
|
|
+ "The opponent is selecting 1 card to place on bottom of digivolution cards.");
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
+
|
|
|
+ IEnumerator SelectPermanentCoroutine(Permanent permanent)
|
|
|
+ {
|
|
|
+ selectedCards.Add(permanent.TopCard);
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(
|
|
|
+ new List<Permanent[]>() { new Permanent[] { permanent, card.PermanentOfThisCard() } },
|
|
|
+ false,
|
|
|
+ activateClass).PlacePermanentToDigivolutionCards());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region When Digivolving
|
|
|
+ if (timing == EffectTiming.OnEnterFieldAnyone)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Place 1 of your other Digimon as this Digimon's bottom digivolution card to unsuspend this Digimon.", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDescription()
|
|
|
+ {
|
|
|
+ return "[When Digivolving] You may place 1 Digimon card with the [DS] trait from your trash as this Digimon's bottom digivolution card.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectPermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
|
|
|
+ {
|
|
|
+ if (permanent != card.PermanentOfThisCard())
|
|
|
+ {
|
|
|
+ if (permanent.TopCard.EqualsTraits("DS"))
|
|
|
+ {
|
|
|
+ if (!permanent.TopCard.Equals(card))
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) &&
|
|
|
+ CardEffectCommons.IsExistOnBattleAreaDigimon(card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
|
|
|
+ {
|
|
|
+ if (!card.PermanentOfThisCard().IsToken)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ List<CardSource> selectedCards = new List<CardSource>();
|
|
|
+
|
|
|
+ SelectPermanentEffect selectPermanentEffect =
|
|
|
+ GManager.instance.GetComponent<SelectPermanentEffect>();
|
|
|
+
|
|
|
+ selectPermanentEffect.SetUp(
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ canTargetCondition: CanSelectPermanentCondition,
|
|
|
+ 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 card to place on bottom of digivolution cards.",
|
|
|
+ "The opponent is selecting 1 card to place on bottom of digivolution cards.");
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
+
|
|
|
+ IEnumerator SelectPermanentCoroutine(Permanent permanent)
|
|
|
+ {
|
|
|
+ selectedCards.Add(permanent.TopCard);
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(
|
|
|
+ new List<Permanent[]>() { new Permanent[] { permanent, card.PermanentOfThisCard() } },
|
|
|
+ false,
|
|
|
+ activateClass).PlacePermanentToDigivolutionCards());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region End of Attack
|
|
|
+ if (timing == EffectTiming.OnEndAttack)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Play 1 digivolution card", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
|
|
|
+ activateClass.SetHashString("EndofAttack_EX8_025");
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDiscription()
|
|
|
+ {
|
|
|
+ return "[End of Attack] [Once Per Turn] You may play 1 [DS] trait Digimon card with a play cost of 5 or less from this Digimon's digivolution cards without paying the cost.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectCardCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ if (cardSource.IsDigimon)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
|
|
|
+ {
|
|
|
+ if (cardSource.EqualsTraits("DS"))
|
|
|
+ {
|
|
|
+ if (cardSource.HasPlayCost && cardSource.GetCostItself <= 5)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsExistOnBattleArea(card))
|
|
|
+ {
|
|
|
+ if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable _hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsExistOnBattleArea(card))
|
|
|
+ {
|
|
|
+ Permanent selectedPermanent = card.PermanentOfThisCard();
|
|
|
+
|
|
|
+ if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
|
|
|
+ {
|
|
|
+ int maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
|
|
|
+
|
|
|
+ List<CardSource> selectedCards = new List<CardSource>();
|
|
|
+
|
|
|
+ SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
|
|
|
+
|
|
|
+ selectCardEffect.SetUp(
|
|
|
+ canTargetCondition: CanSelectCardCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ canNoSelect: () => true,
|
|
|
+ selectCardCoroutine: SelectCardCoroutine,
|
|
|
+ afterSelectCardCoroutine: null,
|
|
|
+ message: "Select 1 digivolution card to play.",
|
|
|
+ maxCount: maxCount,
|
|
|
+ canEndNotMax: false,
|
|
|
+ isShowOpponent: true,
|
|
|
+ mode: SelectCardEffect.Mode.Custom,
|
|
|
+ root: SelectCardEffect.Root.Custom,
|
|
|
+ customRootCardList: selectedPermanent.DigivolutionCards,
|
|
|
+ canLookReverseCard: true,
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
|
|
|
+
|
|
|
+ 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.DigivolutionCards,
|
|
|
+ activateETB: true));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Your Turn - ESS
|
|
|
+
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ CanNotSwitchAttackTargetClass canNotSwitchAttackTargetClass = new CanNotSwitchAttackTargetClass();
|
|
|
+ canNotSwitchAttackTargetClass.SetUpICardEffect("This Digimon's attack target can't be switched.", CanUseCondition, card);
|
|
|
+ canNotSwitchAttackTargetClass.SetUpCanNotSwitchAttackTargetClass(PermanentCondition: PermanentCondition);
|
|
|
+ canNotSwitchAttackTargetClass.SetIsInheritedEffect(true);
|
|
|
+ cardEffects.Add(canNotSwitchAttackTargetClass);
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
|
|
|
+ CardEffectCommons.IsOwnerTurn(card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool PermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ return permanent != null && permanent.TopCard && permanent == card.PermanentOfThisCard();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ return cardEffects;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|