EX7_071.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX7
  6. {
  7. public class EX7_071 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region When Trashed from digivolutions cards
  13. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. activateClass.SetIsInheritedEffect(true);
  19. activateClass.SetIsOptionEffect(true);
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "When an effect trashes this card from your Digimon's digivolution cards, gain 1 memory.";
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. if (CardEffectCommons.CanTriggerOnTrashSelfDigivolutionCard(hashtable, cardEffect => cardEffect != null, card))
  28. {
  29. return true;
  30. }
  31. return false;
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnTrash(card))
  36. {
  37. if (card.Owner.CanAddMemory(activateClass))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  47. }
  48. }
  49. #endregion
  50. #region Ignore Color Requirements
  51. if (timing == EffectTiming.None)
  52. {
  53. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  54. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  55. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  56. cardEffects.Add(ignoreColorConditionClass);
  57. bool CanUseCondition(Hashtable hashtable)
  58. {
  59. if (card.Owner.GetBattleAreaDigimons().Count(permanent => permanent.TopCard.CardTraits.Contains("Three Musketeers")) >= 1 || card.Owner.GetBattleAreaDigimons().Count(permanent => permanent.TopCard.CardTraits.Contains("ThreeMusketeers")) >= 1)
  60. {
  61. return true;
  62. }
  63. return false;
  64. }
  65. bool CardCondition(CardSource cardSource)
  66. {
  67. if (cardSource == card)
  68. {
  69. return true;
  70. }
  71. return false;
  72. }
  73. }
  74. #endregion
  75. #region Shared Conditions
  76. bool CanSelectLevel3Condition(Permanent permanent)
  77. {
  78. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  79. {
  80. if (permanent.TopCard.HasLevel)
  81. {
  82. if (permanent.Level == 3)
  83. {
  84. return true;
  85. }
  86. }
  87. }
  88. return false;
  89. }
  90. bool CanSelectLevel4Condition(Permanent permanent)
  91. {
  92. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  93. {
  94. if (permanent.TopCard.HasLevel)
  95. {
  96. if (permanent.Level == 4)
  97. {
  98. return true;
  99. }
  100. }
  101. }
  102. return false;
  103. }
  104. bool CanSelectLevel5Condition(Permanent permanent)
  105. {
  106. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  107. {
  108. if (permanent.TopCard.HasLevel)
  109. {
  110. if (permanent.Level == 5)
  111. {
  112. return true;
  113. }
  114. }
  115. }
  116. return false;
  117. }
  118. #endregion
  119. #region Main
  120. if (timing == EffectTiming.OptionSkill)
  121. {
  122. ActivateClass activateClass = new ActivateClass();
  123. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  124. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  125. cardEffects.Add(activateClass);
  126. string EffectDiscription()
  127. {
  128. return "[Main] Delete 1 of your opponent's level 3 Digimon, level 4 Digimon, and level 5 Digimon. Then, place this card as the bottom digivolution card of 1 of your Digimon with the [Three Musketeers] trait.";
  129. }
  130. bool CanSelectPermanentCondition(Permanent permanent)
  131. {
  132. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  133. {
  134. if (permanent.TopCard.EqualsTraits("Three Musketeers"))
  135. {
  136. return true;
  137. }
  138. }
  139. return false;
  140. }
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  144. }
  145. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  146. {
  147. List<Permanent> selectedPermanents = new List<Permanent>();
  148. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevel3Condition))
  149. {
  150. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLevel3Condition));
  151. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  152. selectPermanentEffect.SetUp(
  153. selectPlayer: card.Owner,
  154. canTargetCondition: CanSelectLevel3Condition,
  155. canTargetCondition_ByPreSelecetedList: null,
  156. canEndSelectCondition: null,
  157. maxCount: maxCount,
  158. canNoSelect: false,
  159. canEndNotMax: false,
  160. selectPermanentCoroutine: SelectDeletionCoroutine,
  161. afterSelectPermanentCoroutine: null,
  162. mode: SelectPermanentEffect.Mode.Custom,
  163. cardEffect: activateClass);
  164. selectPermanentEffect.SetUpCustomMessage("Select 1 level 3 Digimon to delete.", "The opponent is selecting 1 level 3 Digimon to delete.");
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. }
  167. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevel4Condition))
  168. {
  169. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLevel4Condition));
  170. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  171. selectPermanentEffect.SetUp(
  172. selectPlayer: card.Owner,
  173. canTargetCondition: CanSelectLevel4Condition,
  174. canTargetCondition_ByPreSelecetedList: null,
  175. canEndSelectCondition: null,
  176. maxCount: maxCount,
  177. canNoSelect: false,
  178. canEndNotMax: false,
  179. selectPermanentCoroutine: SelectDeletionCoroutine,
  180. afterSelectPermanentCoroutine: null,
  181. mode: SelectPermanentEffect.Mode.Custom,
  182. cardEffect: activateClass);
  183. selectPermanentEffect.SetUpCustomMessage("Select 1 level 4 Digimon to delete.", "The opponent is selecting 1 level 4 Digimon to delete.");
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. }
  186. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevel5Condition))
  187. {
  188. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLevel5Condition));
  189. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  190. selectPermanentEffect.SetUp(
  191. selectPlayer: card.Owner,
  192. canTargetCondition: CanSelectLevel5Condition,
  193. canTargetCondition_ByPreSelecetedList: null,
  194. canEndSelectCondition: null,
  195. maxCount: maxCount,
  196. canNoSelect: false,
  197. canEndNotMax: false,
  198. selectPermanentCoroutine: SelectDeletionCoroutine,
  199. afterSelectPermanentCoroutine: null,
  200. mode: SelectPermanentEffect.Mode.Custom,
  201. cardEffect: activateClass);
  202. selectPermanentEffect.SetUpCustomMessage("Select 1 level 5 Digimon to delete.", "The opponent is selecting 1 level 5 Digimon to delete.");
  203. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  204. }
  205. IEnumerator SelectDeletionCoroutine(Permanent permanent)
  206. {
  207. selectedPermanents.Add(permanent);
  208. yield return null;
  209. }
  210. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  211. selectedPermanents,
  212. CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  213. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  214. {
  215. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  216. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  217. selectPermanentEffect.SetUp(
  218. selectPlayer: card.Owner,
  219. canTargetCondition: CanSelectPermanentCondition,
  220. canTargetCondition_ByPreSelecetedList: null,
  221. canEndSelectCondition: null,
  222. maxCount: maxCount,
  223. canNoSelect: false,
  224. canEndNotMax: false,
  225. selectPermanentCoroutine: SelectPermanentCoroutine,
  226. afterSelectPermanentCoroutine: null,
  227. mode: SelectPermanentEffect.Mode.Custom,
  228. cardEffect: activateClass);
  229. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  230. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  231. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  232. {
  233. if (permanent != null)
  234. {
  235. yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
  236. yield return ContinuousController.instance.StartCoroutine(permanent.AddDigivolutionCardsBottom(new List<CardSource>() { card }, activateClass));
  237. }
  238. }
  239. }
  240. }
  241. }
  242. #endregion
  243. #region Security
  244. if (timing == EffectTiming.SecuritySkill)
  245. {
  246. ActivateClass activateClass = new ActivateClass();
  247. activateClass.SetUpICardEffect($"Delete 1 opponent's level 3, 4 and 5 Digimon", CanUseCondition, card);
  248. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  249. activateClass.SetIsSecurityEffect(true);
  250. cardEffects.Add(activateClass);
  251. string EffectDiscription()
  252. {
  253. return "[Security] Delete 1 of your opponent's level 3 Digimon, level 4 Digimon, and level 5 Digimon.";
  254. }
  255. bool CanUseCondition(Hashtable hashtable)
  256. {
  257. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  258. }
  259. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  260. {
  261. List<Permanent> selectedPermanents = new List<Permanent>();
  262. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevel3Condition))
  263. {
  264. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLevel3Condition));
  265. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  266. selectPermanentEffect.SetUp(
  267. selectPlayer: card.Owner,
  268. canTargetCondition: CanSelectLevel3Condition,
  269. canTargetCondition_ByPreSelecetedList: null,
  270. canEndSelectCondition: null,
  271. maxCount: maxCount,
  272. canNoSelect: false,
  273. canEndNotMax: false,
  274. selectPermanentCoroutine: SelectPermanentCoroutine,
  275. afterSelectPermanentCoroutine: null,
  276. mode: SelectPermanentEffect.Mode.Custom,
  277. cardEffect: activateClass);
  278. selectPermanentEffect.SetUpCustomMessage("Select 1 level 3 Digimon to delete.", "The opponent is selecting 1 level 3 Digimon to delete.");
  279. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  280. }
  281. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevel4Condition))
  282. {
  283. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLevel4Condition));
  284. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  285. selectPermanentEffect.SetUp(
  286. selectPlayer: card.Owner,
  287. canTargetCondition: CanSelectLevel4Condition,
  288. canTargetCondition_ByPreSelecetedList: null,
  289. canEndSelectCondition: null,
  290. maxCount: maxCount,
  291. canNoSelect: false,
  292. canEndNotMax: false,
  293. selectPermanentCoroutine: SelectPermanentCoroutine,
  294. afterSelectPermanentCoroutine: null,
  295. mode: SelectPermanentEffect.Mode.Custom,
  296. cardEffect: activateClass);
  297. selectPermanentEffect.SetUpCustomMessage("Select 1 level 4 Digimon to delete.", "The opponent is selecting 1 level 4 Digimon to delete.");
  298. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  299. }
  300. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevel5Condition))
  301. {
  302. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLevel5Condition));
  303. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  304. selectPermanentEffect.SetUp(
  305. selectPlayer: card.Owner,
  306. canTargetCondition: CanSelectLevel5Condition,
  307. canTargetCondition_ByPreSelecetedList: null,
  308. canEndSelectCondition: null,
  309. maxCount: maxCount,
  310. canNoSelect: false,
  311. canEndNotMax: false,
  312. selectPermanentCoroutine: SelectPermanentCoroutine,
  313. afterSelectPermanentCoroutine: null,
  314. mode: SelectPermanentEffect.Mode.Custom,
  315. cardEffect: activateClass);
  316. selectPermanentEffect.SetUpCustomMessage("Select 1 level 5 Digimon to delete.", "The opponent is selecting 1 level 5 Digimon to delete.");
  317. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  318. }
  319. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  320. {
  321. selectedPermanents.Add(permanent);
  322. yield return null;
  323. }
  324. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  325. selectedPermanents,
  326. CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  327. }
  328. }
  329. #endregion
  330. return cardEffects;
  331. }
  332. }
  333. }