EX5_020.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX5
  6. {
  7. public class EX5_020 : 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. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4)
  17. {
  18. if (targetPermanent.TopCard.CardTraits.Contains("Light Fang"))
  19. {
  20. return true;
  21. }
  22. if (targetPermanent.TopCard.CardTraits.Contains("LightFang"))
  23. {
  24. return true;
  25. }
  26. if (targetPermanent.TopCard.CardTraits.Contains("Night Claw"))
  27. {
  28. return true;
  29. }
  30. if (targetPermanent.TopCard.CardTraits.Contains("NightClaw"))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  38. }
  39. if (timing == EffectTiming.None)
  40. {
  41. ChangeCostClass changeCostClass = new ChangeCostClass();
  42. changeCostClass.SetUpICardEffect($"Reduce Play Cost", CanUseCondition, card);
  43. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  44. cardEffects.Add(changeCostClass);
  45. bool PermanentCondition(Permanent permanent)
  46. {
  47. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  48. {
  49. if (permanent.DigivolutionCards.Count >= 3)
  50. {
  51. if (permanent.TopCard.CardTraits.Contains("Light Fang"))
  52. {
  53. return true;
  54. }
  55. if (permanent.TopCard.CardTraits.Contains("LightFang"))
  56. {
  57. return true;
  58. }
  59. if (permanent.TopCard.CardTraits.Contains("Night Claw"))
  60. {
  61. return true;
  62. }
  63. if (permanent.TopCard.CardTraits.Contains("NightClaw"))
  64. {
  65. return true;
  66. }
  67. if (permanent.TopCard.CardTraits.Contains("Galaxy"))
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. return false;
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. if (card.PermanentOfThisCard() == null)
  78. {
  79. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  80. {
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  87. {
  88. if (CardSourceCondition(cardSource))
  89. {
  90. if (RootCondition(root))
  91. {
  92. if (PermanentsCondition(targetPermanents))
  93. {
  94. Cost -= 2;
  95. }
  96. }
  97. }
  98. return Cost;
  99. }
  100. bool PermanentsCondition(List<Permanent> targetPermanents)
  101. {
  102. if (targetPermanents == null)
  103. {
  104. return true;
  105. }
  106. else
  107. {
  108. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  109. {
  110. return true;
  111. }
  112. }
  113. return false;
  114. }
  115. bool CardSourceCondition(CardSource cardSource)
  116. {
  117. return cardSource == card;
  118. }
  119. bool RootCondition(SelectCardEffect.Root root)
  120. {
  121. return true;
  122. }
  123. bool isUpDown()
  124. {
  125. return true;
  126. }
  127. }
  128. if (timing == EffectTiming.None)
  129. {
  130. bool PermanentCondition1(Permanent permanent)
  131. {
  132. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  133. {
  134. if (permanent.DigivolutionCards.Count >= 3)
  135. {
  136. if (permanent.TopCard.CardTraits.Contains("Light Fang"))
  137. {
  138. return true;
  139. }
  140. if (permanent.TopCard.CardTraits.Contains("LightFang"))
  141. {
  142. return true;
  143. }
  144. if (permanent.TopCard.CardTraits.Contains("Night Claw"))
  145. {
  146. return true;
  147. }
  148. if (permanent.TopCard.CardTraits.Contains("NightClaw"))
  149. {
  150. return true;
  151. }
  152. if (permanent.TopCard.CardTraits.Contains("Galaxy"))
  153. {
  154. return true;
  155. }
  156. }
  157. }
  158. return false;
  159. }
  160. bool Condition()
  161. {
  162. if (card.PermanentOfThisCard() == null)
  163. {
  164. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition1))
  165. {
  166. return true;
  167. }
  168. }
  169. return false;
  170. }
  171. bool PermanentCondition(Permanent targetPermanent)
  172. {
  173. if (targetPermanent != null)
  174. {
  175. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(targetPermanent, card))
  176. {
  177. return true;
  178. }
  179. }
  180. return false;
  181. }
  182. bool CardSourceCondition(CardSource cardSource)
  183. {
  184. return cardSource == card;
  185. }
  186. bool RootCondition(SelectCardEffect.Root root)
  187. {
  188. return true;
  189. }
  190. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  191. changeValue: -2,
  192. permanentCondition: PermanentCondition,
  193. cardCondition: CardSourceCondition,
  194. rootCondition: RootCondition,
  195. isInheritedEffect: false,
  196. card: card,
  197. condition: Condition,
  198. setFixedCost: false));
  199. }
  200. if (timing == EffectTiming.OnEnterFieldAnyone)
  201. {
  202. ActivateClass activateClass = new ActivateClass();
  203. activateClass.SetUpICardEffect("Opponent's 1 Digimon can't suspend", CanUseCondition, card);
  204. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  205. cardEffects.Add(activateClass);
  206. string EffectDiscription()
  207. {
  208. return "[On Play] 1 of your opponent's Digimon can't suspend until the end of your opponent's turn.";
  209. }
  210. bool CanSelectPermanentCondition(Permanent permanent)
  211. {
  212. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  213. }
  214. bool CanUseCondition(Hashtable hashtable)
  215. {
  216. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  217. }
  218. bool CanActivateCondition(Hashtable hashtable)
  219. {
  220. if (CardEffectCommons.IsExistOnBattleArea(card))
  221. {
  222. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  223. {
  224. return true;
  225. }
  226. }
  227. return false;
  228. }
  229. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  230. {
  231. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  232. {
  233. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  234. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  235. selectPermanentEffect.SetUp(
  236. selectPlayer: card.Owner,
  237. canTargetCondition: CanSelectPermanentCondition,
  238. canTargetCondition_ByPreSelecetedList: null,
  239. canEndSelectCondition: null,
  240. maxCount: maxCount,
  241. canNoSelect: false,
  242. canEndNotMax: false,
  243. selectPermanentCoroutine: SelectPermanentCoroutine,
  244. afterSelectPermanentCoroutine: null,
  245. mode: SelectPermanentEffect.Mode.Custom,
  246. cardEffect: activateClass);
  247. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to suspend.", "The opponent is selecting 1 Digimon that will get unable to suspend.");
  248. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  249. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  250. {
  251. Permanent selectedPermanent = permanent;
  252. if (selectedPermanent != null)
  253. {
  254. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  255. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  256. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  257. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  258. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  259. {
  260. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  261. }
  262. bool CanUseCondition1(Hashtable hashtable)
  263. {
  264. if (selectedPermanent.TopCard != null)
  265. {
  266. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  267. {
  268. return true;
  269. }
  270. }
  271. return false;
  272. }
  273. bool PermanentCondition(Permanent permanent)
  274. {
  275. if (permanent == selectedPermanent)
  276. {
  277. return true;
  278. }
  279. return false;
  280. }
  281. }
  282. }
  283. }
  284. }
  285. }
  286. if (timing == EffectTiming.OnEnterFieldAnyone)
  287. {
  288. ActivateClass activateClass = new ActivateClass();
  289. activateClass.SetUpICardEffect("Opponent's 1 Digimon can't suspend", CanUseCondition, card);
  290. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  291. cardEffects.Add(activateClass);
  292. string EffectDiscription()
  293. {
  294. return "[When Digivolving] 1 of your opponent's Digimon can't suspend until the end of your opponent's turn.";
  295. }
  296. bool CanSelectPermanentCondition(Permanent permanent)
  297. {
  298. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  299. }
  300. bool CanUseCondition(Hashtable hashtable)
  301. {
  302. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  303. }
  304. bool CanActivateCondition(Hashtable hashtable)
  305. {
  306. if (CardEffectCommons.IsExistOnBattleArea(card))
  307. {
  308. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  309. {
  310. return true;
  311. }
  312. }
  313. return false;
  314. }
  315. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  316. {
  317. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  318. {
  319. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  320. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  321. selectPermanentEffect.SetUp(
  322. selectPlayer: card.Owner,
  323. canTargetCondition: CanSelectPermanentCondition,
  324. canTargetCondition_ByPreSelecetedList: null,
  325. canEndSelectCondition: null,
  326. maxCount: maxCount,
  327. canNoSelect: false,
  328. canEndNotMax: false,
  329. selectPermanentCoroutine: SelectPermanentCoroutine,
  330. afterSelectPermanentCoroutine: null,
  331. mode: SelectPermanentEffect.Mode.Custom,
  332. cardEffect: activateClass);
  333. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to suspend.", "The opponent is selecting 1 Digimon that will get unable to suspend.");
  334. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  335. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  336. {
  337. Permanent selectedPermanent = permanent;
  338. if (selectedPermanent != null)
  339. {
  340. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  341. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  342. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  343. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  344. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  345. {
  346. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  347. }
  348. bool CanUseCondition1(Hashtable hashtable)
  349. {
  350. if (selectedPermanent.TopCard != null)
  351. {
  352. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  353. {
  354. return true;
  355. }
  356. }
  357. return false;
  358. }
  359. bool PermanentCondition(Permanent permanent)
  360. {
  361. if (permanent == selectedPermanent)
  362. {
  363. return true;
  364. }
  365. return false;
  366. }
  367. }
  368. }
  369. }
  370. }
  371. }
  372. if (timing == EffectTiming.None)
  373. {
  374. bool Condition()
  375. {
  376. if (CardEffectCommons.IsOpponentTurn(card))
  377. {
  378. return true;
  379. }
  380. return false;
  381. }
  382. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  383. }
  384. return cardEffects;
  385. }
  386. }
  387. }