BT15_016.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_016 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Opponent's 1 Digimon with 8000 DP or more can't attack and delete 1 Digimon with 6000 DP or less", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] If your opponent has 4 or less memory, 1 of your opponent's Digimon with 8000 DP or more can't attack until the end of their turn. If they have 4 or more, delete 1 of their Digimon with 6000 DP or less.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  25. {
  26. if (permanent.DP >= 8000)
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanSelectPermanentCondition1(Permanent permanent)
  34. {
  35. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  36. {
  37. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (card.Owner.Enemy.MemoryForPlayer <= 4)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  55. {
  56. return true;
  57. }
  58. }
  59. if (card.Owner.Enemy.MemoryForPlayer >= 4)
  60. {
  61. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  62. {
  63. return true;
  64. }
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. if (card.Owner.Enemy.MemoryForPlayer <= 4)
  72. {
  73. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  74. {
  75. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  76. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  77. selectPermanentEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectPermanentCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: false,
  84. canEndNotMax: false,
  85. selectPermanentCoroutine: SelectPermanentCoroutine,
  86. afterSelectPermanentCoroutine: null,
  87. mode: SelectPermanentEffect.Mode.Custom,
  88. cardEffect: activateClass);
  89. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that can't attack", "The opponent is selecting 1 Digimon that can't attack.");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  92. {
  93. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(targetPermanent: permanent, defenderCondition: null, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't Attack"));
  94. }
  95. }
  96. }
  97. if (card.Owner.Enemy.MemoryForPlayer >= 4)
  98. {
  99. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  100. {
  101. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  102. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  103. selectPermanentEffect.SetUp(
  104. selectPlayer: card.Owner,
  105. canTargetCondition: CanSelectPermanentCondition1,
  106. canTargetCondition_ByPreSelecetedList: null,
  107. canEndSelectCondition: null,
  108. maxCount: maxCount,
  109. canNoSelect: false,
  110. canEndNotMax: false,
  111. selectPermanentCoroutine: null,
  112. afterSelectPermanentCoroutine: null,
  113. mode: SelectPermanentEffect.Mode.Destroy,
  114. cardEffect: activateClass);
  115. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  116. }
  117. }
  118. }
  119. }
  120. #endregion
  121. #region When Digivolving
  122. if (timing == EffectTiming.OnEnterFieldAnyone)
  123. {
  124. ActivateClass activateClass = new ActivateClass();
  125. activateClass.SetUpICardEffect("Opponent's 1 Digimon with 8000 DP or more can't attack and delete 1 Digimon with 6000 DP or less", CanUseCondition, card);
  126. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  127. cardEffects.Add(activateClass);
  128. string EffectDiscription()
  129. {
  130. return "[When Digivolving] If your opponent has 4 or less memory, 1 of your opponent's Digimon with 8000 DP or more can't attack until the end of their turn. If they have 4 or more, delete 1 of their Digimon with 6000 DP or less.";
  131. }
  132. bool CanSelectPermanentCondition(Permanent permanent)
  133. {
  134. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  135. {
  136. if (permanent.DP >= 8000)
  137. {
  138. return true;
  139. }
  140. }
  141. return false;
  142. }
  143. bool CanSelectPermanentCondition1(Permanent permanent)
  144. {
  145. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  146. {
  147. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  148. {
  149. return true;
  150. }
  151. }
  152. return false;
  153. }
  154. bool CanUseCondition(Hashtable hashtable)
  155. {
  156. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  157. }
  158. bool CanActivateCondition(Hashtable hashtable)
  159. {
  160. if (CardEffectCommons.IsExistOnBattleArea(card))
  161. {
  162. if (card.Owner.Enemy.MemoryForPlayer <= 4)
  163. {
  164. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  165. {
  166. return true;
  167. }
  168. }
  169. if (card.Owner.Enemy.MemoryForPlayer >= 4)
  170. {
  171. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  172. {
  173. return true;
  174. }
  175. }
  176. }
  177. return false;
  178. }
  179. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  180. {
  181. if (card.Owner.Enemy.MemoryForPlayer <= 4)
  182. {
  183. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  184. {
  185. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  186. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  187. selectPermanentEffect.SetUp(
  188. selectPlayer: card.Owner,
  189. canTargetCondition: CanSelectPermanentCondition,
  190. canTargetCondition_ByPreSelecetedList: null,
  191. canEndSelectCondition: null,
  192. maxCount: maxCount,
  193. canNoSelect: false,
  194. canEndNotMax: false,
  195. selectPermanentCoroutine: SelectPermanentCoroutine,
  196. afterSelectPermanentCoroutine: null,
  197. mode: SelectPermanentEffect.Mode.Custom,
  198. cardEffect: activateClass);
  199. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that can't attack", "The opponent is selecting 1 Digimon that can't attack.");
  200. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  201. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  202. {
  203. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(targetPermanent: permanent, defenderCondition: null, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't Attack"));
  204. }
  205. }
  206. }
  207. if (card.Owner.Enemy.MemoryForPlayer >= 4)
  208. {
  209. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  210. {
  211. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  212. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  213. selectPermanentEffect.SetUp(
  214. selectPlayer: card.Owner,
  215. canTargetCondition: CanSelectPermanentCondition1,
  216. canTargetCondition_ByPreSelecetedList: null,
  217. canEndSelectCondition: null,
  218. maxCount: maxCount,
  219. canNoSelect: false,
  220. canEndNotMax: false,
  221. selectPermanentCoroutine: null,
  222. afterSelectPermanentCoroutine: null,
  223. mode: SelectPermanentEffect.Mode.Destroy,
  224. cardEffect: activateClass);
  225. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  226. }
  227. }
  228. }
  229. }
  230. #endregion
  231. #region On Deletion - Inherited Effect
  232. if (timing == EffectTiming.OnDestroyedAnyone)
  233. {
  234. ActivateClass activateClass = new ActivateClass();
  235. activateClass.SetUpICardEffect("Return 1 Digimon to hand", CanUseCondition, card);
  236. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  237. activateClass.SetIsInheritedEffect(true);
  238. cardEffects.Add(activateClass);
  239. string EffectDiscription()
  240. {
  241. return "[On Deletion] Return 1 of your opponent's Digimon with 7000 DP or less to the hand.";
  242. }
  243. bool CanSelectPermanentCondition(Permanent permanent)
  244. {
  245. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  246. {
  247. if (permanent.DP <= 7000)
  248. {
  249. return true;
  250. }
  251. }
  252. return false;
  253. }
  254. bool CanUseCondition(Hashtable hashtable)
  255. {
  256. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  257. }
  258. bool CanActivateCondition(Hashtable hashtable)
  259. {
  260. if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
  261. {
  262. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  263. {
  264. return true;
  265. }
  266. }
  267. return false;
  268. }
  269. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  270. {
  271. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  272. {
  273. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  274. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  275. selectPermanentEffect.SetUp(
  276. selectPlayer: card.Owner,
  277. canTargetCondition: CanSelectPermanentCondition,
  278. canTargetCondition_ByPreSelecetedList: null,
  279. canEndSelectCondition: null,
  280. maxCount: maxCount,
  281. canNoSelect: false,
  282. canEndNotMax: false,
  283. selectPermanentCoroutine: null,
  284. afterSelectPermanentCoroutine: null,
  285. mode: SelectPermanentEffect.Mode.Bounce,
  286. cardEffect: activateClass);
  287. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  288. }
  289. }
  290. }
  291. #endregion
  292. return cardEffects;
  293. }
  294. }
  295. }