BT19_064.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_064 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsCardName("Justimon: Accel Arm") || targetPermanent.TopCard.EqualsCardName("Justimon: Critical Arm");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. #endregion
  20. #region Blast Digivolve
  21. if (timing == EffectTiming.OnCounterTiming)
  22. {
  23. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  24. }
  25. #endregion
  26. #region On Play
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("This Digimon gains Blocker and isn't affected by digimon effects", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  32. cardEffects.Add(activateClass);
  33. string EffectDescription()
  34. {
  35. return "[On Play] This Digimon gains <Blocker> and isn't affected by your opponent's Digimon's effects until the end of your opponent's turn.";
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. return true;
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  50. {
  51. Permanent selectedPermanent = card.PermanentOfThisCard();
  52. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  53. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's digimon's effects", CanUseCondition1, card);
  54. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  55. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotAffectedClass);
  56. bool CanUseCondition1(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent);
  59. }
  60. bool CardCondition(CardSource cardSource)
  61. {
  62. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  63. {
  64. if (cardSource == selectedPermanent.TopCard)
  65. {
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. bool SkillCondition(ICardEffect cardEffect)
  72. {
  73. if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
  74. {
  75. if (cardEffect.IsDigimonEffect)
  76. {
  77. return true;
  78. }
  79. }
  80. return false;
  81. }
  82. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  83. targetPermanent: card.PermanentOfThisCard(),
  84. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  85. activateClass: activateClass));
  86. }
  87. }
  88. #endregion
  89. #region When Digivolving - Immunity
  90. if (timing == EffectTiming.OnEnterFieldAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("This Digimon gains Blocker and isn't affected by digimon effects", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  95. cardEffects.Add(activateClass);
  96. string EffectDescription()
  97. {
  98. return "[When Digivolving] This Digimon gains <Blocker> and isn't affected by your opponent's Digimon's effects until the end of your opponent's turn.";
  99. }
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  103. }
  104. bool CanActivateCondition(Hashtable hashtable)
  105. {
  106. return CardEffectCommons.IsExistOnBattleArea(card);
  107. }
  108. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  109. {
  110. Permanent selectedPermanent = card.PermanentOfThisCard();
  111. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  112. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's digimon's effects", CanUseCondition1, card);
  113. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  114. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotAffectedClass);
  115. bool CanUseCondition1(Hashtable hashtable)
  116. {
  117. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent);
  118. }
  119. bool CardCondition(CardSource cardSource)
  120. {
  121. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  122. {
  123. if (cardSource == selectedPermanent.TopCard)
  124. {
  125. return true;
  126. }
  127. }
  128. return false;
  129. }
  130. bool SkillCondition(ICardEffect cardEffect)
  131. {
  132. if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
  133. {
  134. if (cardEffect.IsDigimonEffect)
  135. {
  136. return true;
  137. }
  138. }
  139. return false;
  140. }
  141. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  142. targetPermanent: card.PermanentOfThisCard(),
  143. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  144. activateClass: activateClass));
  145. }
  146. }
  147. #endregion
  148. #region When Digivolving - Unsuspend
  149. if (timing == EffectTiming.OnEnterFieldAnyone)
  150. {
  151. ActivateClass activateClass = new ActivateClass();
  152. activateClass.SetUpICardEffect("By trashing 1 option card, unsuspend", CanUseCondition, card);
  153. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  154. activateClass.SetHashString("TrashUnsuspend_BT19_062");
  155. cardEffects.Add(activateClass);
  156. string EffectDescription()
  157. {
  158. return "[When Digivolving] (Once Per Turn) By trashing 1 Option card in the battle area, unsuspend this Digimon.";
  159. }
  160. bool IsOption(Permanent permanent)
  161. {
  162. return permanent.IsOption;
  163. }
  164. bool CanUseCondition(Hashtable hashtable)
  165. {
  166. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  167. }
  168. bool CanActivateCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.IsExistOnBattleArea(card) &&
  171. CardEffectCommons.HasMatchConditionPermanent(IsOption);
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable hashtable)
  174. {
  175. Permanent selectedPermanent = null;
  176. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  177. selectPermanentEffect.SetUp(
  178. selectPlayer: card.Owner,
  179. canTargetCondition: IsOption,
  180. canTargetCondition_ByPreSelecetedList: null,
  181. canEndSelectCondition: null,
  182. maxCount: 1,
  183. canNoSelect: false,
  184. canEndNotMax: false,
  185. selectPermanentCoroutine: SelectPermanentCoroutine,
  186. afterSelectPermanentCoroutine: null,
  187. mode: SelectPermanentEffect.Mode.Custom,
  188. cardEffect: activateClass);
  189. selectPermanentEffect.SetUpCustomMessage("Select 1 Option to trash.",
  190. "The opponent is selecting 1 Option to trash.");
  191. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  192. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  193. {
  194. selectedPermanent = permanent;
  195. yield return null;
  196. }
  197. if (selectedPermanent != null)
  198. {
  199. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  200. targetPermanents: new List<Permanent>() { selectedPermanent },
  201. activateClass: activateClass,
  202. successProcess: permanents => SuccessProcess(),
  203. failureProcess: null));
  204. IEnumerator SuccessProcess()
  205. {
  206. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
  207. new List<Permanent> { card.PermanentOfThisCard() },
  208. activateClass).Unsuspend());
  209. }
  210. }
  211. }
  212. }
  213. #endregion
  214. #region When Attacking
  215. if (timing == EffectTiming.OnAllyAttack)
  216. {
  217. ActivateClass activateClass = new ActivateClass();
  218. activateClass.SetUpICardEffect("By trashing 1 option card, unsuspend", CanUseCondition, card);
  219. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  220. activateClass.SetHashString("TrashUnsuspend_BT19_062");
  221. cardEffects.Add(activateClass);
  222. string EffectDescription()
  223. {
  224. return "[When Attacking] (Once Per Turn) By trashing 1 Option card in the battle area, unsuspend this Digimon.";
  225. }
  226. bool IsOption(Permanent permanent)
  227. {
  228. return permanent.IsOption;
  229. }
  230. bool CanUseCondition(Hashtable hashtable)
  231. {
  232. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  233. }
  234. bool CanActivateCondition(Hashtable hashtable)
  235. {
  236. return CardEffectCommons.IsExistOnBattleArea(card) &&
  237. CardEffectCommons.HasMatchConditionPermanent(IsOption);
  238. }
  239. IEnumerator ActivateCoroutine(Hashtable hashtable)
  240. {
  241. Permanent selectedPermanent = null;
  242. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  243. selectPermanentEffect.SetUp(
  244. selectPlayer: card.Owner,
  245. canTargetCondition: IsOption,
  246. canTargetCondition_ByPreSelecetedList: null,
  247. canEndSelectCondition: null,
  248. maxCount: 1,
  249. canNoSelect: false,
  250. canEndNotMax: false,
  251. selectPermanentCoroutine: SelectPermanentCoroutine,
  252. afterSelectPermanentCoroutine: null,
  253. mode: SelectPermanentEffect.Mode.Custom,
  254. cardEffect: activateClass);
  255. selectPermanentEffect.SetUpCustomMessage("Select 1 Option to trash.",
  256. "The opponent is selecting 1 Option to trash.");
  257. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  258. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  259. {
  260. selectedPermanent = permanent;
  261. yield return null;
  262. }
  263. if (selectedPermanent != null)
  264. {
  265. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  266. targetPermanents: new List<Permanent>() { selectedPermanent },
  267. activateClass: activateClass,
  268. successProcess: permanents => SuccessProcess(),
  269. failureProcess: null));
  270. IEnumerator SuccessProcess()
  271. {
  272. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
  273. new List<Permanent> { card.PermanentOfThisCard() },
  274. activateClass).Unsuspend());
  275. }
  276. }
  277. }
  278. }
  279. #endregion
  280. return cardEffects;
  281. }
  282. }
  283. }