BT11_068.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_068 : 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.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal the top 5 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Reveal the top 5 cards of your deck. You may play 1 Tamer card with a play cost of 4 or less among them without paying the cost. Place the rest at the top or bottom of your deck in any order.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.IsTamer)
  24. {
  25. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  26. {
  27. if (cardSource.GetCostItself <= 4)
  28. {
  29. if (cardSource.HasPlayCost)
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (card.Owner.LibraryCards.Count >= 1)
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. List<CardSource> selectedCards = new List<CardSource>();
  56. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  57. revealCount: 5,
  58. simplifiedSelectCardConditions:
  59. new SimplifiedSelectCardConditionClass[]
  60. {
  61. new SimplifiedSelectCardConditionClass(
  62. canTargetCondition:CanSelectCardCondition,
  63. message: "Select 1 Tamer card with a play cost of 4 or less.",
  64. mode: SelectCardEffect.Mode.Custom,
  65. maxCount: 1,
  66. selectCardCoroutine: SelectCardCoroutine),
  67. },
  68. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  69. activateClass: activateClass,
  70. canNoSelect: true
  71. ));
  72. IEnumerator SelectCardCoroutine(CardSource cardSource)
  73. {
  74. selectedCards.Add(cardSource);
  75. yield return null;
  76. }
  77. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  78. cardSources: selectedCards,
  79. activateClass: activateClass,
  80. payCost: false,
  81. isTapped: false,
  82. root: SelectCardEffect.Root.Library,
  83. activateETB: true));
  84. }
  85. }
  86. if (timing == EffectTiming.OnEnterFieldAnyone)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect("Reveal the top 5 cards of deck", CanUseCondition, card);
  90. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  91. cardEffects.Add(activateClass);
  92. string EffectDiscription()
  93. {
  94. return "[When Digivolving] Reveal the top 5 cards of your deck. You may play 1 Tamer card with a play cost of 4 or less among them without paying the cost. Place the rest at the top or bottom of your deck in any order.";
  95. }
  96. bool CanSelectCardCondition(CardSource cardSource)
  97. {
  98. if (cardSource.IsTamer)
  99. {
  100. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  101. {
  102. if (cardSource.GetCostItself <= 4)
  103. {
  104. if (cardSource.HasPlayCost)
  105. {
  106. return true;
  107. }
  108. }
  109. }
  110. }
  111. return false;
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  116. }
  117. bool CanActivateCondition(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.IsExistOnBattleArea(card))
  120. {
  121. if (card.Owner.LibraryCards.Count >= 1)
  122. {
  123. return true;
  124. }
  125. }
  126. return false;
  127. }
  128. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  129. {
  130. List<CardSource> selectedCards = new List<CardSource>();
  131. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  132. revealCount: 5,
  133. simplifiedSelectCardConditions:
  134. new SimplifiedSelectCardConditionClass[]
  135. {
  136. new SimplifiedSelectCardConditionClass(
  137. canTargetCondition:CanSelectCardCondition,
  138. message: "Select 1 Tamer card with a play cost of 4 or less.",
  139. mode: SelectCardEffect.Mode.Custom,
  140. maxCount: 1,
  141. selectCardCoroutine: SelectCardCoroutine),
  142. },
  143. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  144. activateClass: activateClass,
  145. canNoSelect: true
  146. ));
  147. IEnumerator SelectCardCoroutine(CardSource cardSource)
  148. {
  149. selectedCards.Add(cardSource);
  150. yield return null;
  151. }
  152. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  153. cardSources: selectedCards,
  154. activateClass: activateClass,
  155. payCost: false,
  156. isTapped: false,
  157. root: SelectCardEffect.Root.Library,
  158. activateETB: true));
  159. }
  160. }
  161. if (timing == EffectTiming.OnEnterFieldAnyone)
  162. {
  163. ActivateClass activateClass = new ActivateClass();
  164. activateClass.SetUpICardEffect("Your 1 Digimon gains Blocker", CanUseCondition, card);
  165. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  166. activateClass.SetIsInheritedEffect(true);
  167. activateClass.SetHashString("Blocker_BT11_068");
  168. cardEffects.Add(activateClass);
  169. string EffectDiscription()
  170. {
  171. return "[Your Turn][Once Per Turn] When you play another Digimon by an effect, 1 of your Digimon gains <Blocker> until the end of your opponent's turn.";
  172. }
  173. bool PermanentCondition(Permanent permanent)
  174. {
  175. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  176. {
  177. if (permanent != card.PermanentOfThisCard())
  178. {
  179. return true;
  180. }
  181. }
  182. return false;
  183. }
  184. bool CanSelectPermanentCondition(Permanent permanent)
  185. {
  186. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  187. }
  188. bool CanUseCondition(Hashtable hashtable)
  189. {
  190. if (CardEffectCommons.IsExistOnBattleArea(card))
  191. {
  192. if (CardEffectCommons.IsOwnerTurn(card))
  193. {
  194. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  195. {
  196. if (CardEffectCommons.IsByEffect(hashtable, null))
  197. {
  198. return true;
  199. }
  200. }
  201. }
  202. }
  203. return false;
  204. }
  205. bool CanActivateCondition(Hashtable hashtable)
  206. {
  207. if (CardEffectCommons.IsExistOnBattleArea(card))
  208. {
  209. return true;
  210. }
  211. return false;
  212. }
  213. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  214. {
  215. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  216. {
  217. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  218. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  219. selectPermanentEffect.SetUp(
  220. selectPlayer: card.Owner,
  221. canTargetCondition: CanSelectPermanentCondition,
  222. canTargetCondition_ByPreSelecetedList: null,
  223. canEndSelectCondition: null,
  224. maxCount: maxCount,
  225. canNoSelect: false,
  226. canEndNotMax: false,
  227. selectPermanentCoroutine: SelectPermanentCoroutine,
  228. afterSelectPermanentCoroutine: null,
  229. mode: SelectPermanentEffect.Mode.Custom,
  230. cardEffect: activateClass);
  231. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain Blocker.", "The opponent is selecting 1 Digimon that will gain Blocker.");
  232. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  233. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  234. {
  235. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  236. }
  237. }
  238. }
  239. }
  240. return cardEffects;
  241. }
  242. }
  243. }