BT13_059.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_059 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  14. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  15. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  16. addJogressConditionClass.SetNotShowUI(true);
  17. cardEffects.Add(addJogressConditionClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. JogressCondition GetJogress(CardSource cardSource)
  23. {
  24. if (cardSource == card)
  25. {
  26. bool PermanentCondition1(Permanent permanent)
  27. {
  28. if (permanent != null)
  29. {
  30. if (permanent.TopCard != null)
  31. {
  32. if (permanent.TopCard.Owner == card.Owner)
  33. {
  34. if (permanent.IsDigimon)
  35. {
  36. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  37. {
  38. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  39. {
  40. if (permanent.Levels_ForJogress(card).Contains(6))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool PermanentCondition2(Permanent permanent)
  53. {
  54. if (permanent != null)
  55. {
  56. if (permanent.TopCard != null)
  57. {
  58. if (permanent.TopCard.Owner == card.Owner)
  59. {
  60. if (permanent.IsDigimon)
  61. {
  62. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  63. {
  64. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  65. {
  66. if (permanent.Levels_ForJogress(card).Contains(6))
  67. {
  68. return true;
  69. }
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. return false;
  77. }
  78. JogressConditionElement[] elements = new JogressConditionElement[]
  79. {
  80. new JogressConditionElement(PermanentCondition1, "a level 6 green Digimon"),
  81. new JogressConditionElement(PermanentCondition2, "a level 6 blue Digimon"),
  82. };
  83. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  84. return jogressCondition;
  85. }
  86. return null;
  87. }
  88. }
  89. if (timing == EffectTiming.OnEnterFieldAnyone)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect("Suspend 1 Digimon and it can't unsuspend", CanUseCondition, card);
  93. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  94. cardEffects.Add(activateClass);
  95. string EffectDiscription()
  96. {
  97. return "[On Play] Suspend 1 of your opponent's Digimon. That Digimon doesn't unsuspend during your opponent's next unsuspend phase.";
  98. }
  99. bool CanSelectPermanentCondition(Permanent permanent)
  100. {
  101. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. if (CardEffectCommons.IsExistOnBattleArea(card))
  110. {
  111. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  112. {
  113. return true;
  114. }
  115. }
  116. return false;
  117. }
  118. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  119. {
  120. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  121. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  122. selectPermanentEffect.SetUp(
  123. selectPlayer: card.Owner,
  124. canTargetCondition: CanSelectPermanentCondition,
  125. canTargetCondition_ByPreSelecetedList: null,
  126. canEndSelectCondition: null,
  127. maxCount: maxCount,
  128. canNoSelect: false,
  129. canEndNotMax: false,
  130. selectPermanentCoroutine: null,
  131. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  132. mode: SelectPermanentEffect.Mode.Tap,
  133. cardEffect: activateClass);
  134. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  135. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  136. {
  137. foreach (Permanent selectedPermanent in permanents)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  140. targetPermanent: selectedPermanent,
  141. activateClass: activateClass
  142. ));
  143. }
  144. }
  145. }
  146. }
  147. if (timing == EffectTiming.OnEnterFieldAnyone)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("Suspend 1 Digimon and it can't unsuspend", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  152. cardEffects.Add(activateClass);
  153. string EffectDiscription()
  154. {
  155. return "[When Digivolving] Suspend 1 of your opponent's Digimon. That Digimon doesn't unsuspend during your opponent's next unsuspend phase.";
  156. }
  157. bool CanSelectPermanentCondition(Permanent permanent)
  158. {
  159. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  160. }
  161. bool CanUseCondition(Hashtable hashtable)
  162. {
  163. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  164. }
  165. bool CanActivateCondition(Hashtable hashtable)
  166. {
  167. if (CardEffectCommons.IsExistOnBattleArea(card))
  168. {
  169. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  170. {
  171. return true;
  172. }
  173. }
  174. return false;
  175. }
  176. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  177. {
  178. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  179. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  180. selectPermanentEffect.SetUp(
  181. selectPlayer: card.Owner,
  182. canTargetCondition: CanSelectPermanentCondition,
  183. canTargetCondition_ByPreSelecetedList: null,
  184. canEndSelectCondition: null,
  185. maxCount: maxCount,
  186. canNoSelect: false,
  187. canEndNotMax: false,
  188. selectPermanentCoroutine: null,
  189. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  190. mode: SelectPermanentEffect.Mode.Tap,
  191. cardEffect: activateClass);
  192. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  193. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  194. {
  195. foreach (Permanent selectedPermanent in permanents)
  196. {
  197. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  198. targetPermanent: selectedPermanent,
  199. activateClass: activateClass
  200. ));
  201. }
  202. }
  203. }
  204. }
  205. if (timing == EffectTiming.OnTappedAnyone)
  206. {
  207. ActivateClass activateClass = new ActivateClass();
  208. activateClass.SetUpICardEffect("Choose 1 effect", CanUseCondition, card);
  209. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  210. activateClass.SetHashString("SelectEffects_BT13_059");
  211. cardEffects.Add(activateClass);
  212. string EffectDiscription()
  213. {
  214. return "[All Turns][Once Per Turn] When an opponent's Digimon becomes suspended, you may activate 1 of the effects below. - Suspend 1 of your opponent's Digimon. - Unsuspend 1 of your Digimon.";
  215. }
  216. bool PermanentCondition(Permanent permanent)
  217. {
  218. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  219. }
  220. bool CanUseCondition(Hashtable hashtable)
  221. {
  222. if (CardEffectCommons.IsExistOnBattleArea(card))
  223. {
  224. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  225. {
  226. return true;
  227. }
  228. }
  229. return false;
  230. }
  231. bool CanActivateCondition(Hashtable hashtable)
  232. {
  233. if (CardEffectCommons.IsExistOnBattleArea(card))
  234. {
  235. return true;
  236. }
  237. return false;
  238. }
  239. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  240. {
  241. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  242. {
  243. new SelectionElement<bool>(message: $"Suspend 1 Digimon", value : true, spriteIndex: 0),
  244. new SelectionElement<bool>(message: $"Unsuspend 1 Digimon", value : false, spriteIndex: 1),
  245. };
  246. string selectPlayerMessage = "Which effect will you activate?";
  247. string notSelectPlayerMessage = "The opponent is choosing which effect to activate.";
  248. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  249. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  250. bool doSuspend = GManager.instance.userSelectionManager.SelectedBoolValue;
  251. if (doSuspend)
  252. {
  253. bool CanSelectPermanentCondition(Permanent permanent)
  254. {
  255. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  256. }
  257. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  258. {
  259. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  260. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  261. selectPermanentEffect.SetUp(
  262. selectPlayer: card.Owner,
  263. canTargetCondition: CanSelectPermanentCondition,
  264. canTargetCondition_ByPreSelecetedList: null,
  265. canEndSelectCondition: null,
  266. maxCount: maxCount,
  267. canNoSelect: false,
  268. canEndNotMax: false,
  269. selectPermanentCoroutine: null,
  270. afterSelectPermanentCoroutine: null,
  271. mode: SelectPermanentEffect.Mode.Tap,
  272. cardEffect: activateClass);
  273. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  274. }
  275. }
  276. else
  277. {
  278. bool CanSelectPermanentCondition1(Permanent permanent)
  279. {
  280. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  281. }
  282. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  283. {
  284. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  285. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  286. selectPermanentEffect.SetUp(
  287. selectPlayer: card.Owner,
  288. canTargetCondition: CanSelectPermanentCondition1,
  289. canTargetCondition_ByPreSelecetedList: null,
  290. canEndSelectCondition: null,
  291. maxCount: maxCount,
  292. canNoSelect: false,
  293. canEndNotMax: false,
  294. selectPermanentCoroutine: null,
  295. afterSelectPermanentCoroutine: null,
  296. mode: SelectPermanentEffect.Mode.UnTap,
  297. cardEffect: activateClass);
  298. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  299. }
  300. }
  301. }
  302. }
  303. return cardEffects;
  304. }
  305. }
  306. }