BT16_055.cs 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Namakemon
  5. namespace DCGO.CardEffects.BT16
  6. {
  7. public class BT16_055 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. # region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.CardNames.Contains("Pulsemon"))
  18. {
  19. return true;
  20. }
  21. return false;
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  24. permanentCondition: PermanentCondition,
  25. digivolutionCost: 2,
  26. ignoreDigivolutionRequirement: false,
  27. card: card,
  28. condition: null));
  29. }
  30. #endregion
  31. #region Shared OP/WD
  32. string SharedEffectName() => "Conditionally 1 of your Digimon can't be DP reduced or De-Digivolved, Conditionally 1 of your Digimon gains <Blocker> and <Reboot>";
  33. string SharedEffectDescription(string tag) => $"[{tag}] If you have 3 or more security cards, 1 of your Digimon can't have its DP reduced by your opponent's effects, and isn't affected by <De-Digivolve> effects until the end of your opponent's turn. If you have 3 or fewer security cards, 1 of your Digimon gains <Blocker> and <Reboot> until the end of your opponent's turn.";
  34. bool SharedCanActivateCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  37. }
  38. bool CanSelectPermanentCondition(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  41. }
  42. Permanent selectedPermanent1 = null;
  43. #region Can't Be De-Digivolved
  44. Permanent selectedPermanent = null;
  45. IEnumerator AfterSelectPermanent(List<Permanent> permanents)
  46. {
  47. if (permanents.Count >= 1)
  48. selectedPermanent = permanents[0];
  49. yield return null;
  50. }
  51. void ActivateDeDigivolveProtection()
  52. {
  53. ImmuneFromDeDigivolveClass immuneFromDeDigivolveClass = new ImmuneFromDeDigivolveClass();
  54. immuneFromDeDigivolveClass.SetUpICardEffect("Isn't affected by <De-Digivolve>", CanUseDeDigivolveCondition, selectedPermanent.TopCard);
  55. immuneFromDeDigivolveClass.SetUpImmuneFromDeDigivolveClass(PermanentCondition: PermanentDeDigivolveCondition);
  56. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => immuneFromDeDigivolveClass);
  57. }
  58. bool CanUseDeDigivolveCondition(Hashtable hashtable1)
  59. {
  60. return selectedPermanent.TopCard != null;
  61. }
  62. bool PermanentDeDigivolveCondition(Permanent permanent)
  63. {
  64. return permanent == selectedPermanent;
  65. }
  66. #endregion
  67. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  68. {
  69. if (card.Owner.SecurityCards.Count >= 3)
  70. {
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: 1,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: null,
  81. afterSelectPermanentCoroutine: AfterSelectPermanent,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectPermanentEffect.SetUpCustomMessage(
  85. "Select 1 Digimon that can't have its DP reduced by your opponent's effects and isn't affected by <De-Digivolve> effects until the end of your opponent's turn.",
  86. "The opponent is selecting 1 Digimon that can't have its DP reduced by your opponent's effects and isn't affected by <De-Digivolve> effects until the end of your turn.");
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. if (selectedPermanent != null)
  89. {
  90. ActivateDeDigivolveProtection();
  91. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainImmuneFromDPMinus(
  92. targetPermanent: selectedPermanent,
  93. cardEffectCondition: cardEffect => CardEffectCommons.IsOpponentEffect(cardEffect, card),
  94. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  95. activateClass: activateClass,
  96. effectName: "Can't have DP reduced"));
  97. }
  98. }
  99. if (card.Owner.SecurityCards.Count <= 3)
  100. {
  101. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  102. selectPermanentEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition: CanSelectPermanentCondition,
  105. canTargetCondition_ByPreSelecetedList: null,
  106. canEndSelectCondition: null,
  107. maxCount: 1,
  108. canNoSelect: false,
  109. canEndNotMax: false,
  110. selectPermanentCoroutine: SelectPermanentCoroutine,
  111. afterSelectPermanentCoroutine: null,
  112. mode: SelectPermanentEffect.Mode.Custom,
  113. cardEffect: activateClass);
  114. selectPermanentEffect.SetUpCustomMessage(
  115. "Select 1 Digimon that gains <Blocker> and <Reboot> until the end of your opponent's turn.",
  116. "The opponent is selecting 1 Digimon that gains <Blocker> and <Reboot> until the end of your turn.");
  117. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  118. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  119. {
  120. selectedPermanent1 = permanent;
  121. yield return null;
  122. }
  123. if (selectedPermanent1 != null)
  124. {
  125. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(
  126. targetPermanent: selectedPermanent1,
  127. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  128. activateClass: activateClass));
  129. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  130. targetPermanent: selectedPermanent1,
  131. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  132. activateClass: activateClass));
  133. }
  134. }
  135. }
  136. #endregion
  137. #region On Play
  138. if (timing == EffectTiming.OnEnterFieldAnyone)
  139. {
  140. ActivateClass activateClass = new ActivateClass();
  141. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  142. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  143. cardEffects.Add(activateClass);
  144. bool CanUseCondition(Hashtable hashtable)
  145. {
  146. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  147. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  148. }
  149. }
  150. #endregion
  151. #region When Digivolving
  152. if (timing == EffectTiming.OnEnterFieldAnyone)
  153. {
  154. ActivateClass activateClass = new ActivateClass();
  155. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  156. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  157. cardEffects.Add(activateClass);
  158. bool CanUseCondition(Hashtable hashtable)
  159. {
  160. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  161. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  162. }
  163. }
  164. #endregion
  165. #region Inherited Effect
  166. if (timing == EffectTiming.None)
  167. {
  168. bool condition()
  169. {
  170. return card.PermanentOfThisCard().TopCard.HasText("Pulsemon");
  171. }
  172. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(
  173. changeValue: () => 1000,
  174. isInheritedEffect: true,
  175. card: card,
  176. condition: condition));
  177. }
  178. #endregion
  179. return cardEffects;
  180. }
  181. }
  182. }