EX12_052.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Diarbbitmon // Truskmore Advance
  5. namespace DCGO.CardEffects.EX12
  6. {
  7. public class EX12_052 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digimon Effects
  13. #region Alt Digivolution
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent permanent)
  17. {
  18. return permanent.TopCard.HasText("Angoramon")
  19. || permanent.TopCard.EqualsTraits("NSp");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, true, card, null, level: 5));
  22. }
  23. #endregion
  24. #region Piercing
  25. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  26. {
  27. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  28. }
  29. #endregion
  30. #region Vortex
  31. if (timing == EffectTiming.OnEndTurn)
  32. {
  33. cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card, condition: null));
  34. }
  35. #endregion
  36. #region Shared bools
  37. bool CanSelectPermanentCondition(Permanent permanent)
  38. {
  39. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  40. }
  41. #endregion
  42. #region When Digivolving
  43. if (timing == EffectTiming.OnEnterFieldAnyone)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect("1 of your Digimon become immune to Digimon effects until enemy turn ends", CanUseCondition, card);
  47. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  48. cardEffects.Add(activateClass);
  49. string EffectDescription()
  50. => "[When Digivolving] Your opponent's Digimon effects don't affect 1 of your Digimon until their turn ends.";
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  54. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  55. }
  56. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  57. IEnumerator ActivateCoroutine(Hashtable hashtable)
  58. {
  59. Permanent selectedPermanent = null;
  60. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  61. selectPermanentEffect.SetUp(
  62. selectPlayer: card.Owner,
  63. canTargetCondition: CanSelectPermanentCondition,
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. maxCount: 1,
  67. canNoSelect: false,
  68. canEndNotMax: false,
  69. selectPermanentCoroutine: SelectPermanentCoroutine,
  70. afterSelectPermanentCoroutine: null,
  71. mode: SelectPermanentEffect.Mode.Custom,
  72. cardEffect: activateClass);
  73. selectPermanentEffect.SetUpCustomMessage("Select a Digimon to become immune.", "The opponent is selecting a Digimon to become immune.");
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  76. {
  77. selectedPermanent = permanent;
  78. yield return null;
  79. }
  80. if (selectedPermanent != null)
  81. {
  82. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => PermanentEffectFactory.DigimonEffectImmunity(selectedPermanent));
  83. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  84. }
  85. }
  86. }
  87. #endregion
  88. #region Shared WD / WA / Counter
  89. string SharedHashString = "EX12_052_WD_WA_Counter";
  90. string SharedEffectName = "1 of your Digimon may get +3K DP until enemy turn ends and battle 1 enemy Digimon";
  91. string SharedEffectDescription(string tag)
  92. => $"[{tag}] [Once Per Turn] 1 of your Digimon may get +3000 DP until your opponent's turn ends, and battle 1 of their Digimon.";
  93. CardEffectFactory.ActivateClassesForSharedEffects
  94. (ref cardEffects, timing, card,
  95. SharedEffectName,
  96. SharedActivateCoroutine,
  97. SharedEffectDescription,
  98. optional: false,
  99. isSkippable: true,
  100. maxCountPerTurn: 1,
  101. hashValue: SharedHashString,
  102. whenDigivolving: true,
  103. whenAttacking: true,
  104. counter: true);
  105. bool CanSelectBattlePermanentCondition(Permanent permanent)
  106. {
  107. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  108. }
  109. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  110. {
  111. bool isUsed = false;
  112. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  113. selectPermanentEffect.SetUp(
  114. selectPlayer: card.Owner,
  115. canTargetCondition: CanSelectPermanentCondition,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. maxCount: 1,
  119. canNoSelect: true,
  120. canEndNotMax: false,
  121. selectPermanentCoroutine: SelectPermanentCoroutine,
  122. afterSelectPermanentCoroutine: null,
  123. mode: SelectPermanentEffect.Mode.Custom,
  124. cardEffect: activateClass);
  125. selectPermanentEffect.SetUpCustomMessage("Select a Digimon to get 3K DP and battle.", "Opponent is selecting a Digimon to get 3K DP and battle.");
  126. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  127. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  128. {
  129. if (permanent != null)
  130. {
  131. isUsed = true;
  132. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP
  133. (
  134. permanent,
  135. 3000,
  136. EffectDuration.UntilOpponentTurnEnd,
  137. activateClass
  138. ));
  139. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectBattlePermanentCondition))
  140. {
  141. Permanent selectedPermanent = null;
  142. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  143. selectPermanentEffect.SetUp(
  144. selectPlayer: card.Owner,
  145. canTargetCondition: CanSelectBattlePermanentCondition,
  146. canTargetCondition_ByPreSelecetedList: null,
  147. canEndSelectCondition: null,
  148. maxCount: 1,
  149. canNoSelect: false,
  150. canEndNotMax: false,
  151. selectPermanentCoroutine: SelectPermanentCoroutine,
  152. afterSelectPermanentCoroutine: null,
  153. mode: SelectPermanentEffect.Mode.Custom,
  154. cardEffect: activateClass);
  155. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to battle.", "The opponent is selecting 1 Digimon to battle.");
  156. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  157. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  158. {
  159. selectedPermanent = permanent;
  160. yield return null;
  161. }
  162. yield return ContinuousController.instance.StartCoroutine(new IBattle(permanent, selectedPermanent, null, true).Battle());
  163. }
  164. }
  165. }
  166. if (!isUsed) activateClass.RemoveUse();
  167. }
  168. #endregion
  169. #endregion
  170. #region Option Effects
  171. #region Ignore Colour Requirement
  172. if (timing == EffectTiming.None)
  173. {
  174. cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
  175. bool CardCondition(CardSource cardSource)
  176. {
  177. return cardSource.HasText("NSp");
  178. }
  179. }
  180. #endregion
  181. #region Main
  182. if (timing == EffectTiming.OptionSkill)
  183. {
  184. ActivateClass activateClass = new ActivateClass();
  185. activateClass.SetUpICardEffect("May unsuspend 1 of your Digimon, then suspend 2 enemy Digimon, then 2 enemy Digimon/Tamer can't unsuspend until their turn ends", CanUseCondition, card);
  186. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  187. cardEffects.Add(activateClass);
  188. string EffectDescription()
  189. => "[Main] 1 of your Digimon may unsuspend. Then, suspend 2 of your opponent's Digimon. 2 of their Digimon or Tamers can't unsuspend until their turn ends.";
  190. bool CanUseCondition(Hashtable hashtable)
  191. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  192. bool CanSelectPermanentCondition1(Permanent permanent)
  193. {
  194. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  195. && permanent.IsSuspended
  196. && permanent.CanUnsuspend;
  197. }
  198. bool IsOpponentsDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  199. bool PermanentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  200. && (permanent.IsDigimon || permanent.IsTamer);
  201. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  202. {
  203. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  204. {
  205. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  206. selectPermanentEffect.SetUp(
  207. selectPlayer: card.Owner,
  208. canTargetCondition: CanSelectPermanentCondition1,
  209. canTargetCondition_ByPreSelecetedList: null,
  210. canEndSelectCondition: null,
  211. maxCount: 1,
  212. canNoSelect: true,
  213. canEndNotMax: false,
  214. selectPermanentCoroutine: null,
  215. afterSelectPermanentCoroutine: null,
  216. mode: SelectPermanentEffect.Mode.UnTap,
  217. cardEffect: activateClass);
  218. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  219. }
  220. if(CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  221. {
  222. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  223. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  224. selectPermanentEffect.SetUp(
  225. selectPlayer: card.Owner,
  226. canTargetCondition: IsOpponentsDigimon,
  227. canTargetCondition_ByPreSelecetedList: null,
  228. canEndSelectCondition: null,
  229. maxCount: maxCount,
  230. canNoSelect: false,
  231. canEndNotMax: false,
  232. selectPermanentCoroutine: null,
  233. afterSelectPermanentCoroutine: null,
  234. mode: SelectPermanentEffect.Mode.Tap,
  235. cardEffect: activateClass);
  236. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  237. }
  238. if(CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  239. {
  240. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  241. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  242. selectPermanentEffect.SetUp(
  243. selectPlayer: card.Owner,
  244. canTargetCondition: PermanentCondition,
  245. canTargetCondition_ByPreSelecetedList: null,
  246. canEndSelectCondition: null,
  247. maxCount: maxCount,
  248. canNoSelect: false,
  249. canEndNotMax: false,
  250. selectPermanentCoroutine: SelectPermanentCoroutine,
  251. afterSelectPermanentCoroutine: null,
  252. mode: SelectPermanentEffect.Mode.Custom,
  253. cardEffect: activateClass);
  254. selectPermanentEffect.SetUpCustomMessage($"Select {maxCount} Digimon or Tamer that will not unsuspend.", $"The opponent is selecting {maxCount} Digimon or Tamer that will not unsuspend.");
  255. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  256. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  257. {
  258. Permanent selectedPermanent = permanent;
  259. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  260. targetPermanent: selectedPermanent,
  261. activateClass: activateClass
  262. ));
  263. }
  264. }
  265. }
  266. }
  267. #endregion
  268. #region Arts Digivolution
  269. if (timing == EffectTiming.None)
  270. {
  271. cardEffects.Add(CardEffectFactory.ArtsDigivolveEffect(card));
  272. }
  273. #endregion
  274. #endregion
  275. return cardEffects;
  276. }
  277. }
  278. }