EX10_074.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using UnityEngine;
  5. //Beelzemon Ace
  6. namespace DCGO.CardEffects.EX10
  7. {
  8. public class EX10_074 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternate Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool Condition()
  17. {
  18. return card.Owner.TrashCards.Count >= 20;
  19. }
  20. bool PermanentCondition(Permanent targetPermanent)
  21. {
  22. return targetPermanent.TopCard.HasImpmonName &&
  23. targetPermanent.TopCard.IsLevel3;
  24. }
  25. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: Condition));
  26. }
  27. #endregion
  28. #region Blast Digivolve
  29. if (timing == EffectTiming.OnCounterTiming)
  30. {
  31. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  32. }
  33. #endregion
  34. #region Trash, then Delete effect
  35. string FirstEffectShortText() => "Trash top 2 from deck, Delete 1 play cost 6 or higher";
  36. string FirstEffectDiscription(string tag)
  37. {
  38. return $"[{tag}] Trash the top 2 cards of your deck. Then, delete 1 of your opponent's play cost 6 or lower Digimon. For every 10 cards in your trash, add 3 to the play cost maximum.";
  39. }
  40. bool FirstCanActivateCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  43. }
  44. IEnumerator FirstActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  45. {
  46. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(2, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  47. bool CanSelectPermanentCondition(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  50. permanent.TopCard.HasPlayCost &&
  51. permanent.TopCard.GetCostItself <= 6 + (3 * Mathf.FloorToInt(card.Owner.TrashCards.Count / 10));
  52. }
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  54. {
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: CanSelectPermanentCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: null,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Destroy,
  67. cardEffect: activateClass);
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. }
  70. }
  71. #region On Play
  72. if (timing == EffectTiming.OnEnterFieldAnyone)
  73. {
  74. ActivateClass activateClass = new ActivateClass();
  75. activateClass.SetUpICardEffect(FirstEffectShortText(), CanUseCondition, card);
  76. activateClass.SetUpActivateClass(FirstCanActivateCondition, (hashtable) => FirstActivateCoroutine(hashtable, activateClass), -1, false, FirstEffectDiscription("On Play"));
  77. cardEffects.Add(activateClass);
  78. bool CanUseCondition(Hashtable hashtable)
  79. {
  80. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  81. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  82. }
  83. }
  84. #endregion
  85. #region When Digivolving
  86. if (timing == EffectTiming.OnEnterFieldAnyone)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect(FirstEffectShortText(), CanUseCondition, card);
  90. activateClass.SetUpActivateClass(FirstCanActivateCondition, (hashtable) => FirstActivateCoroutine(hashtable, activateClass), -1, false, FirstEffectDiscription("When Digivolving"));
  91. cardEffects.Add(activateClass);
  92. bool CanUseCondition(Hashtable hashtable)
  93. {
  94. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  95. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  96. }
  97. }
  98. #endregion
  99. #region When Attacking
  100. if (timing == EffectTiming.OnAllyAttack)
  101. {
  102. ActivateClass activateClass = new ActivateClass();
  103. activateClass.SetUpICardEffect(FirstEffectShortText(), CanUseCondition, card);
  104. activateClass.SetUpActivateClass(FirstCanActivateCondition, (hashtable) => FirstActivateCoroutine(hashtable, activateClass), -1, false, FirstEffectDiscription("When Attacking"));
  105. cardEffects.Add(activateClass);
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  109. CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  110. }
  111. }
  112. #endregion
  113. #endregion
  114. #region Return 2, De-Digivolve 2 effect
  115. string SecondEffectShortText() => "Return 2 cards to top of deck, <De-Digivolve 2>";
  116. string SecondEffectDiscription(string tag)
  117. {
  118. return $"[{tag}] If you have 10 or more cards in your trash, by returning 2 non-Digi-Egg cards from your trash to the top of the deck, <De-Digivolve 2> 1 of your opponent's Digimon.";
  119. }
  120. bool SecondCanActivateCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  123. }
  124. IEnumerator SecondActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  125. {
  126. bool cardsAdded = false;
  127. if (card.Owner.TrashCards.Count >= 10)
  128. {
  129. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  130. bool CanSelectCardCondition(CardSource cardSource)
  131. {
  132. return !cardSource.IsDigiEgg;
  133. }
  134. selectCardEffect.SetUp(
  135. canTargetCondition: CanSelectCardCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. canNoSelect: () => true,
  139. selectCardCoroutine: null,
  140. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  141. message: "Select cards to place at the top of the deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  142. maxCount: 2,
  143. canEndNotMax: false,
  144. isShowOpponent: false,
  145. mode: SelectCardEffect.Mode.Custom,
  146. root: SelectCardEffect.Root.Trash,
  147. customRootCardList: null,
  148. canLookReverseCard: true,
  149. selectPlayer: card.Owner,
  150. cardEffect: activateClass);
  151. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  152. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  153. {
  154. if (cardSources.Count == 2)
  155. {
  156. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(cardSources));
  157. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Top Cards", true, true));
  158. cardsAdded = true;
  159. }
  160. }
  161. if (cardsAdded)
  162. {
  163. Permanent selectedPermanent = null;
  164. bool CanSelectPermanentCondition(Permanent permanent)
  165. {
  166. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  167. }
  168. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  169. {
  170. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  171. selectPermanentEffect.SetUp(
  172. selectPlayer: card.Owner,
  173. canTargetCondition: CanSelectPermanentCondition,
  174. canTargetCondition_ByPreSelecetedList: null,
  175. canEndSelectCondition: null,
  176. maxCount: 1,
  177. canNoSelect: false,
  178. canEndNotMax: false,
  179. selectPermanentCoroutine: SelectPermanentCoroutine,
  180. afterSelectPermanentCoroutine: null,
  181. mode: SelectPermanentEffect.Mode.Custom,
  182. cardEffect: activateClass);
  183. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  184. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  185. {
  186. selectedPermanent = permanent;
  187. yield return null;
  188. }
  189. if (selectedPermanent != null)
  190. {
  191. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 2, activateClass).Degeneration());
  192. }
  193. }
  194. }
  195. }
  196. }
  197. #region On Play
  198. if (timing == EffectTiming.OnEnterFieldAnyone)
  199. {
  200. ActivateClass activateClass = new ActivateClass();
  201. activateClass.SetUpICardEffect(SecondEffectShortText(), CanUseCondition, card);
  202. activateClass.SetUpActivateClass(SecondCanActivateCondition, (hashtable) => SecondActivateCoroutine(hashtable, activateClass), -1, false, SecondEffectDiscription("On Play"));
  203. cardEffects.Add(activateClass);
  204. bool CanUseCondition(Hashtable hashtable)
  205. {
  206. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  207. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  208. }
  209. }
  210. #endregion
  211. #region When Digivolving
  212. if (timing == EffectTiming.OnEnterFieldAnyone)
  213. {
  214. ActivateClass activateClass = new ActivateClass();
  215. activateClass.SetUpICardEffect(SecondEffectShortText(), CanUseCondition, card);
  216. activateClass.SetUpActivateClass(SecondCanActivateCondition, (hashtable) => SecondActivateCoroutine(hashtable, activateClass), -1, false, SecondEffectDiscription("When Digivolving"));
  217. cardEffects.Add(activateClass);
  218. bool CanUseCondition(Hashtable hashtable)
  219. {
  220. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  221. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  222. }
  223. }
  224. #endregion
  225. #endregion
  226. return cardEffects;
  227. }
  228. }
  229. }