BT23_075.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. //Eater EDEN
  6. namespace DCGO.CardEffects.BT23
  7. {
  8. public class BT23_075 : 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 Requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsCardName("Eater Legion");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region On Play
  24. if (timing == EffectTiming.OnEnterFieldAnyone)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Return 1 of your opponent's Digimon or Tamers to the bottom of the deck.", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  29. cardEffects.Add(activateClass);
  30. string EffectDiscription()
  31. {
  32. return "[On Play] [When Digivolving] Return 1 of your opponent's play cost 6 or lower Digimon or Tamers to the bottom of the deck. For each of your [Mother Eater]'s digivolution cards in the breeding area, add 1 to this effect's play cost maximum.";
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  37. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  38. }
  39. bool HasMother(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card) &&
  42. permanent.TopCard.EqualsCardName("Mother Eater");
  43. }
  44. bool CanSelectPermanentCondition(Permanent permanent)
  45. {
  46. int maxCost = 6;
  47. if (CardEffectCommons.HasMatchConditionPermanent(HasMother, true))
  48. maxCost += card.Owner.GetBreedingAreaPermanents()[0].DigivolutionCards.Count;
  49. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  50. permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= maxCost &&
  51. !permanent.IsOption;
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  56. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  61. {
  62. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectPermanentCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: null,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will return to the bottom of deck.", "The opponent is selecting 1 Digimon that will return to the bottom of deck.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. }
  79. }
  80. }
  81. #endregion
  82. #region When Digivolving
  83. if (timing == EffectTiming.OnEnterFieldAnyone)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("Return 1 of your opponent's Digimon or Tamers to the bottom of the deck.", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  88. cardEffects.Add(activateClass);
  89. string EffectDiscription()
  90. {
  91. return "[When Digivolving] Return 1 of your opponent's play cost 6 or lower Digimon or Tamers to the bottom of the deck. For each of your [Mother Eater]'s digivolution cards in the breeding area, add 1 to this effect's play cost maximum.";
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  96. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  97. }
  98. bool HasMother(Permanent permanent)
  99. {
  100. return CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card) &&
  101. permanent.TopCard.EqualsCardName("Mother Eater");
  102. }
  103. bool CanSelectPermanentCondition(Permanent permanent)
  104. {
  105. int maxCost = 6;
  106. if (CardEffectCommons.HasMatchConditionPermanent(HasMother, true))
  107. maxCost += card.Owner.GetBreedingAreaPermanents()[0].DigivolutionCards.Count;
  108. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  109. permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= maxCost &&
  110. !permanent.IsOption;
  111. }
  112. bool CanActivateCondition(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  115. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  118. {
  119. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  120. {
  121. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  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: maxCount,
  129. canNoSelect: false,
  130. canEndNotMax: false,
  131. selectPermanentCoroutine: null,
  132. afterSelectPermanentCoroutine: null,
  133. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  134. cardEffect: activateClass);
  135. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will return to the bottom of deck.", "The opponent is selecting 1 Digimon that will return to the bottom of deck.");
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. }
  138. }
  139. }
  140. #endregion
  141. #region All Turns
  142. if (timing == EffectTiming.WhenRemoveField)
  143. {
  144. ActivateClass activateClass = new ActivateClass();
  145. activateClass.SetUpICardEffect("Play 1 [Eater] digimon from hand", CanUseCondition, card);
  146. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  147. cardEffects.Add(activateClass);
  148. string EffectDiscription()
  149. {
  150. return "[All Turns] When this Digimon would leave the battle area other than by your effects, you may play 1 [Eater] trait Digimon card from your hand without paying the cost.";
  151. }
  152. bool CanSelectCardCondition(CardSource cardSource)
  153. {
  154. return cardSource.IsDigimon
  155. && cardSource.HasEaterTraits
  156. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  157. }
  158. bool CanUseCondition(Hashtable hashtable)
  159. {
  160. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  161. CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card) &&
  162. !CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card));
  163. }
  164. bool CanActivateCondition(Hashtable hashtable)
  165. {
  166. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  167. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  168. }
  169. IEnumerator ActivateCoroutine(Hashtable hashtable)
  170. {
  171. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  172. selectHandEffect.SetUp(
  173. selectPlayer: card.Owner,
  174. canTargetCondition: CanSelectCardCondition,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canEndSelectCondition: null,
  177. maxCount: 1,
  178. canNoSelect: true,
  179. canEndNotMax: false,
  180. isShowOpponent: true,
  181. selectCardCoroutine: null,
  182. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  183. mode: SelectHandEffect.Mode.Custom,
  184. cardEffect: activateClass);
  185. yield return StartCoroutine(selectHandEffect.Activate());
  186. IEnumerator AfterSelectCardCoroutine(List<CardSource> selectedCards)
  187. {
  188. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  189. cardSources: selectedCards,
  190. activateClass: activateClass,
  191. payCost: false,
  192. isTapped: false,
  193. root: SelectCardEffect.Root.Hand,
  194. activateETB: true));
  195. }
  196. }
  197. }
  198. #endregion
  199. #region End of Opponents Turn
  200. if (timing == EffectTiming.OnEndTurn)
  201. {
  202. ActivateClass activateClass = new ActivateClass();
  203. activateClass.SetUpICardEffect("Delete 1 Digimon with the lowest play cost", CanUseCondition, card);
  204. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  205. activateClass.SetHashString("Delete_BT23_075");
  206. cardEffects.Add(activateClass);
  207. string EffectDiscription()
  208. {
  209. return "[End of Opponent's Turn] [Once Per Turn] Delete 1 of your opponent's lowest play cost Digimon.";
  210. }
  211. bool CanSelectPermanentCondition(Permanent permanent)
  212. {
  213. return CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true);
  214. }
  215. bool CanUseCondition(Hashtable hashtable)
  216. {
  217. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  218. CardEffectCommons.IsOpponentTurn(card);
  219. }
  220. bool CanActivateCondition(Hashtable hashtable)
  221. {
  222. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  223. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  224. }
  225. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  226. {
  227. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  228. selectPermanentEffect.SetUp(
  229. selectPlayer: card.Owner,
  230. canTargetCondition: CanSelectPermanentCondition,
  231. canTargetCondition_ByPreSelecetedList: null,
  232. canEndSelectCondition: null,
  233. maxCount: 1,
  234. canNoSelect: false,
  235. canEndNotMax: false,
  236. selectPermanentCoroutine: null,
  237. afterSelectPermanentCoroutine: null,
  238. mode: SelectPermanentEffect.Mode.Destroy,
  239. cardEffect: activateClass);
  240. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  241. }
  242. }
  243. #endregion
  244. return cardEffects;
  245. }
  246. }
  247. }