ChaosTriangular_EX7_066.cs 13 KB

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