BT21_051.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_051 : 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.EqualsTraits("WG") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5);
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Blast Digivolve
  22. if (timing == EffectTiming.OnCounterTiming)
  23. {
  24. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  25. }
  26. #endregion
  27. #region Blocker
  28. if (timing == EffectTiming.None)
  29. {
  30. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  31. }
  32. #endregion
  33. #region Reboot
  34. if (timing == EffectTiming.None)
  35. {
  36. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  37. }
  38. #endregion
  39. #region On Play
  40. if (timing == EffectTiming.OnEnterFieldAnyone)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("<De-Digivolve 2> to 1 Digimon", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  45. cardEffects.Add(activateClass);
  46. string EffectDiscription()
  47. {
  48. return "[On Play] <De-Digivolve 2> 1 of your opponent's Digimon. Then, return 1 of their suspended Digimon to the bottom of the deck.";
  49. }
  50. bool CanSelectPermanentCondition(Permanent permanent)
  51. {
  52. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  53. }
  54. bool CanSelectPermanentCondition1(Permanent permanent)
  55. {
  56. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  57. {
  58. if (permanent.IsSuspended)
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  74. {
  75. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  76. {
  77. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  78. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  79. selectPermanentEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: CanSelectPermanentCondition,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: CanEndSelectCondition,
  84. maxCount: maxCount,
  85. canNoSelect: false,
  86. canEndNotMax: false,
  87. selectPermanentCoroutine: SelectPermanentCoroutine,
  88. afterSelectPermanentCoroutine: null,
  89. mode: SelectPermanentEffect.Mode.Custom,
  90. cardEffect: activateClass);
  91. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  92. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  93. bool CanEndSelectCondition(List<Permanent> permanents)
  94. {
  95. if (permanents.Count <= 0)
  96. {
  97. return false;
  98. }
  99. return true;
  100. }
  101. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 2, activateClass).Degeneration());
  104. }
  105. }
  106. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  107. {
  108. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  109. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  110. selectPermanentEffect1.SetUp(
  111. selectPlayer: card.Owner,
  112. canTargetCondition: CanSelectPermanentCondition1,
  113. canTargetCondition_ByPreSelecetedList: null,
  114. canEndSelectCondition: null,
  115. maxCount: maxCount1,
  116. canNoSelect: false,
  117. canEndNotMax: false,
  118. selectPermanentCoroutine: null,
  119. afterSelectPermanentCoroutine: null,
  120. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  121. cardEffect: activateClass);
  122. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  123. }
  124. }
  125. }
  126. #endregion
  127. #region When Digivolving
  128. if (timing == EffectTiming.OnEnterFieldAnyone)
  129. {
  130. ActivateClass activateClass = new ActivateClass();
  131. activateClass.SetUpICardEffect("<De-Digivolve 2> to 1 Digimon", CanUseCondition, card);
  132. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  133. cardEffects.Add(activateClass);
  134. string EffectDiscription()
  135. {
  136. return "[When Digivolving] <De-Digivolve 2> 1 of your opponent's Digimon. Then, return 1 of their suspended Digimon to the bottom of the deck.";
  137. }
  138. bool CanSelectPermanentCondition(Permanent permanent)
  139. {
  140. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  141. }
  142. bool CanSelectPermanentCondition1(Permanent permanent)
  143. {
  144. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  145. {
  146. if (permanent.IsSuspended)
  147. {
  148. return true;
  149. }
  150. }
  151. return false;
  152. }
  153. bool CanUseCondition(Hashtable hashtable)
  154. {
  155. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  156. }
  157. bool CanActivateCondition(Hashtable hashtable)
  158. {
  159. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  160. }
  161. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  162. {
  163. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  164. {
  165. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  166. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  167. selectPermanentEffect.SetUp(
  168. selectPlayer: card.Owner,
  169. canTargetCondition: CanSelectPermanentCondition,
  170. canTargetCondition_ByPreSelecetedList: null,
  171. canEndSelectCondition: CanEndSelectCondition,
  172. maxCount: maxCount,
  173. canNoSelect: false,
  174. canEndNotMax: false,
  175. selectPermanentCoroutine: SelectPermanentCoroutine,
  176. afterSelectPermanentCoroutine: null,
  177. mode: SelectPermanentEffect.Mode.Custom,
  178. cardEffect: activateClass);
  179. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  180. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  181. bool CanEndSelectCondition(List<Permanent> permanents)
  182. {
  183. if (permanents.Count <= 0)
  184. {
  185. return false;
  186. }
  187. return true;
  188. }
  189. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  190. {
  191. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 2, activateClass).Degeneration());
  192. }
  193. }
  194. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  195. {
  196. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  197. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  198. selectPermanentEffect1.SetUp(
  199. selectPlayer: card.Owner,
  200. canTargetCondition: CanSelectPermanentCondition1,
  201. canTargetCondition_ByPreSelecetedList: null,
  202. canEndSelectCondition: null,
  203. maxCount: maxCount1,
  204. canNoSelect: false,
  205. canEndNotMax: false,
  206. selectPermanentCoroutine: null,
  207. afterSelectPermanentCoroutine: null,
  208. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  209. cardEffect: activateClass);
  210. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  211. }
  212. }
  213. }
  214. #endregion
  215. return cardEffects;
  216. }
  217. }
  218. }