BT18_040.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_040 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Blast Digivolve
  12. if (timing == EffectTiming.OnCounterTiming)
  13. {
  14. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  15. }
  16. #endregion
  17. #region Raid
  18. if (timing == EffectTiming.OnAllyAttack)
  19. {
  20. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region On Play
  24. if (timing == EffectTiming.OnEnterFieldAnyone)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Trash your top security and DP -6000", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  29. cardEffects.Add(activateClass);
  30. string EffectDiscription()
  31. {
  32. return "[On Play] By trashing the top card of your security stack, 1 of your opponent's Digimon gets -6000 DP until the end of your opponent's turn.";
  33. }
  34. bool CanSelectPermanentCondition(Permanent permanent)
  35. {
  36. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  41. {
  42. return true;
  43. }
  44. return false;
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  49. {
  50. if (card.Owner.SecurityCards.Count >= 1)
  51. {
  52. return true;
  53. }
  54. }
  55. return false;
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  58. {
  59. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  60. player: card.Owner,
  61. destroySecurityCount: 1,
  62. cardEffect: activateClass,
  63. fromTop: true).DestroySecurity());
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  65. {
  66. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  67. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  68. selectPermanentEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanSelectPermanentCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: SelectPermanentCoroutine,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Custom,
  79. cardEffect: activateClass);
  80. selectPermanentEffect.SetUpCustomMessage(
  81. "Select 1 Digimon that will get DP -6000.",
  82. "The opponent is selecting 1 Digimon that will get DP -6000.");
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  84. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  85. {
  86. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -6000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  87. }
  88. }
  89. }
  90. }
  91. #endregion
  92. #region When Digivolving
  93. if (timing == EffectTiming.OnEnterFieldAnyone)
  94. {
  95. ActivateClass activateClass = new ActivateClass();
  96. activateClass.SetUpICardEffect("Trash your top security and DP -6000", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  98. cardEffects.Add(activateClass);
  99. string EffectDiscription()
  100. {
  101. return "[When Digivolving] By trashing the top card of your security stack, 1 of your opponent's Digimon gets -6000 DP until the end of your opponent's turn.";
  102. }
  103. bool CanSelectPermanentCondition(Permanent permanent)
  104. {
  105. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  106. }
  107. bool CanUseCondition(Hashtable hashtable)
  108. {
  109. if(CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  110. {
  111. if(CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  112. {
  113. return true;
  114. }
  115. }
  116. return false;
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  121. {
  122. if (card.Owner.SecurityCards.Count >= 1)
  123. {
  124. return true;
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  132. player: card.Owner,
  133. destroySecurityCount: 1,
  134. cardEffect: activateClass,
  135. fromTop: true).DestroySecurity());
  136. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  137. {
  138. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  139. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  140. selectPermanentEffect.SetUp(
  141. selectPlayer: card.Owner,
  142. canTargetCondition: CanSelectPermanentCondition,
  143. canTargetCondition_ByPreSelecetedList: null,
  144. canEndSelectCondition: null,
  145. maxCount: maxCount,
  146. canNoSelect: false,
  147. canEndNotMax: false,
  148. selectPermanentCoroutine: SelectPermanentCoroutine,
  149. afterSelectPermanentCoroutine: null,
  150. mode: SelectPermanentEffect.Mode.Custom,
  151. cardEffect: activateClass);
  152. selectPermanentEffect.SetUpCustomMessage(
  153. "Select 1 Digimon that will get DP -6000.",
  154. "The opponent is selecting 1 Digimon that will get DP -6000.");
  155. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  156. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  157. {
  158. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -6000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  159. }
  160. }
  161. }
  162. }
  163. #endregion
  164. #region When Attacking
  165. if (timing == EffectTiming.OnAllyAttack)
  166. {
  167. ActivateClass activateClass = new ActivateClass();
  168. activateClass.SetUpICardEffect("Trash your 1 security and DP -6000", CanUseCondition, card);
  169. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  170. cardEffects.Add(activateClass);
  171. string EffectDiscription()
  172. {
  173. return "[When Digivolving] By trashing the top card of your security stack, 1 of your opponent's Digimon gets -6000 DP until the end of your opponent's turn.";
  174. }
  175. bool CanSelectPermanentCondition(Permanent permanent)
  176. {
  177. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  178. }
  179. bool CanUseCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  182. }
  183. bool CanActivateCondition(Hashtable hashtable)
  184. {
  185. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  186. {
  187. if (card.Owner.SecurityCards.Count >= 1)
  188. {
  189. return true;
  190. }
  191. }
  192. return false;
  193. }
  194. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  195. {
  196. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  197. player: card.Owner,
  198. destroySecurityCount: 1,
  199. cardEffect: activateClass,
  200. fromTop: true).DestroySecurity());
  201. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  202. {
  203. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  204. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  205. selectPermanentEffect.SetUp(
  206. selectPlayer: card.Owner,
  207. canTargetCondition: CanSelectPermanentCondition,
  208. canTargetCondition_ByPreSelecetedList: null,
  209. canEndSelectCondition: null,
  210. maxCount: maxCount,
  211. canNoSelect: false,
  212. canEndNotMax: false,
  213. selectPermanentCoroutine: SelectPermanentCoroutine,
  214. afterSelectPermanentCoroutine: null,
  215. mode: SelectPermanentEffect.Mode.Custom,
  216. cardEffect: activateClass);
  217. selectPermanentEffect.SetUpCustomMessage(
  218. "Select 1 Digimon that will get DP -6000.",
  219. "The opponent is selecting 1 Digimon that will get DP -6000.");
  220. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  221. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  222. {
  223. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -6000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  224. }
  225. }
  226. }
  227. }
  228. #endregion
  229. #region All Turns
  230. if (timing == EffectTiming.None)
  231. {
  232. bool Condition()
  233. {
  234. if (CardEffectCommons.IsExistOnBattleArea(card))
  235. {
  236. if (card.Owner.SecurityCards.Count <= 3)
  237. {
  238. return true;
  239. }
  240. }
  241. return false;
  242. }
  243. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 4000, isInheritedEffect: false, card: card, condition: Condition));
  244. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: Condition));
  245. }
  246. #endregion
  247. return cardEffects;
  248. }
  249. }
  250. }