Dynasmon_BT18_040.cs 13 KB

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