BT16_034.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_034 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.HasText("Pulsemon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region On Play
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Minus DP and/or Security -2 to one of your opponent's Digimon.", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  27. activateClass.SetHashString("OnPlay_BT16_034");
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[On Play] If you have 3 or more security cards, 1 of your opponent's Digimon gets -4000 DP until the end of their turn. If you have 3 or fewer security cards, 1 of your opponent's Digimon gains [Security A-2] until the end of their turn.";
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  36. }
  37. bool PermanentCondition(Permanent permanent)
  38. {
  39. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  40. {
  41. return true;
  42. }
  43. return false;
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (card.Owner.SecurityCards.Count >= 3)
  50. {
  51. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition))
  52. {
  53. return true;
  54. }
  55. }
  56. if (card.Owner.SecurityCards.Count <= 3)
  57. {
  58. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition))
  59. {
  60. return true;
  61. }
  62. }
  63. }
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable hashtable)
  67. {
  68. if (card.Owner.SecurityCards.Count >= 3)
  69. {
  70. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: PermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: SelectPermanentCoroutine,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.", "The opponent is selecting 1 Digimon that will get DP -4000.");
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  87. {
  88. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -4000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  89. }
  90. }
  91. if (card.Owner.SecurityCards.Count <= 3)
  92. {
  93. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  94. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  95. selectPermanentEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition: PermanentCondition,
  98. canTargetCondition_ByPreSelecetedList: null,
  99. canEndSelectCondition: null,
  100. maxCount: maxCount,
  101. canNoSelect: false,
  102. canEndNotMax: false,
  103. selectPermanentCoroutine: SelectPermanentCoroutine,
  104. afterSelectPermanentCoroutine: null,
  105. mode: SelectPermanentEffect.Mode.Custom,
  106. cardEffect: activateClass);
  107. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -2", "The opponent is selecting 1 Digimon that will get Security Attack -2.");
  108. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  109. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -2, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  112. }
  113. }
  114. }
  115. }
  116. #endregion
  117. #region When Digivolving
  118. if (timing == EffectTiming.OnEnterFieldAnyone)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect("Minus DP and/or Security -2 to one of your opponent's Digimon.", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  123. activateClass.SetHashString("Digivolving_BT16_034");
  124. cardEffects.Add(activateClass);
  125. string EffectDiscription()
  126. {
  127. return "[On Play] If you have 3 or more security cards, 1 of your opponent's Digimon gets -4000 DP until the end of their turn. If you have 3 or fewer security cards, 1 of your opponent's Digimon gains [Security A-2] until the end of their turn.";
  128. }
  129. bool CanUseCondition(Hashtable hashtable)
  130. {
  131. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  132. }
  133. bool PermanentCondition(Permanent permanent)
  134. {
  135. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  136. {
  137. return true;
  138. }
  139. return false;
  140. }
  141. bool CanActivateCondition(Hashtable hashtable)
  142. {
  143. if (CardEffectCommons.IsExistOnBattleArea(card))
  144. {
  145. if (card.Owner.SecurityCards.Count >= 3)
  146. {
  147. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition))
  148. {
  149. return true;
  150. }
  151. }
  152. if (card.Owner.SecurityCards.Count <= 3)
  153. {
  154. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition))
  155. {
  156. return true;
  157. }
  158. }
  159. }
  160. return false;
  161. }
  162. IEnumerator ActivateCoroutine(Hashtable hashtable)
  163. {
  164. if (card.Owner.SecurityCards.Count >= 3)
  165. {
  166. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  167. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  168. selectPermanentEffect.SetUp(
  169. selectPlayer: card.Owner,
  170. canTargetCondition: PermanentCondition,
  171. canTargetCondition_ByPreSelecetedList: null,
  172. canEndSelectCondition: null,
  173. maxCount: maxCount,
  174. canNoSelect: false,
  175. canEndNotMax: false,
  176. selectPermanentCoroutine: SelectPermanentCoroutine,
  177. afterSelectPermanentCoroutine: null,
  178. mode: SelectPermanentEffect.Mode.Custom,
  179. cardEffect: activateClass);
  180. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.", "The opponent is selecting 1 Digimon that will get DP -4000.");
  181. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  182. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  183. {
  184. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -4000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  185. }
  186. }
  187. if (card.Owner.SecurityCards.Count <= 3)
  188. {
  189. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  190. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  191. selectPermanentEffect.SetUp(
  192. selectPlayer: card.Owner,
  193. canTargetCondition: PermanentCondition,
  194. canTargetCondition_ByPreSelecetedList: null,
  195. canEndSelectCondition: null,
  196. maxCount: maxCount,
  197. canNoSelect: false,
  198. canEndNotMax: false,
  199. selectPermanentCoroutine: SelectPermanentCoroutine,
  200. afterSelectPermanentCoroutine: null,
  201. mode: SelectPermanentEffect.Mode.Custom,
  202. cardEffect: activateClass);
  203. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -2", "The opponent is selecting 1 Digimon that will get Security Attack -2.");
  204. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  205. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  206. {
  207. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -2, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  208. }
  209. }
  210. }
  211. }
  212. #endregion
  213. #region Inherit
  214. if (timing == EffectTiming.OnEndAttack)
  215. {
  216. ActivateClass activateClass = new ActivateClass();
  217. activateClass.SetUpICardEffect("Unsuspend this Digimon by trashing the top card of your security.", CanUseCondition, card);
  218. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  219. activateClass.SetIsInheritedEffect(true);
  220. activateClass.SetHashString("Inherit_BT16_034");
  221. cardEffects.Add(activateClass);
  222. string EffectDiscription()
  223. {
  224. return "[End of Attack] [Once per turn] If this Digimon has [Pulsemon] in its text, by trashing the top card of your security stack, unsuspend this Digimon.";
  225. }
  226. bool CanUseCondition(Hashtable hashtable)
  227. {
  228. return CardEffectCommons.CanTriggerOnEndAttack(hashtable, card);
  229. }
  230. bool CanActivateCondition(Hashtable hashtable)
  231. {
  232. if (CardEffectCommons.IsExistOnBattleArea(card))
  233. {
  234. if (card.PermanentOfThisCard().TopCard.HasText("Pulsemon"))
  235. {
  236. if (card.Owner.SecurityCards.Count >= 1)
  237. {
  238. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  239. {
  240. return true;
  241. }
  242. }
  243. }
  244. }
  245. return false;
  246. }
  247. bool PermanentCondition(Permanent permanent)
  248. {
  249. if (permanent == card.PermanentOfThisCard())
  250. {
  251. if (card.PermanentOfThisCard().TopCard.HasText("Pulsemon"))
  252. {
  253. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  254. {
  255. return true;
  256. }
  257. }
  258. }
  259. return false;
  260. }
  261. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  262. {
  263. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  264. player: card.Owner,
  265. destroySecurityCount: 1,
  266. cardEffect: activateClass,
  267. fromTop: true).DestroySecurity());
  268. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  269. {
  270. Permanent selectedPermanent = card.PermanentOfThisCard();
  271. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  272. }
  273. }
  274. }
  275. #endregion
  276. return cardEffects;
  277. }
  278. }
  279. }