EX7_073.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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_073 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsTraits("Three Musketeers") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 6 && !targetPermanent.TopCard.EqualsTraits("X Antibody");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region When Digivolving
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Play an Option card from hand", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[When Digivolving] You may use 1 Option card with [Three Musketeers] in its text from your hand without paying the cost.";
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  36. {
  37. if(CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  47. {
  48. return true;
  49. }
  50. return false;
  51. }
  52. bool CanSelectCardCondition(CardSource cardSource)
  53. {
  54. if (cardSource.IsOption)
  55. {
  56. if (cardSource.HasText("Three Musketeers"))
  57. {
  58. if (cardSource.HasUseCost)
  59. {
  60. if (!cardSource.CanNotPlayThisOption)
  61. {
  62. return true;
  63. }
  64. }
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. List<CardSource> selectedCards = new List<CardSource>();
  72. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  73. {
  74. int maxCount = 1;
  75. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  76. selectHandEffect.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: CanSelectCardCondition,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: maxCount,
  82. canNoSelect: true,
  83. canEndNotMax: false,
  84. isShowOpponent: true,
  85. selectCardCoroutine: SelectCardCoroutine,
  86. afterSelectCardCoroutine: null,
  87. mode: SelectHandEffect.Mode.Custom,
  88. cardEffect: activateClass);
  89. selectHandEffect.SetUpCustomMessage(
  90. "Select 1 option card to use.",
  91. "The opponent is selecting 1 option card to use.");
  92. selectHandEffect.SetUpCustomMessage_ShowCard("Used Card");
  93. yield return StartCoroutine(selectHandEffect.Activate());
  94. IEnumerator SelectCardCoroutine(CardSource cardSource)
  95. {
  96. selectedCards.Add(cardSource);
  97. yield return null;
  98. }
  99. }
  100. if (selectedCards.Count >= 1)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(
  103. CardEffectCommons.PlayOptionCards(
  104. cardSources: selectedCards,
  105. activateClass: activateClass,
  106. payCost: false,
  107. root: SelectCardEffect.Root.Hand
  108. )
  109. );
  110. }
  111. }
  112. }
  113. if (timing == EffectTiming.OnEnterFieldAnyone)
  114. {
  115. ActivateClass activateClass = new ActivateClass();
  116. activateClass.SetUpICardEffect("Trash 2 cards to delete 1 Digimon and trash an opponent's security card", CanUseCondition, card);
  117. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  118. cardEffects.Add(activateClass);
  119. string EffectDiscription()
  120. {
  121. return "[When Digivolving] By trashing 2 cards with the [Three Musketeers] trait in this Digimon's digivolution cards, delete 1 of your opponent's Digimon with the highest level and trash the top card of your opponent's security stack.";
  122. }
  123. bool CanSelectCardCondition(CardSource cardSource)
  124. {
  125. if (cardSource.EqualsTraits("Three Musketeers"))
  126. {
  127. if (!cardSource.CanNotTrashFromDigivolutionCards(activateClass))
  128. {
  129. return true;
  130. }
  131. }
  132. return false;
  133. }
  134. bool CanUseCondition(Hashtable hashtable)
  135. {
  136. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  137. {
  138. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  139. {
  140. return true;
  141. }
  142. }
  143. return false;
  144. }
  145. bool CanActivateCondition(Hashtable hashtable)
  146. {
  147. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  148. {
  149. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  150. {
  151. return true;
  152. }
  153. }
  154. return false;
  155. }
  156. bool CanSelectPermanentCondition(Permanent permanent)
  157. {
  158. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  159. {
  160. if (CardEffectCommons.IsMaxLevel(permanent, card.Owner.Enemy))
  161. {
  162. return true;
  163. }
  164. }
  165. return false;
  166. }
  167. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  168. {
  169. if (CardEffectCommons.IsExistOnBattleArea(card))
  170. {
  171. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 2)
  172. {
  173. bool trashed = false;
  174. List<CardSource> selectedCards = new List<CardSource>();
  175. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  176. selectCardEffect.SetUp(
  177. canTargetCondition: CanSelectCardCondition,
  178. canTargetCondition_ByPreSelecetedList: null,
  179. canEndSelectCondition: null,
  180. canNoSelect: () => true,
  181. selectCardCoroutine: SelectCardCoroutine,
  182. afterSelectCardCoroutine: null,
  183. message: "Select 2 cards card to discard.",
  184. maxCount: 2,
  185. canEndNotMax: false,
  186. isShowOpponent: true,
  187. mode: SelectCardEffect.Mode.Custom,
  188. root: SelectCardEffect.Root.Custom,
  189. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  190. canLookReverseCard: true,
  191. selectPlayer: card.Owner,
  192. cardEffect: null);
  193. selectCardEffect.SetUpCustomMessage("Select 2 cards with [Three Musketeers] trait card to discard.", "The opponent is selecting 2 cards card to discard.");
  194. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  195. IEnumerator SelectCardCoroutine(CardSource cardSource)
  196. {
  197. selectedCards.Add(cardSource);
  198. yield return null;
  199. }
  200. if (selectedCards.Count >= 2)
  201. {
  202. yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(card.PermanentOfThisCard(), selectedCards, activateClass).TrashDigivolutionCards());
  203. trashed = true;
  204. }
  205. if (trashed)
  206. {
  207. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  208. {
  209. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  210. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  211. selectPermanentEffect.SetUp(
  212. selectPlayer: card.Owner,
  213. canTargetCondition: CanSelectPermanentCondition,
  214. canTargetCondition_ByPreSelecetedList: null,
  215. canEndSelectCondition: null,
  216. maxCount: maxCount,
  217. canNoSelect: false,
  218. canEndNotMax: false,
  219. selectPermanentCoroutine: null,
  220. afterSelectPermanentCoroutine: null,
  221. mode: SelectPermanentEffect.Mode.Destroy,
  222. cardEffect: activateClass);
  223. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  224. }
  225. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  226. player: card.Owner.Enemy,
  227. destroySecurityCount: 1,
  228. cardEffect: activateClass,
  229. fromTop: true).DestroySecurity());
  230. }
  231. }
  232. }
  233. }
  234. }
  235. #endregion
  236. #region When Attacking
  237. if (timing == EffectTiming.OnAllyAttack)
  238. {
  239. ActivateClass activateClass = new ActivateClass();
  240. activateClass.SetUpICardEffect("Trash 2 cards to delete 1 Digimon and trash an opponent's security card", CanUseCondition, card);
  241. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  242. cardEffects.Add(activateClass);
  243. string EffectDiscription()
  244. {
  245. return "[When Attacking] By trashing 2 cards with the [Three Musketeers] trait in this Digimon's digivolution cards, delete 1 of your opponent's Digimon with the highest level and trash the top card of your opponent's security stack.";
  246. }
  247. bool CanSelectCardCondition(CardSource cardSource)
  248. {
  249. if (cardSource.EqualsTraits("Three Musketeers"))
  250. {
  251. if (!cardSource.CanNotTrashFromDigivolutionCards(activateClass))
  252. {
  253. return true;
  254. }
  255. }
  256. return false;
  257. }
  258. bool CanUseCondition(Hashtable hashtable)
  259. {
  260. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  261. }
  262. bool CanActivateCondition(Hashtable hashtable)
  263. {
  264. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  265. {
  266. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  267. {
  268. return true;
  269. }
  270. }
  271. return false;
  272. }
  273. bool CanSelectPermanentCondition(Permanent permanent)
  274. {
  275. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  276. {
  277. if (CardEffectCommons.IsMaxLevel(permanent, card.Owner.Enemy))
  278. {
  279. return true;
  280. }
  281. }
  282. return false;
  283. }
  284. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  285. {
  286. if (CardEffectCommons.IsExistOnBattleArea(card))
  287. {
  288. if(card.PermanentOfThisCard().DigivolutionCards.Count >= 2)
  289. {
  290. bool trashed = false;
  291. List<CardSource> selectedCards = new List<CardSource>();
  292. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  293. selectCardEffect.SetUp(
  294. canTargetCondition: CanSelectCardCondition,
  295. canTargetCondition_ByPreSelecetedList: null,
  296. canEndSelectCondition: null,
  297. canNoSelect: () => true,
  298. selectCardCoroutine: SelectCardCoroutine,
  299. afterSelectCardCoroutine: null,
  300. message: "Select 2 cards card to discard.",
  301. maxCount: 2,
  302. canEndNotMax: false,
  303. isShowOpponent: true,
  304. mode: SelectCardEffect.Mode.Custom,
  305. root: SelectCardEffect.Root.Custom,
  306. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  307. canLookReverseCard: true,
  308. selectPlayer: card.Owner,
  309. cardEffect: null);
  310. selectCardEffect.SetUpCustomMessage("Select 2 cards with [Three Musketeers] trait card to discard.", "The opponent is selecting 2 cards card to discard.");
  311. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  312. IEnumerator SelectCardCoroutine(CardSource cardSource)
  313. {
  314. selectedCards.Add(cardSource);
  315. yield return null;
  316. }
  317. if (selectedCards.Count >= 2)
  318. {
  319. yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(card.PermanentOfThisCard(), selectedCards, activateClass).TrashDigivolutionCards());
  320. trashed = true;
  321. }
  322. if (trashed)
  323. {
  324. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  325. {
  326. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  327. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  328. selectPermanentEffect.SetUp(
  329. selectPlayer: card.Owner,
  330. canTargetCondition: CanSelectPermanentCondition,
  331. canTargetCondition_ByPreSelecetedList: null,
  332. canEndSelectCondition: null,
  333. maxCount: maxCount,
  334. canNoSelect: false,
  335. canEndNotMax: false,
  336. selectPermanentCoroutine: null,
  337. afterSelectPermanentCoroutine: null,
  338. mode: SelectPermanentEffect.Mode.Destroy,
  339. cardEffect: activateClass);
  340. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  341. }
  342. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  343. player: card.Owner.Enemy,
  344. destroySecurityCount: 1,
  345. cardEffect: activateClass,
  346. fromTop: true).DestroySecurity());
  347. }
  348. }
  349. }
  350. }
  351. }
  352. #endregion
  353. return cardEffects;
  354. }
  355. }
  356. }