BT13_053.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_053 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Suspend 1 Digimon with 7000 DP or less and opponent's 1 Digimon can't unsuspend", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] Suspend 1 of your opponent's Digimon with 7000 DP or less. Then, until the end of your opponent's turn, 1 of your opponent's Digimon doesn't unsuspend.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  25. {
  26. if (permanent.DP <= 7000)
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanSelectPermanentCondition1(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. return true;
  48. }
  49. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  59. {
  60. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectPermanentCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: maxCount,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: null,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Tap,
  73. cardEffect: activateClass);
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. }
  76. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  77. {
  78. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  79. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectPermanentCondition1,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: maxCount,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: SelectPermanentCoroutine,
  89. afterSelectPermanentCoroutine: null,
  90. mode: SelectPermanentEffect.Mode.Custom,
  91. cardEffect: activateClass);
  92. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to unsuspend.", "The opponent is selecting 1 Digimon that will get unable to unsuspend.");
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  95. {
  96. Permanent selectedPermanent = permanent;
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  98. targetPermanent: selectedPermanent,
  99. activateClass: activateClass
  100. ));
  101. }
  102. }
  103. }
  104. }
  105. ActivateClass activateClass2 = new ActivateClass();
  106. activateClass2.SetUpICardEffect("Digivolution Cost -1", CanUseCondition2, card);
  107. activateClass2.SetUpActivateClass(CanActivateCondition2, ActivateCoroutine2, 1, false, EffectDiscription2());
  108. activateClass2.SetIsInheritedEffect(true);
  109. activateClass2.SetNotShowUI(true);
  110. activateClass2.SetIsBackgroundProcess(true);
  111. activateClass2.SetHashString("DigivolutionCost-1_BT13_053");
  112. string EffectDiscription2()
  113. {
  114. return "";
  115. }
  116. bool CanUseCondition2(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. if (CardEffectCommons.IsOwnerTurn(card))
  121. {
  122. if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolveOfCard(hashtable, null, card))
  123. {
  124. return true;
  125. }
  126. }
  127. }
  128. return false;
  129. }
  130. bool CanActivateCondition2(Hashtable hashtable)
  131. {
  132. if (CardEffectCommons.IsExistOnBattleArea(card))
  133. {
  134. return true;
  135. }
  136. return false;
  137. }
  138. IEnumerator ActivateCoroutine2(Hashtable _hashtable)
  139. {
  140. yield return null;
  141. }
  142. if (timing == EffectTiming.OnEnterFieldAnyone)
  143. {
  144. cardEffects.Add(activateClass2);
  145. }
  146. if (timing == EffectTiming.None)
  147. {
  148. ChangeCostClass changeCostClass = new ChangeCostClass();
  149. changeCostClass.SetUpICardEffect($"Digivolution Cost -1", CanUseCondition, card);
  150. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  151. changeCostClass.SetIsInheritedEffect(true);
  152. cardEffects.Add(changeCostClass);
  153. bool CanUseCondition(Hashtable hashtable)
  154. {
  155. if (isExistOnField(card))
  156. {
  157. if (CardEffectCommons.IsOwnerTurn(card))
  158. {
  159. if (card.Owner.GetBattleAreaPermanents().Contains(card.PermanentOfThisCard()))
  160. {
  161. if (!card.cEntity_EffectController.isOverMaxCountPerTurn(activateClass2, activateClass2.MaxCountPerTurn))
  162. {
  163. return true;
  164. }
  165. }
  166. }
  167. }
  168. return false;
  169. }
  170. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  171. {
  172. if (CardSourceCondition(cardSource))
  173. {
  174. if (RootCondition(root))
  175. {
  176. if (PermanentsCondition(targetPermanents))
  177. {
  178. Cost -= 1;
  179. }
  180. }
  181. }
  182. return Cost;
  183. }
  184. bool PermanentsCondition(List<Permanent> targetPermanents)
  185. {
  186. if (targetPermanents != null)
  187. {
  188. if (targetPermanents.Count(PermanentCondition) >= 1)
  189. {
  190. return true;
  191. }
  192. }
  193. return false;
  194. }
  195. bool PermanentCondition(Permanent targetPermanent)
  196. {
  197. if (targetPermanent != null)
  198. {
  199. if (targetPermanent.TopCard != null)
  200. {
  201. if (targetPermanent == card.PermanentOfThisCard())
  202. {
  203. return true;
  204. }
  205. }
  206. }
  207. return false;
  208. }
  209. bool CardSourceCondition(CardSource cardSource)
  210. {
  211. if (cardSource != null)
  212. {
  213. if (cardSource.Owner == card.Owner)
  214. {
  215. return true;
  216. }
  217. }
  218. return false;
  219. }
  220. bool RootCondition(SelectCardEffect.Root root)
  221. {
  222. return true;
  223. }
  224. bool isUpDown()
  225. {
  226. return true;
  227. }
  228. }
  229. return cardEffects;
  230. }
  231. }
  232. }