EX5_055.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX5
  5. {
  6. public class EX5_055 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.ContainsCardName("Leomon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnDestroyedAnyone)
  20. {
  21. cardEffects.Add(CardEffectFactory.FortitudeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  22. }
  23. if (timing == EffectTiming.OnDestroyedAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("De-Digivolve 1 on 1 Digimon and return 1 Digimon to the bottom of deck", canUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[On Deletion] <De-Digivolve 1> 1 of your opponent's Digimon (Trash up to 1 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards). Then, return 1 of their 6000 DP or lower Digimon to the bottom of the deck.";
  32. }
  33. bool CanSelectPermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  36. }
  37. bool CanSelectPermanentCondition1(Permanent permanent)
  38. {
  39. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  40. {
  41. if (permanent.DP <= 6000)
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. bool canUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  58. return true;
  59. }
  60. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  70. {
  71. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectPermanentCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: maxCount,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: SelectPermanentCoroutine,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Custom,
  84. cardEffect: activateClass);
  85. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  88. {
  89. Permanent selectedPermanent = permanent;
  90. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  91. }
  92. }
  93. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  94. {
  95. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  96. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  97. selectPermanentEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectPermanentCondition1,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: null,
  102. maxCount: maxCount,
  103. canNoSelect: false,
  104. canEndNotMax: false,
  105. selectPermanentCoroutine: null,
  106. afterSelectPermanentCoroutine: null,
  107. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  108. cardEffect: activateClass);
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. }
  111. }
  112. }
  113. if (timing == EffectTiming.OnEnterFieldAnyone)
  114. {
  115. ActivateClass activateClass = new ActivateClass();
  116. activateClass.SetUpICardEffect("De-Digivolve 1 on 1 Digimon and return 1 Digimon to the bottom of deck", canUseCondition, card);
  117. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  118. cardEffects.Add(activateClass);
  119. string EffectDiscription()
  120. {
  121. return "[When Digivolving] <De-Digivolve 1> 1 of your opponent's Digimon (Trash up to 1 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards). Then, return 1 of their 6000 DP or lower Digimon to the bottom of the deck.";
  122. }
  123. bool CanSelectPermanentCondition(Permanent permanent)
  124. {
  125. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  126. }
  127. bool CanSelectPermanentCondition1(Permanent permanent)
  128. {
  129. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  130. {
  131. if (permanent.DP <= 6000)
  132. {
  133. return true;
  134. }
  135. }
  136. return false;
  137. }
  138. bool canUseCondition(Hashtable hashtable)
  139. {
  140. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  141. }
  142. bool CanActivateCondition(Hashtable hashtable)
  143. {
  144. if (CardEffectCommons.IsExistOnBattleArea(card))
  145. {
  146. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  147. {
  148. return true;
  149. }
  150. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  151. {
  152. return true;
  153. }
  154. }
  155. return false;
  156. }
  157. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  158. {
  159. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  160. {
  161. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  162. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  163. selectPermanentEffect.SetUp(
  164. selectPlayer: card.Owner,
  165. canTargetCondition: CanSelectPermanentCondition,
  166. canTargetCondition_ByPreSelecetedList: null,
  167. canEndSelectCondition: null,
  168. maxCount: maxCount,
  169. canNoSelect: false,
  170. canEndNotMax: false,
  171. selectPermanentCoroutine: SelectPermanentCoroutine,
  172. afterSelectPermanentCoroutine: null,
  173. mode: SelectPermanentEffect.Mode.Custom,
  174. cardEffect: activateClass);
  175. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  176. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  177. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  178. {
  179. Permanent selectedPermanent = permanent;
  180. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  181. }
  182. }
  183. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  184. {
  185. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  186. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  187. selectPermanentEffect.SetUp(
  188. selectPlayer: card.Owner,
  189. canTargetCondition: CanSelectPermanentCondition1,
  190. canTargetCondition_ByPreSelecetedList: null,
  191. canEndSelectCondition: null,
  192. maxCount: maxCount,
  193. canNoSelect: false,
  194. canEndNotMax: false,
  195. selectPermanentCoroutine: null,
  196. afterSelectPermanentCoroutine: null,
  197. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  198. cardEffect: activateClass);
  199. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  200. }
  201. }
  202. }
  203. if (timing == EffectTiming.OnEndAttack)
  204. {
  205. ActivateClass activateClass = new ActivateClass();
  206. activateClass.SetUpICardEffect("Return 1 Digimon to the bottom of deck or unsuspend this Digimon", CanUseCondition, card);
  207. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  208. activateClass.SetHashString("DeckBounceOrUnsuspend_EX5_055");
  209. cardEffects.Add(activateClass);
  210. string EffectDiscription()
  211. {
  212. return "[End of Attack] [Once Per Turn] Return 1 of your opponent's 4000 DP or lower Digimon to the bottom of the deck. If you didn't, unsuspend this Digimon.";
  213. }
  214. bool CanSelectPermanentCondition(Permanent permanent)
  215. {
  216. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  217. {
  218. if (permanent.DP <= 4000)
  219. {
  220. return true;
  221. }
  222. }
  223. return false;
  224. }
  225. bool CanUseCondition(Hashtable hashtable)
  226. {
  227. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  228. }
  229. bool CanActivateCondition(Hashtable hashtable)
  230. {
  231. if (CardEffectCommons.IsExistOnBattleArea(card))
  232. {
  233. return true;
  234. }
  235. return false;
  236. }
  237. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  238. {
  239. bool returned = false;
  240. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  241. {
  242. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  243. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  244. selectPermanentEffect.SetUp(
  245. selectPlayer: card.Owner,
  246. canTargetCondition: CanSelectPermanentCondition,
  247. canTargetCondition_ByPreSelecetedList: null,
  248. canEndSelectCondition: null,
  249. maxCount: maxCount,
  250. canNoSelect: false,
  251. canEndNotMax: false,
  252. selectPermanentCoroutine: SelectPermanentCoroutine,
  253. afterSelectPermanentCoroutine: null,
  254. mode: SelectPermanentEffect.Mode.Custom,
  255. cardEffect: activateClass);
  256. selectPermanentEffect.SetUpCustomMessage(
  257. "Select 1 Digimon to return to the bottom of deck.",
  258. "The opponent is selecting 1 Digimon to return to the bottom of deck.");
  259. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  260. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  261. {
  262. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(
  263. targetPermanents: new List<Permanent>() { permanent },
  264. activateClass: activateClass,
  265. successProcess: SuccessProcess(),
  266. failureProcess: null));
  267. IEnumerator SuccessProcess()
  268. {
  269. returned = true;
  270. yield return null;
  271. }
  272. }
  273. }
  274. if (!returned)
  275. {
  276. Permanent selectedPermanent = card.PermanentOfThisCard();
  277. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
  278. new List<Permanent>() { selectedPermanent },
  279. activateClass).Unsuspend());
  280. }
  281. }
  282. }
  283. return cardEffects;
  284. }
  285. }
  286. }