BT16_036.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_036 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  15. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  16. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  17. addJogressConditionClass.SetNotShowUI(true);
  18. cardEffects.Add(addJogressConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return true;
  22. }
  23. JogressCondition GetJogress(CardSource cardSource)
  24. {
  25. if (cardSource == card)
  26. {
  27. bool PermanentCondition1(Permanent permanent)
  28. {
  29. if (permanent != null)
  30. {
  31. if (permanent.TopCard != null)
  32. {
  33. if (permanent.TopCard.Owner == card.Owner)
  34. {
  35. if (permanent.IsDigimon)
  36. {
  37. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  38. {
  39. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  40. {
  41. if (permanent.Levels_ForJogress(card).Contains(6))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. bool PermanentCondition2(Permanent permanent)
  54. {
  55. if (permanent != null)
  56. {
  57. if (permanent.TopCard != null)
  58. {
  59. if (permanent.TopCard.Owner == card.Owner)
  60. {
  61. if (permanent.IsDigimon)
  62. {
  63. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  64. {
  65. if (permanent.TopCard.CardColors.Contains(CardColor.Black))
  66. {
  67. if (permanent.Levels_ForJogress(card).Contains(6))
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. JogressConditionElement[] elements = new JogressConditionElement[]
  80. {
  81. new JogressConditionElement(PermanentCondition1, "a level 6 yellow Digimon"),
  82. new JogressConditionElement(PermanentCondition2, "a level 6 black Digimon"),
  83. };
  84. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  85. return jogressCondition;
  86. }
  87. return null;
  88. }
  89. }
  90. #endregion
  91. #region Barrier, Blocker and Partition
  92. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  93. {
  94. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: false, card: card, condition: null));
  95. }
  96. if (timing == EffectTiming.None)
  97. {
  98. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  99. }
  100. if (timing == EffectTiming.WhenRemoveField)
  101. {
  102. List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
  103. partitionConditions.Add(new PartitionCondition(6, CardColor.Black));
  104. partitionConditions.Add(new PartitionCondition(6, CardColor.Yellow));
  105. cardEffects.Add(CardEffectFactory.PartitionSelfEffect
  106. (isInheritedEffect: false,
  107. card: card,
  108. condition: null,
  109. cardSourceConditions: partitionConditions));
  110. }
  111. #endregion
  112. #region When Digivolving
  113. if (timing == EffectTiming.OnEnterFieldAnyone)
  114. {
  115. ActivateClass activateClass = new ActivateClass();
  116. activateClass.SetUpICardEffect("De-Digivolve 3 and -8000 DP on one of your opponent's Digimon", CanUseCondition, card);
  117. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  118. cardEffects.Add(activateClass);
  119. string EffectDiscription()
  120. {
  121. return "[When Digivolving] [De-Digivolve 3] 1 of your opponent's Digimon. Then, 1 of you your opponent's Digimon gets -8000 DP for the turn.";
  122. }
  123. bool CanSelectPermanentCondition(Permanent permanent)
  124. {
  125. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  126. }
  127. bool CanSelectSecondPermanentCondition(Permanent permanent)
  128. {
  129. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  130. }
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. if (CardEffectCommons.IsExistOnBattleArea(card))
  134. {
  135. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  136. {
  137. return true;
  138. }
  139. }
  140. return false;
  141. }
  142. bool CanActivateCondition(Hashtable hashtable)
  143. {
  144. if (CardEffectCommons.IsExistOnBattleArea(card))
  145. {
  146. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  147. {
  148. return true;
  149. }
  150. }
  151. return false;
  152. }
  153. IEnumerator ActivateCoroutine(Hashtable hashtable)
  154. {
  155. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  156. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  157. selectPermanentEffect.SetUp(
  158. selectPlayer: card.Owner,
  159. canTargetCondition: CanSelectPermanentCondition,
  160. canTargetCondition_ByPreSelecetedList: null,
  161. canEndSelectCondition: null,
  162. maxCount: maxCount,
  163. canNoSelect: false,
  164. canEndNotMax: false,
  165. selectPermanentCoroutine: SelectPermanentCoroutine,
  166. afterSelectPermanentCoroutine: null,
  167. mode: SelectPermanentEffect.Mode.Custom,
  168. cardEffect: activateClass);
  169. selectPermanentEffect.SetUpCustomMessage(
  170. "Select 1 Digimon to De-Digivolve.",
  171. "The opponent is selecting 1 Digimon to De-Digivolve.");
  172. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  173. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  174. {
  175. Permanent selectedPermanent = permanent;
  176. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(
  177. selectedPermanent,
  178. 3,
  179. activateClass).Degeneration());
  180. }
  181. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecondPermanentCondition))
  182. {
  183. int maxCountMinus = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectSecondPermanentCondition));
  184. SelectPermanentEffect selectSecondPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  185. selectPermanentEffect.SetUp(
  186. selectPlayer: card.Owner,
  187. canTargetCondition: CanSelectSecondPermanentCondition,
  188. canTargetCondition_ByPreSelecetedList: null,
  189. canEndSelectCondition: null,
  190. maxCount: maxCount,
  191. canNoSelect: false,
  192. canEndNotMax: false,
  193. selectPermanentCoroutine: SelectSecondPermanentCoroutine,
  194. afterSelectPermanentCoroutine: null,
  195. mode: SelectPermanentEffect.Mode.Custom,
  196. cardEffect: activateClass);
  197. selectPermanentEffect.SetUpCustomMessage(
  198. "Select 1 Digimon to give -8000 DP.",
  199. "The opponent is selecting 1 Digimon to give -8000 DP.");
  200. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  201. IEnumerator SelectSecondPermanentCoroutine(Permanent permanent)
  202. {
  203. Permanent selectedPermanent = permanent;
  204. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  205. selectedPermanent,
  206. -8000,
  207. EffectDuration.UntilEachTurnEnd,
  208. activateClass)
  209. );
  210. }
  211. }
  212. }
  213. }
  214. #endregion
  215. #region End of Opponent's Turn
  216. if (timing == EffectTiming.OnEndTurn)
  217. {
  218. ActivateClass activateClass = new ActivateClass();
  219. activateClass.SetUpICardEffect("Trash 1 security from both players", CanUseCondition, card);
  220. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  221. cardEffects.Add(activateClass);
  222. string EffectDiscription()
  223. {
  224. return "[End of Opponent's Turn] Trash 1 card from the top of both players' security stacks.";
  225. }
  226. bool CanActivateCondition(Hashtable hashtable)
  227. {
  228. if (CardEffectCommons.IsExistOnBattleArea(card))
  229. {
  230. return true;
  231. }
  232. return false;
  233. }
  234. bool CanUseCondition(Hashtable hashtable)
  235. {
  236. if (CardEffectCommons.IsExistOnBattleArea(card))
  237. {
  238. if (CardEffectCommons.IsOpponentTurn(card))
  239. {
  240. return true;
  241. }
  242. }
  243. return false;
  244. }
  245. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  246. {
  247. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  248. {
  249. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  250. player: player,
  251. destroySecurityCount: 1,
  252. cardEffect: activateClass,
  253. fromTop: true).DestroySecurity());
  254. }
  255. }
  256. }
  257. #endregion
  258. return cardEffects;
  259. }
  260. }
  261. }