BT16_012.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_012 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
  12. partitionConditions.Add(new PartitionCondition(4, CardColor.Red));
  13. partitionConditions.Add(new PartitionCondition(4, CardColor.Yellow));
  14. #region Partition
  15. if (timing == EffectTiming.WhenRemoveField)
  16. {
  17. cardEffects.Add(CardEffectFactory.PartitionSelfEffect(
  18. isInheritedEffect: false,
  19. card: card,
  20. condition: null,
  21. cardSourceConditions: partitionConditions)
  22. );
  23. }
  24. #endregion
  25. #region Inherit
  26. if (timing == EffectTiming.WhenRemoveField)
  27. {
  28. cardEffects.Add(CardEffectFactory.PartitionSelfEffect(
  29. isInheritedEffect: true,
  30. card: card,
  31. condition: null,
  32. cardSourceConditions: partitionConditions)
  33. );
  34. }
  35. #endregion
  36. #region DNA
  37. if (timing == EffectTiming.None)
  38. {
  39. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  40. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  41. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  42. addJogressConditionClass.SetNotShowUI(true);
  43. cardEffects.Add(addJogressConditionClass);
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return true;
  47. }
  48. JogressCondition GetJogress(CardSource cardSource)
  49. {
  50. if (cardSource == card)
  51. {
  52. bool PermanentCondition1(Permanent permanent)
  53. {
  54. if (permanent != null)
  55. {
  56. if (permanent.TopCard != null)
  57. {
  58. if (permanent.TopCard.Owner == card.Owner)
  59. {
  60. if (permanent.IsDigimon)
  61. {
  62. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  63. {
  64. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  65. {
  66. if (permanent.Levels_ForJogress(card).Contains(4))
  67. {
  68. return true;
  69. }
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. return false;
  77. }
  78. bool PermanentCondition2(Permanent permanent)
  79. {
  80. if (permanent != null)
  81. {
  82. if (permanent.TopCard != null)
  83. {
  84. if (permanent.TopCard.Owner == card.Owner)
  85. {
  86. if (permanent.IsDigimon)
  87. {
  88. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  89. {
  90. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  91. {
  92. if (permanent.Levels_ForJogress(card).Contains(4))
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. }
  99. }
  100. }
  101. }
  102. return false;
  103. }
  104. JogressConditionElement[] elements = new JogressConditionElement[]
  105. {
  106. new JogressConditionElement(PermanentCondition1, "a level 4 red Digimon"),
  107. new JogressConditionElement(PermanentCondition2, "a level 4 yellow Digimon"),
  108. };
  109. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  110. return jogressCondition;
  111. }
  112. return null;
  113. }
  114. }
  115. #endregion
  116. #region When Digivolving
  117. if (timing == EffectTiming.OnEnterFieldAnyone)
  118. {
  119. ActivateClass activateClass = new ActivateClass();
  120. activateClass.SetUpICardEffect("Give 1 of your opponent's Digimon -7000 DP.", CanUseCondition, card);
  121. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  122. activateClass.SetHashString("Minus7000DP_BT16_012");
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[When Digivolving] If DNA digivolving, 1 of your opponent's Digimon gets -7000 DP until the end of your opponent's turn.";
  127. }
  128. bool CanSelectPermanentCondition(Permanent permanent)
  129. {
  130. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  131. }
  132. bool CanUseCondition(Hashtable hashtable)
  133. {
  134. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  135. }
  136. bool CanActivateCondition(Hashtable hashtable)
  137. {
  138. if (CardEffectCommons.IsExistOnBattleArea(card))
  139. {
  140. return CardEffectCommons.IsJogress(hashtable);
  141. }
  142. return false;
  143. }
  144. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  145. {
  146. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  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: SelectPermanentCoroutine,
  161. afterSelectPermanentCoroutine: null,
  162. mode: SelectPermanentEffect.Mode.Custom,
  163. cardEffect: activateClass);
  164. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -7000.", "The opponent is selecting 1 Digimon that will get DP -7000.");
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  167. {
  168. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -7000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  169. }
  170. }
  171. }
  172. }
  173. }
  174. #endregion
  175. #region When Digivolving - Delete opponents 4k <
  176. if (timing == EffectTiming.OnEnterFieldAnyone)
  177. {
  178. ActivateClass activateClass = new ActivateClass();
  179. activateClass.SetUpICardEffect("Delete 1 of your opponent's Digimon with 4000 DP or less.", CanUseCondition, card);
  180. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  181. activateClass.SetHashString("Delete4000DPorLess_BT16_012");
  182. cardEffects.Add(activateClass);
  183. string EffectDiscription()
  184. {
  185. return "[When Digivolving] Delete 1 of your opponent's Digimon with 4000 DP or less.";
  186. }
  187. bool CanSelectPermanentCondition(Permanent permanent)
  188. {
  189. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  190. {
  191. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  192. {
  193. return true;
  194. }
  195. }
  196. return false;
  197. }
  198. bool CanUseCondition(Hashtable hashtable)
  199. {
  200. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  201. }
  202. bool CanActivateCondition(Hashtable hashtable)
  203. {
  204. if (CardEffectCommons.IsExistOnBattleArea(card))
  205. {
  206. return true;
  207. }
  208. return false;
  209. }
  210. IEnumerator ActivateCoroutine(Hashtable hashtable)
  211. {
  212. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  213. {
  214. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  215. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  216. selectPermanentEffect.SetUp(
  217. selectPlayer: card.Owner,
  218. canTargetCondition: CanSelectPermanentCondition,
  219. canTargetCondition_ByPreSelecetedList: null,
  220. canEndSelectCondition: null,
  221. maxCount: maxCount,
  222. canNoSelect: false,
  223. canEndNotMax: false,
  224. selectPermanentCoroutine: null,
  225. afterSelectPermanentCoroutine: null,
  226. mode: SelectPermanentEffect.Mode.Destroy,
  227. cardEffect: activateClass);
  228. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  229. }
  230. }
  231. }
  232. #endregion
  233. #region When Attacking
  234. if (timing == EffectTiming.OnAllyAttack)
  235. {
  236. ActivateClass activateClass = new ActivateClass();
  237. activateClass.SetUpICardEffect("Delete 1 of your opponent's Digimon with 4000 DP or less.", CanUseCondition, card);
  238. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  239. activateClass.SetHashString("Delete4000DPorLess_BT16_012");
  240. cardEffects.Add(activateClass);
  241. string EffectDiscription()
  242. {
  243. return "[When Attacking] Delete 1 of your opponent's Digimon with 4000 DP or less.";
  244. }
  245. bool CanSelectPermanentCondition(Permanent permanent)
  246. {
  247. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  248. {
  249. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  250. {
  251. return true;
  252. }
  253. }
  254. return false;
  255. }
  256. bool CanUseCondition(Hashtable hashtable)
  257. {
  258. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  259. }
  260. bool CanActivateCondition(Hashtable hashtable)
  261. {
  262. if (CardEffectCommons.IsExistOnBattleArea(card))
  263. {
  264. return true;
  265. }
  266. return false;
  267. }
  268. IEnumerator ActivateCoroutine(Hashtable hashtable)
  269. {
  270. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  271. {
  272. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  273. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  274. selectPermanentEffect.SetUp(
  275. selectPlayer: card.Owner,
  276. canTargetCondition: CanSelectPermanentCondition,
  277. canTargetCondition_ByPreSelecetedList: null,
  278. canEndSelectCondition: null,
  279. maxCount: maxCount,
  280. canNoSelect: false,
  281. canEndNotMax: false,
  282. selectPermanentCoroutine: null,
  283. afterSelectPermanentCoroutine: null,
  284. mode: SelectPermanentEffect.Mode.Destroy,
  285. cardEffect: activateClass);
  286. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  287. }
  288. }
  289. }
  290. #endregion
  291. return cardEffects;
  292. }
  293. }
  294. }