EX8_026.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX8
  4. {
  5. public class EX8_026 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsTraits("DS") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. #endregion
  20. #region Blast Digivolve
  21. if (timing == EffectTiming.OnCounterTiming)
  22. {
  23. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  24. }
  25. #endregion
  26. #region On Play
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("<De-Digivolve 1>, Return 1 Digimon with 7 cost or less to bottom of deck ", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  32. cardEffects.Add(activateClass);
  33. string EffectDiscription()
  34. {
  35. return "[On Play] [When Digivolving] <De-Digivolve 1> 1 of your opponent's Digimon. Then, return 1 of your opponent's Digimon with a play cost of 7 or less to the bottom of the deck.";
  36. }
  37. bool OpponentsDigimon(Permanent permanent)
  38. {
  39. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  40. }
  41. bool OpponentsDigimonToReturn(Permanent permanent)
  42. {
  43. return OpponentsDigimon(permanent) &&
  44. permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 7;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  53. CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon);
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable hashtable)
  56. {
  57. Permanent dedigivolveSelected = null;
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: OpponentsDigimon,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: 1,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: SelectPermanentCoroutine,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  74. {
  75. dedigivolveSelected = permanent;
  76. yield return null;
  77. }
  78. if(dedigivolveSelected != null)
  79. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(dedigivolveSelected, 1, activateClass).Degeneration());
  80. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimonToReturn))
  81. {
  82. SelectPermanentEffect selectReturnEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  83. selectReturnEffect.SetUp(
  84. selectPlayer: card.Owner,
  85. canTargetCondition: OpponentsDigimonToReturn,
  86. canTargetCondition_ByPreSelecetedList: null,
  87. canEndSelectCondition: null,
  88. maxCount: 1,
  89. canNoSelect: false,
  90. canEndNotMax: false,
  91. selectPermanentCoroutine: SelectPermanentCoroutine,
  92. afterSelectPermanentCoroutine: null,
  93. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  94. cardEffect: activateClass);
  95. selectReturnEffect.SetUpCustomMessage("Select 1 Digimon to return to bottom of deck.", "The opponent is selecting 1 Digimon to return to bottom of deck.");
  96. yield return ContinuousController.instance.StartCoroutine(selectReturnEffect.Activate());
  97. }
  98. }
  99. }
  100. #endregion
  101. #region When Digivolving
  102. if (timing == EffectTiming.OnEnterFieldAnyone)
  103. {
  104. ActivateClass activateClass = new ActivateClass();
  105. activateClass.SetUpICardEffect("<De-Digivolve 1>, Return 1 Digimon with 7 cost or less to bottom of deck ", CanUseCondition, card);
  106. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  107. cardEffects.Add(activateClass);
  108. string EffectDiscription()
  109. {
  110. return "[When Digivolving] <De-Digivolve 1> 1 of your opponent's Digimon. Then, return 1 of your opponent's Digimon with a play cost of 7 or less to the bottom of the deck.";
  111. }
  112. bool OpponentsDigimon(Permanent permanent)
  113. {
  114. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  115. }
  116. bool OpponentsDigimonToReturn(Permanent permanent)
  117. {
  118. return OpponentsDigimon(permanent) &&
  119. permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 7;
  120. }
  121. bool CanUseCondition(Hashtable hashtable)
  122. {
  123. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) &&
  124. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  129. CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable hashtable)
  132. {
  133. Permanent dedigivolveSelected = null;
  134. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  135. selectPermanentEffect.SetUp(
  136. selectPlayer: card.Owner,
  137. canTargetCondition: OpponentsDigimon,
  138. canTargetCondition_ByPreSelecetedList: null,
  139. canEndSelectCondition: null,
  140. maxCount: 1,
  141. canNoSelect: false,
  142. canEndNotMax: false,
  143. selectPermanentCoroutine: SelectPermanentCoroutine,
  144. afterSelectPermanentCoroutine: null,
  145. mode: SelectPermanentEffect.Mode.Custom,
  146. cardEffect: activateClass);
  147. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  148. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  149. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  150. {
  151. dedigivolveSelected = permanent;
  152. yield return null;
  153. }
  154. if (dedigivolveSelected != null)
  155. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(dedigivolveSelected, 1, activateClass).Degeneration());
  156. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimonToReturn))
  157. {
  158. SelectPermanentEffect selectReturnEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  159. selectReturnEffect.SetUp(
  160. selectPlayer: card.Owner,
  161. canTargetCondition: OpponentsDigimonToReturn,
  162. canTargetCondition_ByPreSelecetedList: null,
  163. canEndSelectCondition: null,
  164. maxCount: 1,
  165. canNoSelect: false,
  166. canEndNotMax: false,
  167. selectPermanentCoroutine: SelectPermanentCoroutine,
  168. afterSelectPermanentCoroutine: null,
  169. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  170. cardEffect: activateClass);
  171. selectReturnEffect.SetUpCustomMessage("Select 1 Digimon to return to bottom of deck.", "The opponent is selecting 1 Digimon to return to bottom of deck.");
  172. yield return ContinuousController.instance.StartCoroutine(selectReturnEffect.Activate());
  173. }
  174. }
  175. }
  176. #endregion
  177. #region All Turns
  178. if (timing == EffectTiming.None)
  179. {
  180. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  181. canNotSuspendClass.SetUpICardEffect("Opponents Digimon Can't Suspend", CanUseCondition, card);
  182. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: CantSuspendCondition);
  183. cardEffects.Add(canNotSuspendClass);
  184. bool CantSuspendCondition(Permanent permanent)
  185. {
  186. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  187. {
  188. if (permanent.IsDigimon)
  189. {
  190. if (!permanent.TopCard.CanNotBeAffected(canNotSuspendClass))
  191. return true;
  192. }
  193. }
  194. return false;
  195. }
  196. bool CanUseCondition(Hashtable hashtable)
  197. {
  198. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  199. {
  200. return card.Owner.MemoryForPlayer >= 1;
  201. }
  202. return false;
  203. }
  204. }
  205. #endregion
  206. return cardEffects;
  207. }
  208. }
  209. }