EX7_066.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5. using System.Linq;
  6. using Unity.Burst.Intrinsics;
  7. namespace DCGO.CardEffects.EX7
  8. {
  9. public class EX7_066 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. #region When Trashed from digivolutions
  15. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("+3000DP", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. activateClass.SetIsInheritedEffect(true);
  21. activateClass.SetIsOptionEffect(true);
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. return "When an effect trashes this digivolution card, 1 of your Digimon gets +3000 DP until the end of your opponent's turn.";
  26. }
  27. bool CanSelectPermanentCondition(Permanent permanent)
  28. {
  29. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.CanTriggerOnTrashSelfDigivolutionCard(hashtable, cardEffect => cardEffect != null, card);
  34. }
  35. bool CanActivateCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.IsExistOnTrash(card) &&
  38. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  41. {
  42. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  43. {
  44. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  45. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  46. selectPermanentEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: CanSelectPermanentCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: maxCount,
  52. canNoSelect: false,
  53. canEndNotMax: false,
  54. selectPermanentCoroutine: SelectPermanentCoroutine,
  55. afterSelectPermanentCoroutine: null,
  56. mode: SelectPermanentEffect.Mode.Custom,
  57. cardEffect: activateClass);
  58. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP +3000.", "The opponent is selecting 1 Digimon that will get DP +3000.");
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: 3000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  63. }
  64. }
  65. }
  66. }
  67. #endregion
  68. #region Ignore Color Requirements
  69. if (timing == EffectTiming.None)
  70. {
  71. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  72. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  73. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  74. cardEffects.Add(ignoreColorConditionClass);
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. if (card.Owner.GetBattleAreaDigimons().Count(permanent => permanent.TopCard.EqualsTraits("Three Musketeers")) >= 1)
  78. {
  79. return true;
  80. }
  81. return false;
  82. }
  83. bool CardCondition(CardSource cardSource)
  84. {
  85. if (cardSource == card)
  86. {
  87. return true;
  88. }
  89. return false;
  90. }
  91. }
  92. #endregion
  93. #region Main
  94. if (timing == EffectTiming.OptionSkill)
  95. {
  96. int count()
  97. {
  98. List<Permanent> cards = new List<Permanent>();
  99. List<Permanent> choices = card.Owner.GetBattleAreaDigimons();
  100. choices = choices.Filter(permanent => permanent.TopCard.EqualsTraits("Three Musketeers"));
  101. foreach (Permanent selection in choices)
  102. {
  103. if (!cards.Some(permanent => permanent.TopCard.HasSameCardName(selection.TopCard)))
  104. cards.Add(selection);
  105. }
  106. return cards.Count;
  107. }
  108. int maxDP()
  109. {
  110. return 9000 + (3000 * count());
  111. }
  112. ActivateClass activateClass = new ActivateClass();
  113. activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card);
  114. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  115. cardEffects.Add(activateClass);
  116. string EffectDiscription()
  117. {
  118. return "[Main] Delete 1 of your opponent's Digimon with 9000 DP or less. For each your Digimon with the [Three Musketeers] trait with different names, add 3000 to this DP-Based deletion effects maximum. Then, place this card as the bottom digivolution card of 1 of your Digimon with the [Three Musketeers] trait.";
  119. }
  120. bool CanSelectPermanentCondition(Permanent permanent)
  121. {
  122. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  123. {
  124. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(maxDP(), activateClass))
  125. {
  126. return true;
  127. }
  128. }
  129. return false;
  130. }
  131. bool CanSelectPermanentCondition1(Permanent permanent)
  132. {
  133. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  134. {
  135. if (permanent.TopCard.CardTraits.Contains("Three Musketeers") || permanent.TopCard.CardTraits.Contains("ThreeMusketeers"))
  136. {
  137. return true;
  138. }
  139. }
  140. return false;
  141. }
  142. bool CanUseCondition(Hashtable hashtable)
  143. {
  144. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  145. }
  146. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  147. {
  148. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  149. {
  150. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  151. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  152. selectPermanentEffect.SetUp(
  153. selectPlayer: card.Owner,
  154. canTargetCondition: CanSelectPermanentCondition,
  155. canTargetCondition_ByPreSelecetedList: null,
  156. canEndSelectCondition: null,
  157. maxCount: maxCount,
  158. canNoSelect: false,
  159. canEndNotMax: false,
  160. selectPermanentCoroutine: null,
  161. afterSelectPermanentCoroutine: null,
  162. mode: SelectPermanentEffect.Mode.Destroy,
  163. cardEffect: activateClass);
  164. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  165. }
  166. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  167. {
  168. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  169. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  170. selectPermanentEffect.SetUp(
  171. selectPlayer: card.Owner,
  172. canTargetCondition: CanSelectPermanentCondition1,
  173. canTargetCondition_ByPreSelecetedList: null,
  174. canEndSelectCondition: null,
  175. maxCount: maxCount,
  176. canNoSelect: false,
  177. canEndNotMax: false,
  178. selectPermanentCoroutine: SelectPermanentCoroutine,
  179. afterSelectPermanentCoroutine: null,
  180. mode: SelectPermanentEffect.Mode.Custom,
  181. cardEffect: activateClass);
  182. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  183. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  184. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  185. {
  186. if (permanent != null)
  187. {
  188. yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
  189. yield return ContinuousController.instance.StartCoroutine(permanent.AddDigivolutionCardsBottom(new List<CardSource>() { card }, activateClass));
  190. }
  191. }
  192. }
  193. }
  194. }
  195. #endregion
  196. #region Security
  197. if (timing == EffectTiming.SecuritySkill)
  198. {
  199. ActivateClass activateClass = new ActivateClass();
  200. activateClass.SetUpICardEffect($"Delete 1 Digimon with 12000 DP or less", CanUseCondition, card);
  201. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  202. activateClass.SetIsSecurityEffect(true);
  203. cardEffects.Add(activateClass);
  204. string EffectDiscription()
  205. {
  206. return "[Security] Delete 1 of your opponent's Digimon with 12000 DP or less.";
  207. }
  208. bool CanSelectPermanentCondition(Permanent permanent)
  209. {
  210. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  211. {
  212. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(12000, activateClass))
  213. {
  214. return true;
  215. }
  216. }
  217. return false;
  218. }
  219. bool CanUseCondition(Hashtable hashtable)
  220. {
  221. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  222. }
  223. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  224. {
  225. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  226. {
  227. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  228. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  229. selectPermanentEffect.SetUp(
  230. selectPlayer: card.Owner,
  231. canTargetCondition: CanSelectPermanentCondition,
  232. canTargetCondition_ByPreSelecetedList: null,
  233. canEndSelectCondition: null,
  234. maxCount: maxCount,
  235. canNoSelect: false,
  236. canEndNotMax: false,
  237. selectPermanentCoroutine: null,
  238. afterSelectPermanentCoroutine: null,
  239. mode: SelectPermanentEffect.Mode.Destroy,
  240. cardEffect: activateClass);
  241. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  242. }
  243. }
  244. }
  245. #endregion
  246. return cardEffects;
  247. }
  248. }
  249. }