BT15_035.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_035 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Rule Text - Name
  13. if (timing == EffectTiming.None)
  14. {
  15. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  16. changeCardNamesClass.SetUpICardEffect("Also treated as [Numemon]", CanUseCondition, card);
  17. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  18. cardEffects.Add(changeCardNamesClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return true;
  22. }
  23. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  24. {
  25. if (cardSource == card)
  26. {
  27. CardNames.Add("Numemon");
  28. }
  29. return CardNames;
  30. }
  31. }
  32. #endregion
  33. #region On Play
  34. if (timing == EffectTiming.OnEnterFieldAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Trash 1 card from hand so that the opponent's 1 Digimon gains Security Attack -1", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  39. cardEffects.Add(activateClass);
  40. string EffectDiscription()
  41. {
  42. return "[On Play] By trashing 1 card with [Numemon] or [Sukamon] in its name in your hand, 1 of your opponent's Digimon gains [Security A. -1] until the end of your opponent's turn.";
  43. }
  44. bool CanSelectCardCondition(CardSource cardSource)
  45. {
  46. if (cardSource.ContainsCardName("Numemon"))
  47. {
  48. return true;
  49. }
  50. if (cardSource.ContainsCardName("Sukamon"))
  51. {
  52. return true;
  53. }
  54. return false;
  55. }
  56. bool CanSelectPermanentCondition(Permanent permanent)
  57. {
  58. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  59. }
  60. bool CanUseCondition(Hashtable hashtable)
  61. {
  62. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. if (CardEffectCommons.IsExistOnBattleArea(card))
  67. {
  68. if (card.Owner.HandCards.Count >= 1)
  69. {
  70. return true;
  71. }
  72. }
  73. return false;
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  76. {
  77. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  78. {
  79. bool discarded = false;
  80. int discardCount = 1;
  81. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  82. selectHandEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanSelectCardCondition,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: discardCount,
  88. canNoSelect: true,
  89. canEndNotMax: false,
  90. isShowOpponent: true,
  91. selectCardCoroutine: null,
  92. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  93. mode: SelectHandEffect.Mode.Discard,
  94. cardEffect: activateClass);
  95. yield return StartCoroutine(selectHandEffect.Activate());
  96. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  97. {
  98. if (cardSources.Count >= 1)
  99. {
  100. discarded = true;
  101. yield return null;
  102. }
  103. }
  104. if (discarded)
  105. {
  106. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  107. {
  108. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  109. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  110. selectPermanentEffect.SetUp(
  111. selectPlayer: card.Owner,
  112. canTargetCondition: CanSelectPermanentCondition,
  113. canTargetCondition_ByPreSelecetedList: null,
  114. canEndSelectCondition: null,
  115. maxCount: maxCount,
  116. canNoSelect: false,
  117. canEndNotMax: false,
  118. selectPermanentCoroutine: SelectPermanentCoroutine,
  119. afterSelectPermanentCoroutine: null,
  120. mode: SelectPermanentEffect.Mode.Custom,
  121. cardEffect: activateClass);
  122. selectPermanentEffect.SetUpCustomMessage(
  123. "Select 1 Digimon that will get Security Attack -1.",
  124. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  125. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  126. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  127. {
  128. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  129. targetPermanent: permanent,
  130. changeValue: -1,
  131. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  132. activateClass: activateClass));
  133. }
  134. }
  135. }
  136. }
  137. }
  138. }
  139. #endregion
  140. #region On Deletion
  141. if (timing == EffectTiming.OnDestroyedAnyone)
  142. {
  143. ActivateClass activateClass = new ActivateClass();
  144. activateClass.SetUpICardEffect("Trash 1 card from hand so that the opponent's 1 Digimon gains Security Attack -1", CanUseCondition, card);
  145. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  146. cardEffects.Add(activateClass);
  147. string EffectDiscription()
  148. {
  149. return "[On Deletion] By trashing 1 card with [Numemon] or [Sukamon] in its name in your hand, 1 of your opponent's Digimon gains [Security A. -1] until the end of your opponent's turn.";
  150. }
  151. bool CanSelectCardCondition(CardSource cardSource)
  152. {
  153. if (cardSource.ContainsCardName("Numemon"))
  154. {
  155. return true;
  156. }
  157. if (cardSource.ContainsCardName("Sukamon"))
  158. {
  159. return true;
  160. }
  161. return false;
  162. }
  163. bool CanSelectPermanentCondition(Permanent permanent)
  164. {
  165. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  166. }
  167. bool CanUseCondition(Hashtable hashtable)
  168. {
  169. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  170. }
  171. bool CanActivateCondition(Hashtable hashtable)
  172. {
  173. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  174. {
  175. if (card.Owner.HandCards.Count >= 1)
  176. {
  177. return true;
  178. }
  179. }
  180. return false;
  181. }
  182. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  183. {
  184. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  185. {
  186. bool discarded = false;
  187. int discardCount = 1;
  188. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  189. selectHandEffect.SetUp(
  190. selectPlayer: card.Owner,
  191. canTargetCondition: CanSelectCardCondition,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. maxCount: discardCount,
  195. canNoSelect: true,
  196. canEndNotMax: false,
  197. isShowOpponent: true,
  198. selectCardCoroutine: null,
  199. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  200. mode: SelectHandEffect.Mode.Discard,
  201. cardEffect: activateClass);
  202. yield return StartCoroutine(selectHandEffect.Activate());
  203. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  204. {
  205. if (cardSources.Count >= 1)
  206. {
  207. discarded = true;
  208. yield return null;
  209. }
  210. }
  211. if (discarded)
  212. {
  213. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  214. {
  215. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  216. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  217. selectPermanentEffect.SetUp(
  218. selectPlayer: card.Owner,
  219. canTargetCondition: CanSelectPermanentCondition,
  220. canTargetCondition_ByPreSelecetedList: null,
  221. canEndSelectCondition: null,
  222. maxCount: maxCount,
  223. canNoSelect: false,
  224. canEndNotMax: false,
  225. selectPermanentCoroutine: SelectPermanentCoroutine,
  226. afterSelectPermanentCoroutine: null,
  227. mode: SelectPermanentEffect.Mode.Custom,
  228. cardEffect: activateClass);
  229. selectPermanentEffect.SetUpCustomMessage(
  230. "Select 1 Digimon that will get Security Attack -1.",
  231. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  232. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  233. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  234. {
  235. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  236. targetPermanent: permanent,
  237. changeValue: -1,
  238. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  239. activateClass: activateClass));
  240. }
  241. }
  242. }
  243. }
  244. }
  245. }
  246. #endregion
  247. #region Inheritable
  248. if (timing == EffectTiming.OnAllyAttack)
  249. {
  250. ActivateClass activateClass = new ActivateClass();
  251. activateClass.SetUpICardEffect("Security Attack -1", CanUseCondition, card);
  252. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  253. activateClass.SetHashString("Sec-1_BT15_035");
  254. activateClass.SetIsInheritedEffect(true);
  255. cardEffects.Add(activateClass);
  256. string EffectDiscription()
  257. {
  258. return "[When Attacking] 1 of your opponent's Digimon gains [Security A. -1] until the end of your opponent's turn.";
  259. }
  260. bool CanSelectPermanentCondition(Permanent permanent)
  261. {
  262. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  263. {
  264. return true;
  265. }
  266. return false;
  267. }
  268. bool CanUseCondition(Hashtable hashtable)
  269. {
  270. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  271. }
  272. bool CanActivateCondition(Hashtable hashtable)
  273. {
  274. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  275. {
  276. return true;
  277. }
  278. return false;
  279. }
  280. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  281. {
  282. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  283. {
  284. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  285. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  286. selectPermanentEffect.SetUp(
  287. selectPlayer: card.Owner,
  288. canTargetCondition: CanSelectPermanentCondition,
  289. canTargetCondition_ByPreSelecetedList: null,
  290. canEndSelectCondition: null,
  291. maxCount: maxCount,
  292. canNoSelect: false,
  293. canEndNotMax: false,
  294. selectPermanentCoroutine: SelectPermanentCoroutine,
  295. afterSelectPermanentCoroutine: null,
  296. mode: SelectPermanentEffect.Mode.Custom,
  297. cardEffect: activateClass);
  298. selectPermanentEffect.SetUpCustomMessage(
  299. "Select 1 Digimon that will get Security Attack -1.",
  300. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  301. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  302. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  303. {
  304. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  305. targetPermanent: permanent,
  306. changeValue: -1,
  307. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  308. activateClass: activateClass));
  309. }
  310. }
  311. }
  312. }
  313. #endregion
  314. return cardEffects;
  315. }
  316. }
  317. }