EX12_017.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // WarGreymon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_017 : 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("Greymon")
  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.Red)
  50. || permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  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.Black)
  57. || permanent.TopCard.CardColors.Contains(CardColor.Purple))
  58. && permanent.Levels_ForJogress(card).Contains(5);
  59. }
  60. JogressConditionElement[] elements = new JogressConditionElement[]
  61. {
  62. new JogressConditionElement(PermanentCondition1, "a level 5 Red or Yellow Digimon"),
  63. new JogressConditionElement(PermanentCondition2, "a level 5 Black or Purple Digimon"),
  64. };
  65. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  66. return jogressCondition;
  67. }
  68. return null;
  69. }
  70. }
  71. #endregion
  72. #region Security A. +1
  73. if (timing == EffectTiming.None) cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  74. #endregion
  75. #region Decode
  76. if (timing == EffectTiming.WhenRemoveField)
  77. {
  78. bool SourceCondition(CardSource cardSource)
  79. {
  80. return cardSource.IsDigimon
  81. && cardSource.HasLevel
  82. && cardSource.Level <= 5
  83. && (cardSource.ContainsCardName("Agumon")
  84. || cardSource.ContainsCardName("Greymon")
  85. || cardSource.EqualsTraits("ME")
  86. || cardSource.EqualsTraits("VB"));
  87. }
  88. string[] decodeStrings = { "(Lv.5 or lower w/[Agumon]/[Greymon] in name or w/[ME]/[VB] trait)", "Level 5 or lower Digimon card with [Agumon]/[Greymon] in name or [ME]/[VB] trait" };
  89. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  90. }
  91. #endregion
  92. #region Shared OP/WD/WA
  93. string SharedEffectName = "<De-Digivolve 3> 1 enemy Digimon, then by placing 2 [Gammamon] text/[VB] from trash under, taunt 1 enemy Digimon";
  94. string SharedHashString = "EX12_017_OP_WD_WA";
  95. CardEffectFactory.ActivateClassesForSharedEffects
  96. (ref cardEffects, timing, card,
  97. SharedEffectName,
  98. SharedActivateCoroutine,
  99. SharedEffectDescription,
  100. optional: false,
  101. maxCountPerTurn: 1,
  102. hashValue: SharedHashString,
  103. onPlay: true,
  104. whenDigivolving: true,
  105. whenAttacking: true);
  106. string SharedEffectDescription(string tag)
  107. {
  108. return $"[{tag}] [Once Per Turn] <De-Digivolve 2> 1 of your opponent's Digimon. Then, delete 1 of your opponent's lowest DP Digimon.";
  109. }
  110. bool CanSelectPermanentCondition(Permanent permanent)
  111. {
  112. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  113. }
  114. bool CanSelectMinDPDigimon(Permanent permanent)
  115. {
  116. return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
  117. }
  118. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  119. {
  120. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  121. {
  122. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  123. selectPermanentEffect.SetUp(
  124. selectPlayer: card.Owner,
  125. canTargetCondition: CanSelectPermanentCondition,
  126. canTargetCondition_ByPreSelecetedList: null,
  127. canEndSelectCondition: null,
  128. maxCount: 1,
  129. canNoSelect: false,
  130. canEndNotMax: false,
  131. selectPermanentCoroutine: null,
  132. afterSelectPermanentCoroutine: null,
  133. mode: SelectPermanentEffect.Mode.Degenerate,
  134. cardEffect: activateClass);
  135. selectPermanentEffect.SetDegenerationCount(2);
  136. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-Digivolve", "The opponent is selecting 1 Digimon to De-Digivolve");
  137. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  138. }
  139. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectMinDPDigimon))
  140. {
  141. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  142. selectPermanentEffect.SetUp(
  143. selectPlayer: card.Owner,
  144. canTargetCondition: CanSelectMinDPDigimon,
  145. canTargetCondition_ByPreSelecetedList: null,
  146. canEndSelectCondition: null,
  147. maxCount: 1,
  148. canNoSelect: false,
  149. canEndNotMax: false,
  150. selectPermanentCoroutine: null,
  151. afterSelectPermanentCoroutine: null,
  152. mode: SelectPermanentEffect.Mode.Destroy,
  153. cardEffect: activateClass);
  154. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  155. }
  156. }
  157. #endregion
  158. #region Counter
  159. if (timing == EffectTiming.OnCounterTiming)
  160. {
  161. ActivateClass activateClass = new ActivateClass();
  162. activateClass.SetUpICardEffect("2 of your Digimon may DNA into [Omnimon]/[ME]/[VB] in hand, then may redirect attack", CanUseCondition, card);
  163. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  164. activateClass.SetIsSkippable(true);
  165. activateClass.SetHashString("EX12_017_Counter");
  166. activateClass.SetIsCounterEffect(true);
  167. cardEffects.Add(activateClass);
  168. string EffectDescription()
  169. {
  170. return "[Counter] [Once Per Turn] 2 of your Digimon may DNA digivolve into [Omnimon] or an [ME] or [VB] trait Digimon card in the hand. Then, you may change the attack target to 1 of your Digimon.";
  171. }
  172. bool CanUseCondition(Hashtable hashtable)
  173. {
  174. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  175. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, permanent => CardEffectCommons.IsOpponentPermanent(permanent, card));
  176. }
  177. bool CanActivateCondition(Hashtable hashtable)
  178. {
  179. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  180. }
  181. bool CanSelectRedirectPermanentCondition (Permanent permanent)
  182. {
  183. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  184. }
  185. bool CanSelectDNACardCondition(CardSource cardSource)
  186. {
  187. return cardSource.IsDigimon
  188. && cardSource.CanPlayJogress(true)
  189. && (cardSource.EqualsCardName("Omnimon")
  190. || cardSource.EqualsTraits("ME")
  191. || cardSource.EqualsTraits("VB"));
  192. }
  193. IEnumerator ActivateCoroutine(Hashtable hashtable)
  194. {
  195. #region DNA digivolve
  196. yield return ContinuousController.instance.StartCoroutine(
  197. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  198. CanSelectDNACardCondition,
  199. payCost: true,
  200. isHand: true,
  201. activateClass
  202. ));
  203. #endregion
  204. #region Redirect attack
  205. Permanent selectedPermanent = null;
  206. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  207. selectPermanentEffect.SetUp(
  208. selectPlayer: card.Owner,
  209. canTargetCondition: CanSelectRedirectPermanentCondition,
  210. canTargetCondition_ByPreSelecetedList: null,
  211. canEndSelectCondition: null,
  212. maxCount: 1,
  213. canNoSelect: true,
  214. canEndNotMax: false,
  215. selectPermanentCoroutine: SelectPermanentCoroutine,
  216. afterSelectPermanentCoroutine: null,
  217. mode: SelectPermanentEffect.Mode.Custom,
  218. cardEffect: activateClass);
  219. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to change the attack target to.", "The opponent is selecting 1 Digimon to change the attack target to.");
  220. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  221. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  222. {
  223. selectedPermanent = permanent;
  224. yield return null;
  225. }
  226. if (selectedPermanent != null)
  227. {
  228. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender(
  229. activateClass,
  230. false,
  231. selectedPermanent));
  232. }
  233. #endregion
  234. }
  235. }
  236. #endregion
  237. #region Assembly
  238. if (timing == EffectTiming.None)
  239. {
  240. AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass();
  241. addAssemblyConditionClass.SetUpICardEffect("Assembly", CanUseCondition, card);
  242. addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly);
  243. addAssemblyConditionClass.SetNotShowUI(true);
  244. cardEffects.Add(addAssemblyConditionClass);
  245. bool CanUseCondition(Hashtable hashtable)
  246. {
  247. return true;
  248. }
  249. AssemblyCondition GetAssembly(CardSource cardSource)
  250. {
  251. if (cardSource == card)
  252. {
  253. AssemblyConditionElement element1 = new AssemblyConditionElement(CanSelectCardCondition1, elementCount: 1);
  254. AssemblyConditionElement element2 = new AssemblyConditionElement(CanSelectCardCondition2, elementCount: 1);
  255. AssemblyConditionElement element3 = new AssemblyConditionElement(CanSelectCardCondition3, elementCount: 1);
  256. bool CanSelectCardCondition1(CardSource cardSource)
  257. {
  258. return cardSource != null
  259. && cardSource.Owner == card.Owner
  260. && cardSource.IsLevel5
  261. && (cardSource.ContainsCardName("Agumon")
  262. || cardSource.ContainsCardName("Greymon")
  263. || cardSource.EqualsTraits("ME")
  264. || cardSource.EqualsTraits("VB"));
  265. }
  266. bool CanSelectCardCondition2(CardSource cardSource)
  267. {
  268. return cardSource != null
  269. && cardSource.Owner == card.Owner
  270. && cardSource.IsLevel4
  271. && (cardSource.ContainsCardName("Agumon")
  272. || cardSource.ContainsCardName("Greymon")
  273. || cardSource.EqualsTraits("ME")
  274. || cardSource.EqualsTraits("VB"));
  275. }
  276. bool CanSelectCardCondition3(CardSource cardSource)
  277. {
  278. return cardSource != null
  279. && cardSource.Owner == card.Owner
  280. && cardSource.IsLevel3
  281. && (cardSource.ContainsCardName("Agumon")
  282. || cardSource.ContainsCardName("Greymon")
  283. || cardSource.EqualsTraits("ME")
  284. || cardSource.EqualsTraits("VB"));
  285. }
  286. AssemblyCondition assemblyCondition = new AssemblyCondition(
  287. elements: new List<AssemblyConditionElement>() { element1, element2, element3 },
  288. reduceCost: 6);
  289. return assemblyCondition;
  290. }
  291. return null;
  292. }
  293. }
  294. #endregion
  295. return cardEffects;
  296. }
  297. }
  298. }