MetalEtemon_BT18_041.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class MetalEtemon_BT18_041 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5)
  17. return targetPermanent.TopCard.EqualsTraits("NSp");
  18. return false;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region DNA Digivolution
  30. if (timing == EffectTiming.None)
  31. {
  32. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  33. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  34. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  35. addJogressConditionClass.SetNotShowUI(true);
  36. cardEffects.Add(addJogressConditionClass);
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return true;
  40. }
  41. JogressCondition GetJogress(CardSource cardSource)
  42. {
  43. if (cardSource == card)
  44. {
  45. bool PermanentCondition1(Permanent permanent)
  46. {
  47. if (permanent != null)
  48. {
  49. if (permanent.TopCard != null)
  50. {
  51. if (permanent.TopCard.Owner == card.Owner)
  52. {
  53. if (permanent.IsDigimon)
  54. {
  55. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  56. {
  57. if (permanent.TopCard.CardColors.Contains(CardColor.Blue) || permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  58. {
  59. if (permanent.Levels_ForJogress(card).Contains(5))
  60. {
  61. return true;
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. return false;
  70. }
  71. bool PermanentCondition2(Permanent permanent)
  72. {
  73. if (permanent != null)
  74. {
  75. if (permanent.TopCard != null)
  76. {
  77. if (permanent.TopCard.Owner == card.Owner)
  78. {
  79. if (permanent.IsDigimon)
  80. {
  81. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  82. {
  83. if (permanent.TopCard.CardColors.Contains(CardColor.Black) || permanent.TopCard.CardColors.Contains(CardColor.Green))
  84. {
  85. if (permanent.Levels_ForJogress(card).Contains(5))
  86. {
  87. return true;
  88. }
  89. }
  90. }
  91. }
  92. }
  93. }
  94. }
  95. return false;
  96. }
  97. JogressConditionElement[] elements =
  98. {
  99. new(PermanentCondition1, "a level 5 Blue or Yellow Digimon"),
  100. new(PermanentCondition2, "a level 5 Black or Green Digimon")
  101. };
  102. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  103. return jogressCondition;
  104. }
  105. return null;
  106. }
  107. }
  108. #endregion
  109. #region On Play
  110. if (timing == EffectTiming.OnEnterFieldAnyone)
  111. {
  112. ActivateClass activateClass = new ActivateClass();
  113. activateClass.SetUpICardEffect("One opponents Digimon gets Security Attack -2, then an opponents Digimon gets De-Digivolve -1", CanUseCondition, card);
  114. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  115. cardEffects.Add(activateClass);
  116. string EffectDiscription()
  117. {
  118. return "[On Play] 1 of your opponent's Digimon gains <Security Attack -2> until the end of their turn. Then, <De-Digivolve> 1 of your opponent's Digimon.";
  119. }
  120. bool CanSelectPermanentCondition(Permanent permanent)
  121. {
  122. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  123. }
  124. bool CanUseCondition(Hashtable hashtable)
  125. {
  126. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  127. }
  128. bool CanActivateCondition(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  131. {
  132. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  133. {
  134. return true;
  135. }
  136. }
  137. return false;
  138. }
  139. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  140. {
  141. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  142. {
  143. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  144. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  145. selectPermanentEffect.SetUp(
  146. selectPlayer: card.Owner,
  147. canTargetCondition: CanSelectPermanentCondition,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: null,
  150. maxCount: maxCount,
  151. canNoSelect: false,
  152. canEndNotMax: false,
  153. selectPermanentCoroutine: SelectPermanentCoroutine,
  154. afterSelectPermanentCoroutine: null,
  155. mode: SelectPermanentEffect.Mode.Custom,
  156. cardEffect: activateClass);
  157. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -2.", "The opponent is selecting 1 Digimon that will get Security Attack -2.");
  158. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  159. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  160. {
  161. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -2, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  162. }
  163. }
  164. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  165. {
  166. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  167. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  168. selectPermanentEffect.SetUp(
  169. selectPlayer: card.Owner,
  170. canTargetCondition: CanSelectPermanentCondition,
  171. canTargetCondition_ByPreSelecetedList: null,
  172. canEndSelectCondition: null,
  173. maxCount: maxCount,
  174. canNoSelect: false,
  175. canEndNotMax: false,
  176. selectPermanentCoroutine: SelectPermanentCoroutine,
  177. afterSelectPermanentCoroutine: null,
  178. mode: SelectPermanentEffect.Mode.Custom,
  179. cardEffect: activateClass);
  180. selectPermanentEffect.SetUpCustomMessage(
  181. "Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  182. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  183. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  184. {
  185. Permanent selectedPermanent = permanent;
  186. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  187. }
  188. }
  189. }
  190. }
  191. #endregion
  192. #region When Digivolving
  193. if (timing == EffectTiming.OnEnterFieldAnyone)
  194. {
  195. ActivateClass activateClass = new ActivateClass();
  196. activateClass.SetUpICardEffect("One opponents Digimon gets Security Attack -2, then an opponents Digimon gets De-Digivolve -1", CanUseCondition, card);
  197. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  198. cardEffects.Add(activateClass);
  199. string EffectDiscription()
  200. {
  201. return "[When Digivolving] 1 of your opponent's Digimon gains <Security Attack -2> until the end of their turn. Then, <De-Digivolve> 1 of your opponent's Digimon.";
  202. }
  203. bool CanSelectPermanentCondition(Permanent permanent)
  204. {
  205. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  206. }
  207. bool CanUseCondition(Hashtable hashtable)
  208. {
  209. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  210. {
  211. if(CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  212. {
  213. return true;
  214. }
  215. }
  216. return false;
  217. }
  218. bool CanActivateCondition(Hashtable hashtable)
  219. {
  220. if (CardEffectCommons.IsExistOnBattleAreaDigimon(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 (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  232. {
  233. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(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 Security Attack -2.", "The opponent is selecting 1 Digimon that will get Security Attack -2.");
  248. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  249. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  250. {
  251. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -2, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  252. }
  253. }
  254. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  255. {
  256. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  257. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  258. selectPermanentEffect.SetUp(
  259. selectPlayer: card.Owner,
  260. canTargetCondition: CanSelectPermanentCondition,
  261. canTargetCondition_ByPreSelecetedList: null,
  262. canEndSelectCondition: null,
  263. maxCount: maxCount,
  264. canNoSelect: false,
  265. canEndNotMax: false,
  266. selectPermanentCoroutine: SelectPermanentCoroutine,
  267. afterSelectPermanentCoroutine: null,
  268. mode: SelectPermanentEffect.Mode.Custom,
  269. cardEffect: activateClass);
  270. selectPermanentEffect.SetUpCustomMessage(
  271. "Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  272. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  273. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  274. {
  275. Permanent selectedPermanent = permanent;
  276. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  277. }
  278. }
  279. }
  280. }
  281. #endregion
  282. #region On Deletion
  283. if (timing == EffectTiming.OnDestroyedAnyone)
  284. {
  285. ActivateClass activateClass = new ActivateClass();
  286. activateClass.SetUpICardEffect("One opponents Digimon gets Security Attack -2, then an opponents Digimon gets De-Digivolve -1", CanUseCondition, card);
  287. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  288. cardEffects.Add(activateClass);
  289. string EffectDiscription()
  290. {
  291. return "[On Deletion] 1 of your opponent's Digimon gains <Security Attack -2> until the end of their turn. Then, <De-Digivolve> 1 of your opponent's Digimon.";
  292. }
  293. bool CanSelectPermanentCondition(Permanent permanent)
  294. {
  295. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  296. }
  297. bool CanUseCondition(Hashtable hashtable)
  298. {
  299. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  300. }
  301. bool CanActivateCondition(Hashtable hashtable)
  302. {
  303. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  304. {
  305. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  306. {
  307. return true;
  308. }
  309. }
  310. return false;
  311. }
  312. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  313. {
  314. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  315. {
  316. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  317. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  318. selectPermanentEffect.SetUp(
  319. selectPlayer: card.Owner,
  320. canTargetCondition: CanSelectPermanentCondition,
  321. canTargetCondition_ByPreSelecetedList: null,
  322. canEndSelectCondition: null,
  323. maxCount: maxCount,
  324. canNoSelect: false,
  325. canEndNotMax: false,
  326. selectPermanentCoroutine: SelectPermanentCoroutine,
  327. afterSelectPermanentCoroutine: null,
  328. mode: SelectPermanentEffect.Mode.Custom,
  329. cardEffect: activateClass);
  330. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -2.", "The opponent is selecting 1 Digimon that will get Security Attack -2.");
  331. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  332. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  333. {
  334. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -2, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  335. }
  336. }
  337. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  338. {
  339. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  340. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  341. selectPermanentEffect.SetUp(
  342. selectPlayer: card.Owner,
  343. canTargetCondition: CanSelectPermanentCondition,
  344. canTargetCondition_ByPreSelecetedList: null,
  345. canEndSelectCondition: null,
  346. maxCount: maxCount,
  347. canNoSelect: false,
  348. canEndNotMax: false,
  349. selectPermanentCoroutine: SelectPermanentCoroutine,
  350. afterSelectPermanentCoroutine: null,
  351. mode: SelectPermanentEffect.Mode.Custom,
  352. cardEffect: activateClass);
  353. selectPermanentEffect.SetUpCustomMessage(
  354. "Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  355. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  356. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  357. {
  358. Permanent selectedPermanent = permanent;
  359. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  360. }
  361. }
  362. }
  363. }
  364. #endregion
  365. return cardEffects;
  366. }
  367. }
  368. }