|
|
@@ -0,0 +1,199 @@
|
|
|
+using System.Collections;
|
|
|
+using System.Collections.Generic;
|
|
|
+
|
|
|
+// Royal Base
|
|
|
+namespace DCGO.CardEffects.P
|
|
|
+{
|
|
|
+ public class P_181 : CEntity_Effect
|
|
|
+ {
|
|
|
+ public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
|
|
|
+ {
|
|
|
+ List<ICardEffect> cardEffects = new List<ICardEffect>();
|
|
|
+
|
|
|
+ #region All Turns Security
|
|
|
+
|
|
|
+ if (timing == EffectTiming.BeforePayCost)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Reduce Digivolve Cost", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
|
|
|
+ activateClass.SetHashString("P-181-ReduceDigivovleCost");
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDiscription()
|
|
|
+ => "[Security] [Your Turn] [Once Per Turn] When any of your Digimon would digivolve into a Digimon card with the [Royal Base] trait, reduce the digivolution cost by 1.";
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ => CardEffectCommons.IsExistInSecurity(card, false)
|
|
|
+ && CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, DigivolveCondition);
|
|
|
+
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ => CardEffectCommons.IsExistInSecurity(card, false)
|
|
|
+ && CardEffectCommons.IsOwnerTurn(card);
|
|
|
+
|
|
|
+ bool DigivolveCondition(Permanent permanent)
|
|
|
+ => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
|
|
|
+ && permanent.TopCard.HasRoyalBaseTraits;
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable _hashtable)
|
|
|
+ {
|
|
|
+ ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
|
|
|
+
|
|
|
+ ChangeCostClass changeCostClass = new ChangeCostClass();
|
|
|
+ changeCostClass.SetUpICardEffect("Digivovle Cost -1", hashtable => true, card);
|
|
|
+ changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: root => true, isUpDown: () => true, isCheckAvailability: () => false, isChangePayingCost: () => true);
|
|
|
+ card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
|
|
|
+
|
|
|
+ int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
|
|
|
+ {
|
|
|
+ if (CardSourceCondition(cardSource))
|
|
|
+ {
|
|
|
+ if (PermanentsCondition(targetPermanents))
|
|
|
+ {
|
|
|
+ Cost -= 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Cost;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool PermanentsCondition(List<Permanent> targetPermanents)
|
|
|
+ => targetPermanents != null;
|
|
|
+
|
|
|
+ bool CardSourceCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ if (cardSource != null)
|
|
|
+ {
|
|
|
+ return cardSource.Owner == card.Owner;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Main Effect
|
|
|
+
|
|
|
+ if (timing == EffectTiming.OptionSkill)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Add top sec to hand, send this to bottom sec", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDescription()
|
|
|
+ {
|
|
|
+ return "[Main] Add your top security card to the hand. Then, place this card face up as the bottom security card.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (card.Owner.SecurityCards.Count >= 1)
|
|
|
+ {
|
|
|
+ // Add your top security card to the hand
|
|
|
+ CardSource topSecCard = card.Owner.SecurityCards[0];
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ CardObjectController.AddHandCards(new List<CardSource>() { topSecCard }, false, activateClass));
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
|
|
|
+ player: card.Owner,
|
|
|
+ refSkillInfos: ref ContinuousController.instance.nullSkillInfos).ReduceSecurity());
|
|
|
+ }
|
|
|
+
|
|
|
+ // Place this card face up as the bottom security card
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(
|
|
|
+ card, toTop: false, faceUp: true));
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>()
|
|
|
+ .CreateRecoveryEffect(card.Owner));
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(new IAddSecurity(card.Owner).AddSecurity());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Security Effect
|
|
|
+
|
|
|
+ if (timing == EffectTiming.SecuritySkill)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect($"Play 1 [Royal Base] Digimon card from hand", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
|
|
|
+ activateClass.SetIsSecurityEffect(true);
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDescription()
|
|
|
+ {
|
|
|
+ return
|
|
|
+ "[Security] You may play 1 level 5 or lower [Royal Base] trait Digimon card from your hand without paying the cost.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectCardCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 5 &&
|
|
|
+ cardSource.HasRoyalBaseTraits &&
|
|
|
+ CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
|
|
|
+ {
|
|
|
+ List<CardSource> selectedCards = new List<CardSource>();
|
|
|
+
|
|
|
+ SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
|
|
|
+
|
|
|
+ selectHandEffect.SetUp(
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ canTargetCondition: CanSelectCardCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ maxCount: 1,
|
|
|
+ canNoSelect: true,
|
|
|
+ canEndNotMax: false,
|
|
|
+ isShowOpponent: true,
|
|
|
+ selectCardCoroutine: SelectCardCoroutine,
|
|
|
+ afterSelectCardCoroutine: null,
|
|
|
+ mode: SelectHandEffect.Mode.Custom,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
|
|
|
+ selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
|
|
|
+
|
|
|
+ yield return StartCoroutine(selectHandEffect.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.Hand, activateETB: true));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ return cardEffects;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|