BT16_046.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_046 : 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 Digivolve Condition
  18. if (timing == EffectTiming.None)
  19. {
  20. bool PermanentCondition(Permanent targetPermanent)
  21. {
  22. return targetPermanent.TopCard.CardNames.Contains("Dinobeemon") || targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5 && targetPermanent.TopCard.CardTraits.Contains("Insectoid");
  23. }
  24. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  25. }
  26. #endregion
  27. #region On Play
  28. if (timing == EffectTiming.OnEnterFieldAnyone)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Suspend Digimon or tamers and activate effects", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  33. cardEffects.Add(activateClass);
  34. string EffectDiscription()
  35. {
  36. return "[On Play] Suspend 2 of your opponent's Digimon or Tamers. Cards suspended by this effect cant unsuspend during your opponent's next unsuspend phase. Then, delete 1 of your opponent's suspended Tamers.";
  37. }
  38. bool PermanentCondition(Permanent permanent)
  39. {
  40. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  41. {
  42. if (permanent.IsTamer || permanent.IsDigimon)
  43. {
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. bool CanSelectTamerToDelete(Permanent permanent)
  50. {
  51. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  52. {
  53. if (permanent.IsTamer && permanent.IsSuspended)
  54. {
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. bool CanUseCondition(Hashtable hashtable)
  61. {
  62. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable hashtable)
  69. {
  70. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  71. {
  72. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  73. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: PermanentCondition,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: maxCount,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: null,
  83. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  84. mode: SelectPermanentEffect.Mode.Tap,
  85. cardEffect: activateClass);
  86. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon or Tamers to suspend.", "The opponent is selecting 2 Digimon or Tamers to suspend.");
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  89. {
  90. foreach (Permanent selectedPermanent in permanents)
  91. {
  92. if (selectedPermanent != null)
  93. {
  94. if (selectedPermanent.IsSuspended)
  95. {
  96. if (!selectedPermanent.oldIsTapped_playCard)
  97. {
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  99. targetPermanent: selectedPermanent,
  100. activateClass: activateClass
  101. ));
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerToDelete))
  109. {
  110. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectTamerToDelete));
  111. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  112. selectPermanentEffect.SetUp(
  113. selectPlayer: card.Owner,
  114. canTargetCondition: CanSelectTamerToDelete,
  115. canTargetCondition_ByPreSelecetedList: null,
  116. canEndSelectCondition: null,
  117. maxCount: maxCount,
  118. canNoSelect: false,
  119. canEndNotMax: false,
  120. selectPermanentCoroutine: null,
  121. afterSelectPermanentCoroutine: null,
  122. mode: SelectPermanentEffect.Mode.Destroy,
  123. cardEffect: activateClass);
  124. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to delete.", "The opponent is selecting 1 Tamer to delete.");
  125. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  126. }
  127. }
  128. }
  129. #endregion
  130. #region When Digivolving
  131. if (timing == EffectTiming.OnEnterFieldAnyone)
  132. {
  133. ActivateClass activateClass = new ActivateClass();
  134. activateClass.SetUpICardEffect("Suspend Digimon or tamers and activate effects", CanUseCondition, card);
  135. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  136. cardEffects.Add(activateClass);
  137. string EffectDiscription()
  138. {
  139. return "[When Digivolving] Suspend 2 of your opponent's Digimon or Tamers. Cards suspended by this effect cant unsuspend during your opponent's next unsuspend phase. Then, delete 1 of your opponent's suspended Tamers.";
  140. }
  141. bool PermanentCondition(Permanent permanent)
  142. {
  143. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  144. {
  145. if (permanent.IsTamer || permanent.IsDigimon)
  146. {
  147. return true;
  148. }
  149. }
  150. return false;
  151. }
  152. bool CanSelectTamerToDelete(Permanent permanent)
  153. {
  154. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  155. {
  156. if (permanent.IsTamer && permanent.IsSuspended)
  157. {
  158. return true;
  159. }
  160. }
  161. return false;
  162. }
  163. bool CanUseCondition(Hashtable hashtable)
  164. {
  165. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  166. }
  167. bool CanActivateCondition(Hashtable hashtable)
  168. {
  169. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  170. }
  171. IEnumerator ActivateCoroutine(Hashtable hashtable)
  172. {
  173. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  174. {
  175. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  176. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  177. selectPermanentEffect.SetUp(
  178. selectPlayer: card.Owner,
  179. canTargetCondition: PermanentCondition,
  180. canTargetCondition_ByPreSelecetedList: null,
  181. canEndSelectCondition: null,
  182. maxCount: maxCount,
  183. canNoSelect: false,
  184. canEndNotMax: false,
  185. selectPermanentCoroutine: null,
  186. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  187. mode: SelectPermanentEffect.Mode.Tap,
  188. cardEffect: activateClass);
  189. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon or Tamers to suspend.", "The opponent is selecting 2 Digimon or Tamers to suspend.");
  190. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  191. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  192. {
  193. foreach (Permanent selectedPermanent in permanents)
  194. {
  195. if (selectedPermanent != null)
  196. {
  197. if (selectedPermanent.IsSuspended)
  198. {
  199. if (!selectedPermanent.oldIsTapped_playCard)
  200. {
  201. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  202. targetPermanent: selectedPermanent,
  203. activateClass: activateClass
  204. ));
  205. }
  206. }
  207. }
  208. }
  209. }
  210. }
  211. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerToDelete))
  212. {
  213. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectTamerToDelete));
  214. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  215. selectPermanentEffect.SetUp(
  216. selectPlayer: card.Owner,
  217. canTargetCondition: CanSelectTamerToDelete,
  218. canTargetCondition_ByPreSelecetedList: null,
  219. canEndSelectCondition: null,
  220. maxCount: maxCount,
  221. canNoSelect: false,
  222. canEndNotMax: false,
  223. selectPermanentCoroutine: null,
  224. afterSelectPermanentCoroutine: null,
  225. mode: SelectPermanentEffect.Mode.Destroy,
  226. cardEffect: activateClass);
  227. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to delete.", "The opponent is selecting 1 Tamer to delete.");
  228. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  229. }
  230. }
  231. }
  232. #endregion
  233. #region Your Turn
  234. if (timing == EffectTiming.OnTappedAnyone)
  235. {
  236. ActivateClass activateClass = new ActivateClass();
  237. activateClass.SetUpICardEffect("Give 1 Digimon Security A+1.", CanUseCondition, card);
  238. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  239. activateClass.SetHashString("Sec+1_BT16-046");
  240. cardEffects.Add(activateClass);
  241. string EffectDiscription()
  242. {
  243. return "[Your Turn][Once Per Turn] When this Digimon becomes suspended, 1 of your Digimon gains [Security A+1] for the turn.";
  244. }
  245. bool CanSelectPermanentCondition(Permanent permanent)
  246. {
  247. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  248. }
  249. bool CanUseCondition(Hashtable hashtable)
  250. {
  251. return CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  252. }
  253. bool CanActivateCondition(Hashtable hashtable)
  254. {
  255. if (CardEffectCommons.IsExistOnBattleArea(card))
  256. {
  257. if (CardEffectCommons.IsOwnerTurn(card))
  258. {
  259. return true;
  260. }
  261. }
  262. return false;
  263. }
  264. IEnumerator ActivateCoroutine(Hashtable hashtable)
  265. {
  266. int maxCount = 1;
  267. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  268. {
  269. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  270. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  271. selectPermanentEffect.SetUp(
  272. selectPlayer: card.Owner,
  273. canTargetCondition: CanSelectPermanentCondition,
  274. canTargetCondition_ByPreSelecetedList: null,
  275. canEndSelectCondition: null,
  276. maxCount: maxCount,
  277. canNoSelect: false,
  278. canEndNotMax: false,
  279. selectPermanentCoroutine: SelectPermanentCoroutine,
  280. afterSelectPermanentCoroutine: null,
  281. mode: SelectPermanentEffect.Mode.Custom,
  282. cardEffect: activateClass);
  283. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security A+1.", "The opponent is selecting 1 Digimon that will get Security A+1.");
  284. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  285. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  286. {
  287. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: 1, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  288. }
  289. }
  290. }
  291. }
  292. #endregion
  293. return cardEffects;
  294. }
  295. }
  296. }