EX7_066.cs 14 KB

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