EX12_035.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // MetalGarurumon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_035 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("Garurumon")
  17. || targetPermanent.TopCard.EqualsTraits("ME")
  18. || targetPermanent.TopCard.EqualsTraits("VB");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null,
  26. level: 5)
  27. );
  28. }
  29. #endregion
  30. #region DNA Digivolution
  31. if (timing == EffectTiming.None)
  32. {
  33. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  34. addJogressConditionClass.SetUpICardEffect("DNA Digivolution", CanUseCondition, card);
  35. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  36. addJogressConditionClass.SetNotShowUI(true);
  37. cardEffects.Add(addJogressConditionClass);
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return true;
  41. }
  42. JogressCondition GetJogress(CardSource cardSource)
  43. {
  44. if (cardSource == card)
  45. {
  46. bool PermanentCondition1(Permanent permanent)
  47. {
  48. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  49. && (permanent.TopCard.CardColors.Contains(CardColor.Blue)
  50. || permanent.TopCard.CardColors.Contains(CardColor.Black))
  51. && permanent.Levels_ForJogress(card).Contains(5);
  52. }
  53. bool PermanentCondition2(Permanent permanent)
  54. {
  55. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  56. && (permanent.TopCard.CardColors.Contains(CardColor.Purple)
  57. || permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  58. && permanent.Levels_ForJogress(card).Contains(5);
  59. }
  60. JogressConditionElement[] elements = new JogressConditionElement[]
  61. {
  62. new JogressConditionElement(PermanentCondition1, "a level 5 Blue or Black Digimon"),
  63. new JogressConditionElement(PermanentCondition2, "a level 5 Purple or Yellow Digimon"),
  64. };
  65. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  66. return jogressCondition;
  67. }
  68. return null;
  69. }
  70. }
  71. #endregion
  72. #region Evade
  73. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  74. {
  75. cardEffects.Add(CardEffectFactory.EvadeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  76. }
  77. #endregion
  78. #region Decode
  79. if (timing == EffectTiming.WhenRemoveField)
  80. {
  81. bool SourceCondition(CardSource cardSource)
  82. {
  83. return cardSource.IsDigimon
  84. && cardSource.HasLevel
  85. && cardSource.Level <= 5
  86. && (cardSource.ContainsCardName("Gabumon")
  87. || cardSource.ContainsCardName("Garurumon")
  88. || cardSource.EqualsTraits("ME")
  89. || cardSource.EqualsTraits("VB"));
  90. }
  91. string[] decodeStrings = { "(Lv.5 or lower w/[Gabumon]/[Garurumon] in name or w/[ME]/[VB] trait)", "Level 5 or lower Digimon card with [Gabumon]/[Garurumon] in name or [ME]/[VB] trait" };
  92. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  93. }
  94. #endregion
  95. #region Shared OP/WD
  96. string SharedEffectName = "Trash 4 enemy Digimon sources, then bot deck 1 enemy Digimon with less sources than this";
  97. CardEffectFactory.ActivateClassesForSharedEffects
  98. (ref cardEffects, timing, card,
  99. SharedEffectName,
  100. SharedActivateCoroutine,
  101. SharedEffectDescription,
  102. optional: false,
  103. onPlay: true,
  104. whenDigivolving: true);
  105. string SharedEffectDescription(string tag)
  106. {
  107. return $"[{tag}] Trash any 4 digivolution cards from your opponent's Digimon. Then, return 1 of your opponent's Digimon with as many or fewer digivolution cards as this Digimon to the bottom of the deck.";
  108. }
  109. bool CanSelectTrashPermanentCondition(Permanent permanent)
  110. {
  111. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  112. && !permanent.HasNoDigivolutionCards;
  113. }
  114. bool CanSelectSpinPermanentCondition(Permanent permanent)
  115. {
  116. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  117. && permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count;
  118. }
  119. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  122. permanentCondition: CanSelectTrashPermanentCondition,
  123. cardCondition: _ => true,
  124. maxCount: 4,
  125. canNoTrash: false,
  126. isFromOnly1Permanent: false,
  127. activateClass: activateClass
  128. ));
  129. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSpinPermanentCondition))
  130. {
  131. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  132. selectPermanentEffect.SetUp(
  133. selectPlayer: card.Owner,
  134. canTargetCondition: CanSelectSpinPermanentCondition,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. maxCount: 1,
  138. canNoSelect: false,
  139. canEndNotMax: false,
  140. selectPermanentCoroutine: null,
  141. afterSelectPermanentCoroutine: null,
  142. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  143. cardEffect: activateClass);
  144. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  145. }
  146. }
  147. #endregion
  148. #region All Turns
  149. if (timing == EffectTiming.OnEnterFieldAnyone)
  150. {
  151. ActivateClass activateClass = new ActivateClass();
  152. activateClass.SetUpICardEffect("Stun 1 enemy Digimon", CanUseCondition, card);
  153. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  154. activateClass.SetHashString("EX12_035_AT");
  155. cardEffects.Add(activateClass);
  156. string EffectDescription()
  157. => "[All Turns] [Once Per Turn] When any Digimon are played or digivolve, 1 of your opponent's Digimon can't suspend until their turn ends.";
  158. bool CanUseCondition(Hashtable hashtable)
  159. {
  160. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  161. && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsDigimonCondition)
  162. || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, IsDigimonCondition));
  163. }
  164. bool IsDigimonCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  165. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  166. bool CanSelectPermanentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  167. IEnumerator ActivateCoroutine(Hashtable hashtable)
  168. {
  169. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  170. {
  171. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  172. selectPermanentEffect1.SetUp(
  173. selectPlayer: card.Owner,
  174. canTargetCondition: CanSelectPermanentCondition,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canEndSelectCondition: null,
  177. maxCount: 1,
  178. canNoSelect: false,
  179. canEndNotMax: false,
  180. selectPermanentCoroutine: SelectPermanentCoroutine,
  181. afterSelectPermanentCoroutine: null,
  182. mode: SelectPermanentEffect.Mode.Custom,
  183. cardEffect: activateClass);
  184. selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon to gain can't suspend until end of opponent's turn.", "The opponent is selecting 1 Digimon that will gain can't suspend until end of opponent's turn.");
  185. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  186. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  187. {
  188. if (permanent != null)
  189. {
  190. #region Can't Suspend
  191. Permanent selectedPermanent = permanent;
  192. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  193. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  194. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  195. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  196. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  197. {
  198. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  199. }
  200. bool CanUseCondition1(Hashtable hashtable)
  201. {
  202. return selectedPermanent.TopCard != null
  203. && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  204. }
  205. bool PermanentCondition(Permanent permanent)
  206. {
  207. return permanent == selectedPermanent;
  208. }
  209. #endregion
  210. }
  211. yield return null;
  212. }
  213. }
  214. }
  215. }
  216. #endregion
  217. #region Assembly
  218. if (timing == EffectTiming.None)
  219. {
  220. AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass();
  221. addAssemblyConditionClass.SetUpICardEffect("Assembly", CanUseCondition, card);
  222. addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly);
  223. addAssemblyConditionClass.SetNotShowUI(true);
  224. cardEffects.Add(addAssemblyConditionClass);
  225. bool CanUseCondition(Hashtable hashtable)
  226. {
  227. return true;
  228. }
  229. AssemblyCondition GetAssembly(CardSource cardSource)
  230. {
  231. if (cardSource == card)
  232. {
  233. AssemblyConditionElement element1 = new AssemblyConditionElement(CanSelectCardCondition1, elementCount: 1);
  234. AssemblyConditionElement element2 = new AssemblyConditionElement(CanSelectCardCondition2, elementCount: 1);
  235. AssemblyConditionElement element3 = new AssemblyConditionElement(CanSelectCardCondition3, elementCount: 1);
  236. bool CanSelectCardCondition1(CardSource cardSource)
  237. {
  238. return cardSource != null
  239. && cardSource.Owner == card.Owner
  240. && cardSource.IsLevel5
  241. && (cardSource.ContainsCardName("Gabumon")
  242. || cardSource.ContainsCardName("Garurumon")
  243. || cardSource.EqualsTraits("ME")
  244. || cardSource.EqualsTraits("VB"));
  245. }
  246. bool CanSelectCardCondition2(CardSource cardSource)
  247. {
  248. return cardSource != null
  249. && cardSource.Owner == card.Owner
  250. && cardSource.IsLevel4
  251. && (cardSource.ContainsCardName("Gabumon")
  252. || cardSource.ContainsCardName("Garurumon")
  253. || cardSource.EqualsTraits("ME")
  254. || cardSource.EqualsTraits("VB"));
  255. }
  256. bool CanSelectCardCondition3(CardSource cardSource)
  257. {
  258. return cardSource != null
  259. && cardSource.Owner == card.Owner
  260. && cardSource.IsLevel3
  261. && (cardSource.ContainsCardName("Gabumon")
  262. || cardSource.ContainsCardName("Garurumon")
  263. || cardSource.EqualsTraits("ME")
  264. || cardSource.EqualsTraits("VB"));
  265. }
  266. AssemblyCondition assemblyCondition = new AssemblyCondition(
  267. elements: new List<AssemblyConditionElement>() { element1, element2, element3 },
  268. reduceCost: 6);
  269. return assemblyCondition;
  270. }
  271. return null;
  272. }
  273. }
  274. #endregion
  275. return cardEffects;
  276. }
  277. }
  278. }