P_150.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace DCGO.CardEffects.P
  5. {
  6. public class P_150 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.CardNames.Contains("Pulsemon"))
  17. {
  18. return true;
  19. }
  20. return false;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  23. permanentCondition: PermanentCondition,
  24. digivolutionCost: 2,
  25. ignoreDigivolutionRequirement: false,
  26. card: card,
  27. condition: null));
  28. }
  29. #endregion
  30. #region When Digivolving
  31. if (timing == EffectTiming.OnEnterFieldAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("Suspend 1 opponent's Digimon/Tamer, 1 of your opponent's Digimon/Tamer can't unsuspend", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[When Digivolving] If you have 3 or more security cards, suspend 1 of your opponent's Digimon or Tamers. If you have 3 or fewer security cards, 1 of your opponent's Digimon or Tamers can't unsuspend until the end of their turn.";
  40. }
  41. bool SelectOpponentsDigimonOrTamers(Permanent permanent)
  42. {
  43. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  44. {
  45. if(permanent.IsDigimon || permanent.IsTamer)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  59. {
  60. if (CardEffectCommons.HasMatchConditionPermanent(SelectOpponentsDigimonOrTamers))
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable hashtable)
  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: SelectOpponentsDigimonOrTamers,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: 1,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: null,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Tap,
  83. cardEffect: activateClass);
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. }
  86. if (card.Owner.SecurityCards.Count <= 3)
  87. {
  88. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  89. selectPermanentEffect.SetUp(
  90. selectPlayer: card.Owner,
  91. canTargetCondition: SelectOpponentsDigimonOrTamers,
  92. canTargetCondition_ByPreSelecetedList: null,
  93. canEndSelectCondition: null,
  94. maxCount: 1,
  95. canNoSelect: false,
  96. canEndNotMax: false,
  97. selectPermanentCoroutine: SelectPermanentCoroutine,
  98. afterSelectPermanentCoroutine: null,
  99. mode: SelectPermanentEffect.Mode.Custom,
  100. cardEffect: activateClass);
  101. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  102. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  103. {
  104. if(permanent != null)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
  107. targetPermanent: permanent,
  108. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  109. activateClass: activateClass,
  110. condition: null,
  111. effectName: "Can't Unsuspend"));
  112. }
  113. }
  114. }
  115. }
  116. }
  117. #endregion
  118. #region When Suspended - ESS
  119. if (timing == EffectTiming.OnTappedAnyone)
  120. {
  121. ActivateClass activateClass = new ActivateClass();
  122. activateClass.SetUpICardEffect("Suspend 1 Opponent's Digimon", CanUseCondition, card);
  123. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  124. activateClass.SetIsInheritedEffect(true);
  125. activateClass.SetHashString("Suspend_P_150");
  126. cardEffects.Add(activateClass);
  127. string EffectDiscription()
  128. {
  129. return "[All Turns] [Once Per Turn] When this Digimon becomes suspended, suspend 1 of your opponent's Digimon with as much or less DP as this Digimon.";
  130. }
  131. bool SelectOpponentDigimon(Permanent permanent)
  132. {
  133. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  134. {
  135. if(permanent.HasDP && permanent.DP <= card.PermanentOfThisCard().DP)
  136. {
  137. return true;
  138. }
  139. }
  140. return false;
  141. }
  142. bool CanUseCondition(Hashtable hashtable)
  143. {
  144. return CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  145. }
  146. bool CanActivateCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  149. }
  150. IEnumerator ActivateCoroutine(Hashtable hashtable)
  151. {
  152. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  153. selectPermanentEffect.SetUp(
  154. selectPlayer: card.Owner,
  155. canTargetCondition: SelectOpponentDigimon,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canEndSelectCondition: null,
  158. maxCount: 1,
  159. canNoSelect: false,
  160. canEndNotMax: false,
  161. selectPermanentCoroutine: null,
  162. afterSelectPermanentCoroutine: null,
  163. mode: SelectPermanentEffect.Mode.Tap,
  164. cardEffect: activateClass);
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. }
  167. }
  168. #endregion
  169. return cardEffects;
  170. }
  171. }
  172. }