EX3_074.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX3
  6. {
  7. public class EX3_074 : 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.None)
  13. {
  14. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  15. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  16. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  17. addJogressConditionClass.SetNotShowUI(true);
  18. cardEffects.Add(addJogressConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return true;
  22. }
  23. JogressCondition GetJogress(CardSource cardSource)
  24. {
  25. if (cardSource == card)
  26. {
  27. bool PermanentCondition1(Permanent permanent)
  28. {
  29. if (permanent != null)
  30. {
  31. if (permanent.TopCard != null)
  32. {
  33. if (permanent.TopCard.Owner == card.Owner)
  34. {
  35. if (permanent.IsDigimon)
  36. {
  37. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  38. {
  39. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  40. {
  41. if (permanent.Levels_ForJogress(card).Contains(6))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. bool PermanentCondition2(Permanent permanent)
  54. {
  55. if (permanent != null)
  56. {
  57. if (permanent.TopCard != null)
  58. {
  59. if (permanent.TopCard.Owner == card.Owner)
  60. {
  61. if (permanent.IsDigimon)
  62. {
  63. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  64. {
  65. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  66. {
  67. if (permanent.Levels_ForJogress(card).Contains(6))
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. JogressConditionElement[] elements = new JogressConditionElement[]
  80. {
  81. new JogressConditionElement(PermanentCondition1, "a level 6 green Digimon"),
  82. new JogressConditionElement(PermanentCondition2, "a level 6 blue Digimon"),
  83. };
  84. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  85. return jogressCondition;
  86. }
  87. return null;
  88. }
  89. }
  90. if (timing == EffectTiming.OnEnterFieldAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Place a card to digivolution cards and play 1 Digimon from hand", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[When Digivolving] You may place 1 green or blue Digimon card with [Dramon] in its name from your hand under this Digimon as its bottom digivolution card. When DNA digivolving, you may play 1 green or blue Digimon card with [Dramon] in its name and 12000 DP or less from your hand without paying the cost.";
  99. }
  100. bool CanSelectCardCondition(CardSource cardSource)
  101. {
  102. if (cardSource != null)
  103. {
  104. if (cardSource.Owner == card.Owner)
  105. {
  106. if (cardSource.HasDramonName)
  107. {
  108. if (cardSource.IsDigimon)
  109. {
  110. if (cardSource.HasCardColor(CardColor.Green) || cardSource.HasCardColor(CardColor.Blue))
  111. {
  112. return true;
  113. }
  114. }
  115. }
  116. }
  117. }
  118. return false;
  119. }
  120. bool CanSelectCardCondition1(CardSource cardSource)
  121. {
  122. if (cardSource != null)
  123. {
  124. if (cardSource.Owner == card.Owner)
  125. {
  126. if (cardSource.HasDramonName)
  127. {
  128. if (cardSource.IsDigimon)
  129. {
  130. if (cardSource.HasCardColor(CardColor.Green) || cardSource.HasCardColor(CardColor.Blue))
  131. {
  132. if (cardSource.CardDP <= 12000)
  133. {
  134. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  135. {
  136. return true;
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
  143. }
  144. return false;
  145. }
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  149. }
  150. bool CanActivateCondition(Hashtable hashtable)
  151. {
  152. if (CardEffectCommons.IsExistOnBattleArea(card))
  153. {
  154. return true;
  155. }
  156. return false;
  157. }
  158. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  159. {
  160. if (isExistOnField(card))
  161. {
  162. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  163. {
  164. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  165. {
  166. List<CardSource> selectedCards = new List<CardSource>();
  167. int maxCount = 1;
  168. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  169. selectHandEffect.SetUp(
  170. selectPlayer: card.Owner,
  171. canTargetCondition: CanSelectCardCondition,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canEndSelectCondition: null,
  174. maxCount: maxCount,
  175. canNoSelect: true,
  176. canEndNotMax: false,
  177. isShowOpponent: true,
  178. selectCardCoroutine: SelectCardCoroutine,
  179. afterSelectCardCoroutine: null,
  180. mode: SelectHandEffect.Mode.Custom,
  181. cardEffect: activateClass);
  182. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  183. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  184. yield return StartCoroutine(selectHandEffect.Activate());
  185. IEnumerator SelectCardCoroutine(CardSource cardSource)
  186. {
  187. selectedCards.Add(cardSource);
  188. yield return null;
  189. }
  190. if (selectedCards.Count >= 1)
  191. {
  192. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  193. }
  194. }
  195. bool isJogress = false;
  196. if (_hashtable != null)
  197. {
  198. if (_hashtable.ContainsKey("isJogress"))
  199. {
  200. if (_hashtable["isJogress"] is bool)
  201. {
  202. isJogress = (bool)_hashtable["isJogress"];
  203. }
  204. }
  205. }
  206. if (isJogress)
  207. {
  208. if (card.Owner.HandCards.Count(CanSelectCardCondition1) >= 1)
  209. {
  210. List<CardSource> selectedCards = new List<CardSource>();
  211. int maxCount = 1;
  212. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  213. selectHandEffect.SetUp(
  214. selectPlayer: card.Owner,
  215. canTargetCondition: CanSelectCardCondition1,
  216. canTargetCondition_ByPreSelecetedList: null,
  217. canEndSelectCondition: null,
  218. maxCount: maxCount,
  219. canNoSelect: true,
  220. canEndNotMax: false,
  221. isShowOpponent: true,
  222. selectCardCoroutine: SelectCardCoroutine,
  223. afterSelectCardCoroutine: null,
  224. mode: SelectHandEffect.Mode.Custom,
  225. cardEffect: activateClass);
  226. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  227. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  228. yield return StartCoroutine(selectHandEffect.Activate());
  229. IEnumerator SelectCardCoroutine(CardSource cardSource)
  230. {
  231. selectedCards.Add(cardSource);
  232. yield return null;
  233. }
  234. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  235. }
  236. }
  237. }
  238. }
  239. }
  240. }
  241. if (timing == EffectTiming.OnTappedAnyone)
  242. {
  243. ActivateClass activateClass = new ActivateClass();
  244. activateClass.SetUpICardEffect("Unsuspend this Digimon and suspend 1 Digimon", CanUseCondition, card);
  245. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  246. activateClass.SetHashString("Unsuspen_EX3_074");
  247. cardEffects.Add(activateClass);
  248. string EffectDiscription()
  249. {
  250. return "[All Turns][Once Per Turn] When this Digimon becomes suspended, unsuspend it, and suspend 1 of your opponent's Digimon.";
  251. }
  252. bool CanSelectPermanentCondition(Permanent permanent)
  253. {
  254. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  255. }
  256. bool CanUseCondition(Hashtable hashtable)
  257. {
  258. if (CardEffectCommons.IsExistOnBattleArea(card))
  259. {
  260. if (CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card))
  261. {
  262. return true;
  263. }
  264. }
  265. return false;
  266. }
  267. bool CanActivateCondition(Hashtable hashtable)
  268. {
  269. if (CardEffectCommons.IsExistOnBattleArea(card))
  270. {
  271. return true;
  272. }
  273. return false;
  274. }
  275. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  276. {
  277. if (CardEffectCommons.IsExistOnBattleArea(card))
  278. {
  279. Permanent selectedPermanent = card.PermanentOfThisCard();
  280. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  281. }
  282. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  283. {
  284. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  285. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  286. selectPermanentEffect.SetUp(
  287. selectPlayer: card.Owner,
  288. canTargetCondition: CanSelectPermanentCondition,
  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.Tap,
  297. cardEffect: activateClass);
  298. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  299. }
  300. }
  301. }
  302. return cardEffects;
  303. }
  304. }
  305. }