EX12_017.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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 2> 1 enemy Digimon, then delete 1 enemy lowest DP 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, true, EffectDescription());
  164. activateClass.SetHashString("EX12_017_Counter");
  165. activateClass.SetIsCounterEffect(true);
  166. cardEffects.Add(activateClass);
  167. string EffectDescription()
  168. {
  169. 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.";
  170. }
  171. bool CanUseCondition(Hashtable hashtable)
  172. {
  173. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  174. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, permanent => CardEffectCommons.IsOpponentPermanent(permanent, card));
  175. }
  176. bool CanActivateCondition(Hashtable hashtable)
  177. {
  178. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  179. }
  180. bool CanSelectRedirectPermanentCondition (Permanent permanent)
  181. {
  182. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  183. }
  184. bool CanSelectDNACardCondition(CardSource cardSource)
  185. {
  186. return cardSource.IsDigimon
  187. && cardSource.CanPlayJogress(true)
  188. && (cardSource.EqualsCardName("Omnimon")
  189. || cardSource.EqualsTraits("ME")
  190. || cardSource.EqualsTraits("VB"));
  191. }
  192. IEnumerator ActivateCoroutine(Hashtable hashtable)
  193. {
  194. #region DNA digivolve
  195. yield return ContinuousController.instance.StartCoroutine(
  196. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  197. CanSelectDNACardCondition,
  198. payCost: true,
  199. isHand: true,
  200. activateClass
  201. ));
  202. #endregion
  203. #region Redirect attack
  204. Permanent selectedPermanent = null;
  205. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  206. selectPermanentEffect.SetUp(
  207. selectPlayer: card.Owner,
  208. canTargetCondition: CanSelectRedirectPermanentCondition,
  209. canTargetCondition_ByPreSelecetedList: null,
  210. canEndSelectCondition: null,
  211. maxCount: 1,
  212. canNoSelect: true,
  213. canEndNotMax: false,
  214. selectPermanentCoroutine: SelectPermanentCoroutine,
  215. afterSelectPermanentCoroutine: null,
  216. mode: SelectPermanentEffect.Mode.Custom,
  217. cardEffect: activateClass);
  218. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to change the attack target to.", "The opponent is selecting 1 Digimon to change the attack target to.");
  219. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  220. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  221. {
  222. selectedPermanent = permanent;
  223. yield return null;
  224. }
  225. if (selectedPermanent != null)
  226. {
  227. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender(
  228. activateClass,
  229. false,
  230. selectedPermanent));
  231. }
  232. #endregion
  233. }
  234. }
  235. #endregion
  236. #region Assembly
  237. if (timing == EffectTiming.None)
  238. {
  239. AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass();
  240. addAssemblyConditionClass.SetUpICardEffect("Assembly", CanUseCondition, card);
  241. addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly);
  242. addAssemblyConditionClass.SetNotShowUI(true);
  243. cardEffects.Add(addAssemblyConditionClass);
  244. bool CanUseCondition(Hashtable hashtable)
  245. {
  246. return true;
  247. }
  248. AssemblyCondition GetAssembly(CardSource cardSource)
  249. {
  250. if (cardSource == card)
  251. {
  252. AssemblyConditionElement element1 = new AssemblyConditionElement(CanSelectCardCondition1, elementCount: 1);
  253. AssemblyConditionElement element2 = new AssemblyConditionElement(CanSelectCardCondition2, elementCount: 1);
  254. AssemblyConditionElement element3 = new AssemblyConditionElement(CanSelectCardCondition3, elementCount: 1);
  255. bool CanSelectCardCondition1(CardSource cardSource)
  256. {
  257. return cardSource != null
  258. && cardSource.Owner == card.Owner
  259. && cardSource.IsLevel5
  260. && (cardSource.ContainsCardName("Agumon")
  261. || cardSource.ContainsCardName("Greymon")
  262. || cardSource.EqualsTraits("ME")
  263. || cardSource.EqualsTraits("VB"));
  264. }
  265. bool CanSelectCardCondition2(CardSource cardSource)
  266. {
  267. return cardSource != null
  268. && cardSource.Owner == card.Owner
  269. && cardSource.IsLevel4
  270. && (cardSource.ContainsCardName("Agumon")
  271. || cardSource.ContainsCardName("Greymon")
  272. || cardSource.EqualsTraits("ME")
  273. || cardSource.EqualsTraits("VB"));
  274. }
  275. bool CanSelectCardCondition3(CardSource cardSource)
  276. {
  277. return cardSource != null
  278. && cardSource.Owner == card.Owner
  279. && cardSource.IsLevel3
  280. && (cardSource.ContainsCardName("Agumon")
  281. || cardSource.ContainsCardName("Greymon")
  282. || cardSource.EqualsTraits("ME")
  283. || cardSource.EqualsTraits("VB"));
  284. }
  285. AssemblyCondition assemblyCondition = new AssemblyCondition(
  286. elements: new List<AssemblyConditionElement>() { element1, element2, element3 },
  287. reduceCost: 6);
  288. return assemblyCondition;
  289. }
  290. return null;
  291. }
  292. }
  293. #endregion
  294. return cardEffects;
  295. }
  296. }
  297. }