BT23_094.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Nanomachine Break
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_094 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Ignore Color Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  16. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  17. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  18. cardEffects.Add(ignoreColorConditionClass);
  19. bool HasAppmonTrait(Permanent permanent)
  20. {
  21. if (CardEffectCommons.IsOwnerPermanent(permanent, card))
  22. {
  23. if (permanent.TopCard.HasCSTraits)
  24. {
  25. if (permanent.IsDigimon || permanent.IsTamer)
  26. {
  27. return true;
  28. }
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.HasMatchConditionPermanent(HasAppmonTrait, true);
  36. }
  37. bool CardCondition(CardSource cardSource)
  38. {
  39. return cardSource == card;
  40. }
  41. }
  42. #endregion
  43. #region Main/YT/Security Shared
  44. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  45. {
  46. bool IsOpponentsDigimon(Permanent permanent)
  47. {
  48. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  49. }
  50. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  51. {
  52. Permanent selectedPermanent = null;
  53. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  54. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  55. selectPermanentEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: IsOpponentsDigimon,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: maxCount,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. selectPermanentCoroutine: SelectedPermanent,
  64. afterSelectPermanentCoroutine: null,
  65. mode: SelectPermanentEffect.Mode.Custom,
  66. cardEffect: activateClass);
  67. IEnumerator SelectedPermanent(Permanent target)
  68. {
  69. selectedPermanent = target;
  70. yield return null;
  71. }
  72. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain -1 Sec Atk, cant activate [When Digivolving] and cant activate [When Attacking].", "The opponent is selecting 1 Digimon that will gain -1 Sec Atk, cant activate [When Digivolving] and cant activate [When Attacking].");
  73. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  74. if (selectedPermanent != null)
  75. {
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  77. targetPermanent: selectedPermanent,
  78. changeValue: -1,
  79. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  80. activateClass: activateClass));
  81. bool CanUseConditionDebuff(Hashtable hashtableDebuff)
  82. {
  83. return true;
  84. }
  85. bool InvalidateWDCondition(ICardEffect cardEffect)
  86. {
  87. if (selectedPermanent.TopCard != null)
  88. {
  89. if (cardEffect != null)
  90. {
  91. if (cardEffect.EffectSourceCard != null)
  92. {
  93. if (isExistOnField(cardEffect.EffectSourceCard))
  94. {
  95. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  96. {
  97. if (cardEffect.IsWhenDigivolving)
  98. {
  99. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  100. {
  101. return true;
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }
  109. return false;
  110. }
  111. bool InvalidateWACondition(ICardEffect cardEffect)
  112. {
  113. if (selectedPermanent.TopCard != null)
  114. {
  115. if (cardEffect != null)
  116. {
  117. if (cardEffect.EffectSourceCard != null)
  118. {
  119. if (isExistOnField(cardEffect.EffectSourceCard))
  120. {
  121. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  122. {
  123. if (cardEffect.IsOnAttack)
  124. {
  125. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  126. {
  127. return true;
  128. }
  129. }
  130. }
  131. }
  132. }
  133. }
  134. }
  135. return false;
  136. }
  137. DisableEffectClass invalidationClass = new DisableEffectClass();
  138. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", CanUseConditionDebuff, card);
  139. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateWDCondition);
  140. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => invalidationClass);
  141. DisableEffectClass invalidationClass1 = new DisableEffectClass();
  142. invalidationClass1.SetUpICardEffect("Ignore [When Attacking] Effect", CanUseConditionDebuff, card);
  143. invalidationClass1.SetUpDisableEffectClass(DisableCondition: InvalidateWACondition);
  144. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => invalidationClass1);
  145. }
  146. }
  147. }
  148. #endregion
  149. #region Main
  150. if (timing == EffectTiming.OptionSkill)
  151. {
  152. ActivateClass activateClass = new ActivateClass();
  153. activateClass.SetUpICardEffect("1 digimon gains Sec Atk -1 and cant use [When Digivolving] & [When Attacking effects]. then place is battle area", CanUseCondition, card);
  154. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  155. cardEffects.Add(activateClass);
  156. string EffectDiscription()
  157. {
  158. return "[Main] Until your opponent's turn ends, give 1 of their Digimon <Security A. -1> and it can't activate [When Digivolving] or [When Attacking] effects. Then, place this card in the battle area.";
  159. }
  160. bool CanUseCondition(Hashtable hashtable)
  161. {
  162. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable hashtable)
  165. {
  166. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  167. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  168. }
  169. }
  170. #endregion
  171. #region Your Turn - Delay
  172. if (timing == EffectTiming.OnAllyAttack)
  173. {
  174. ActivateClass activateClass = new ActivateClass();
  175. activateClass.SetUpICardEffect("1 digimon gains Sec Atk -1 and cant use [When Digivolving] & [When Attacking effects].", CanUseCondition, card);
  176. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  177. cardEffects.Add(activateClass);
  178. string EffectDiscription()
  179. {
  180. return "When one of your [CS] trait Digimon attacks <Delay>. Until your opponent's turn ends, give 1 of their Digimon <Security A. -1> and it can't activate [When Digivolving] or [When Attacking] effects.";
  181. }
  182. bool CanUseCondition(Hashtable hashtable)
  183. {
  184. return CardEffectCommons.IsExistOnBattleArea(card)
  185. && CardEffectCommons.CanDeclareOptionDelayEffect(card)
  186. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition);
  187. }
  188. bool CanActivateCondition(Hashtable hashtable)
  189. {
  190. return CardEffectCommons.IsExistOnBattleArea(card)
  191. && CardEffectCommons.IsOwnerTurn(card);
  192. }
  193. bool PermanentCondition(Permanent permanent)
  194. {
  195. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  196. && permanent.TopCard.HasCSTraits;
  197. }
  198. IEnumerator ActivateCoroutine(Hashtable hashtable)
  199. {
  200. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  201. IEnumerator SuccessProcess()
  202. {
  203. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  204. }
  205. }
  206. }
  207. #endregion
  208. #region Security
  209. if (timing == EffectTiming.SecuritySkill)
  210. {
  211. ActivateClass activateClass = new ActivateClass();
  212. activateClass.SetUpICardEffect("1 digimon gains Sec Atk -1 and cant use [When Digivolving] & [When Attacking effects]. then place is battle area", CanUseCondition, card);
  213. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  214. activateClass.SetIsSecurityEffect(true);
  215. cardEffects.Add(activateClass);
  216. string EffectDiscription()
  217. {
  218. return "[Security] Until your opponent's turn ends, give 1 of their Digimon <Security A. -1> and it can't activate [When Digivolving] or [When Attacking] effects. Then, place this card in the battle area.";
  219. }
  220. bool CanUseCondition(Hashtable hashtable)
  221. {
  222. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  223. }
  224. IEnumerator ActivateCoroutine(Hashtable hashtable)
  225. {
  226. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  227. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  228. }
  229. }
  230. #endregion
  231. return cardEffects;
  232. }
  233. }
  234. }