BT19_093.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_093 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Ignore Color Requirements
  12. if (timing == EffectTiming.None)
  13. {
  14. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  15. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  16. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  17. cardEffects.Add(ignoreColorConditionClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return !CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.EqualsCardName("Queen Device"));
  21. }
  22. bool CardCondition(CardSource cardSource)
  23. {
  24. return (cardSource == card);
  25. }
  26. }
  27. #endregion
  28. #region When Trashed from battle area
  29. if (timing == EffectTiming.OnDestroyedAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Give -3000 DP and Cannot activate When Digivolving effects.", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  34. cardEffects.Add(activateClass);
  35. string EffectDescription()
  36. {
  37. return "When this card is trashed in your battle area, until the end of your opponent's turn, 1 of your opponent's Digimon gets -3000 DP and that Digimon's [When Digivolving] effects don't activate.";
  38. }
  39. bool HasDigimon(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanActivateOnDeletion(card);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(HasDigimon));
  54. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  55. selectPermanentEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: HasDigimon,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: maxCount,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. selectPermanentCoroutine: SelectPermanentCoroutine,
  64. afterSelectPermanentCoroutine: null,
  65. mode: SelectPermanentEffect.Mode.Custom,
  66. cardEffect: activateClass);
  67. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get -3000 DP and cannot activate When Digivolving effects.", "The opponent is selecting 1 Digimon.");
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  72. targetPermanent: permanent,
  73. changeValue: -3000,
  74. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  75. activateClass: activateClass));
  76. Permanent selectedPermanent = permanent;
  77. if (selectedPermanent != null)
  78. {
  79. DisableEffectClass invalidationClass = new DisableEffectClass();
  80. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", CanUseCondition1, card);
  81. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  82. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => invalidationClass);
  83. bool CanUseCondition1(Hashtable hashtable)
  84. {
  85. return true;
  86. }
  87. bool InvalidateCondition(ICardEffect cardEffect)
  88. {
  89. if (selectedPermanent.TopCard != null)
  90. {
  91. if (cardEffect != null)
  92. {
  93. if (cardEffect.EffectSourceCard != null)
  94. {
  95. if (isExistOnField(cardEffect.EffectSourceCard))
  96. {
  97. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  98. {
  99. if (cardEffect.IsWhenDigivolving)
  100. {
  101. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  102. {
  103. return true;
  104. }
  105. }
  106. }
  107. }
  108. }
  109. }
  110. }
  111. return false;
  112. }
  113. }
  114. }
  115. }
  116. }
  117. #endregion
  118. #region Main
  119. if (timing == EffectTiming.OptionSkill)
  120. {
  121. ActivateClass activateClass = new ActivateClass();
  122. activateClass.SetUpICardEffect("Give -3000 DP and Cannot activate When Digivolving effects.", CanUseCondition, card);
  123. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  124. cardEffects.Add(activateClass);
  125. string EffectDescription()
  126. {
  127. return "[Main] Until the end of your opponent's turn, 1 of your opponent's Digimon gets -3000 DP and that Digimon's [When Digivolving] effects don't activate. Then, place this card in the battle area.";
  128. }
  129. bool HasDigimon(Permanent permanent)
  130. {
  131. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  132. }
  133. bool CanUseCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  136. }
  137. IEnumerator ActivateCoroutine(Hashtable hashtable)
  138. {
  139. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(HasDigimon));
  140. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  141. selectPermanentEffect.SetUp(
  142. selectPlayer: card.Owner,
  143. canTargetCondition: HasDigimon,
  144. canTargetCondition_ByPreSelecetedList: null,
  145. canEndSelectCondition: null,
  146. maxCount: maxCount,
  147. canNoSelect: false,
  148. canEndNotMax: false,
  149. selectPermanentCoroutine: SelectPermanentCoroutine,
  150. afterSelectPermanentCoroutine: null,
  151. mode: SelectPermanentEffect.Mode.Custom,
  152. cardEffect: activateClass);
  153. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get -3000 DP and cannot activate When Digivolving effects.", "The opponent is selecting 1 Digimon.");
  154. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  155. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  156. {
  157. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  158. targetPermanent: permanent,
  159. changeValue: -3000,
  160. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  161. activateClass: activateClass));
  162. Permanent selectedPermanent = permanent;
  163. if (selectedPermanent != null)
  164. {
  165. DisableEffectClass invalidationClass = new DisableEffectClass();
  166. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", CanUseCondition1, card);
  167. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  168. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => invalidationClass);
  169. bool CanUseCondition1(Hashtable hashtable)
  170. {
  171. return true;
  172. }
  173. bool InvalidateCondition(ICardEffect cardEffect)
  174. {
  175. if (selectedPermanent.TopCard != null)
  176. {
  177. if (cardEffect != null)
  178. {
  179. if (cardEffect.EffectSourceCard != null)
  180. {
  181. if (isExistOnField(cardEffect.EffectSourceCard))
  182. {
  183. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  184. {
  185. if (cardEffect.IsWhenDigivolving)
  186. {
  187. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  188. {
  189. return true;
  190. }
  191. }
  192. }
  193. }
  194. }
  195. }
  196. }
  197. return false;
  198. }
  199. }
  200. }
  201. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  202. }
  203. }
  204. #endregion
  205. #region Security Effect
  206. if (timing == EffectTiming.SecuritySkill)
  207. {
  208. ActivateClass activateClass = new ActivateClass();
  209. activateClass.SetUpICardEffect("Security Attack -2 for 2 of your opponents Digimon, then add this to hand", CanUseCondition, card);
  210. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  211. activateClass.SetIsSecurityEffect(true);
  212. cardEffects.Add(activateClass);
  213. string EffectDescription()
  214. {
  215. return "[Security] 2 of your opponent's Digimon gain <Security A. -2> for the turn. Then, add this card to the hand.";
  216. }
  217. bool CanSelectPermanentCondition(Permanent permanent)
  218. {
  219. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  220. }
  221. bool CanUseCondition(Hashtable hashtable)
  222. {
  223. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  224. }
  225. IEnumerator ActivateCoroutine(Hashtable hashtable)
  226. {
  227. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  228. {
  229. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  230. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  231. selectPermanentEffect.SetUp(
  232. selectPlayer: card.Owner,
  233. canTargetCondition: CanSelectPermanentCondition,
  234. canTargetCondition_ByPreSelecetedList: null,
  235. canEndSelectCondition: null,
  236. maxCount: maxCount,
  237. canNoSelect: false,
  238. canEndNotMax: false,
  239. selectPermanentCoroutine: SelectPermanentCoroutine,
  240. afterSelectPermanentCoroutine: null,
  241. mode: SelectPermanentEffect.Mode.Custom,
  242. cardEffect: activateClass);
  243. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon to give Security Attack -2.", "The opponent is selecting 2 Digimon.");
  244. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  245. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  246. {
  247. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  248. targetPermanent: permanent,
  249. changeValue: -2,
  250. effectDuration: EffectDuration.UntilEachTurnEnd,
  251. activateClass: activateClass));
  252. }
  253. }
  254. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  255. }
  256. }
  257. #endregion
  258. return cardEffects;
  259. }
  260. }
  261. }