BT15_062.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_062 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] Reveal the top 4 cards of your deck. Add 2 level 6 or higher Digimon cards among them to the hand. Place the rest at the bottom of the deck.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.HasLevel)
  25. {
  26. if (cardSource.Level >= 6)
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (card.Owner.LibraryCards.Count >= 1)
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  51. revealCount: 4,
  52. simplifiedSelectCardConditions:
  53. new SimplifiedSelectCardConditionClass[]
  54. {
  55. new SimplifiedSelectCardConditionClass(
  56. canTargetCondition:CanSelectCardCondition,
  57. message: "Select 2 level 6 or more cards.",
  58. mode: SelectCardEffect.Mode.AddHand,
  59. maxCount: 2,
  60. selectCardCoroutine: null),
  61. },
  62. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  63. activateClass: activateClass
  64. ));
  65. }
  66. }
  67. if (timing == EffectTiming.OnEndTurn)
  68. {
  69. ActivateClass activateClass = new ActivateClass();
  70. activateClass.SetUpICardEffect("Delete your 1 Digimon to play 1 Digimon from hand", CanUseCondition, card);
  71. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  72. cardEffects.Add(activateClass);
  73. string EffectDiscription()
  74. {
  75. return "[End of Your Turn] By deleting 1 of your Digimon, you may play 1 Digimon card with the [Dark Masters] trait from you hand to and empty space in your breeding area without paying the cost.";
  76. }
  77. bool CanSelectPermanentCondition(Permanent permanent)
  78. {
  79. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  80. }
  81. bool CanSelectCardCondition(CardSource cardSource)
  82. {
  83. if (card.Owner.GetBreedingAreaPermanents().Count == 0)
  84. {
  85. if (cardSource.CardTraits.Contains("Dark Masters"))
  86. {
  87. if (cardSource.IsDigimon)
  88. {
  89. if (CardEffectCommons.CanPlayAsNewPermanent(
  90. cardSource: cardSource,
  91. payCost: false,
  92. cardEffect: activateClass,
  93. isBreedingArea: true))
  94. {
  95. return true;
  96. }
  97. }
  98. }
  99. }
  100. return false;
  101. }
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. if (CardEffectCommons.IsExistOnBattleArea(card))
  105. {
  106. if (CardEffectCommons.IsOwnerTurn(card))
  107. {
  108. return true;
  109. }
  110. }
  111. return false;
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.IsExistOnBattleArea(card))
  116. {
  117. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  118. {
  119. return true;
  120. }
  121. }
  122. return false;
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  125. {
  126. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  127. {
  128. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  129. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  130. selectPermanentEffect.SetUp(
  131. selectPlayer: card.Owner,
  132. canTargetCondition: CanSelectPermanentCondition,
  133. canTargetCondition_ByPreSelecetedList: null,
  134. canEndSelectCondition: null,
  135. maxCount: maxCount,
  136. canNoSelect: true,
  137. canEndNotMax: false,
  138. selectPermanentCoroutine: SelectPermanentCoroutine,
  139. afterSelectPermanentCoroutine: null,
  140. mode: SelectPermanentEffect.Mode.Custom,
  141. cardEffect: activateClass);
  142. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  143. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  144. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  145. {
  146. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  147. targetPermanents: new List<Permanent>() { permanent },
  148. activateClass: activateClass,
  149. successProcess: permanents => SuccessProcess(),
  150. failureProcess: null));
  151. IEnumerator SuccessProcess()
  152. {
  153. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  154. {
  155. List<CardSource> selectedCards = new List<CardSource>();
  156. int maxCount = 1;
  157. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  158. selectHandEffect.SetUp(
  159. selectPlayer: card.Owner,
  160. canTargetCondition: CanSelectCardCondition,
  161. canTargetCondition_ByPreSelecetedList: null,
  162. canEndSelectCondition: null,
  163. maxCount: maxCount,
  164. canNoSelect: true,
  165. canEndNotMax: false,
  166. isShowOpponent: true,
  167. selectCardCoroutine: SelectCardCoroutine,
  168. afterSelectCardCoroutine: null,
  169. mode: SelectHandEffect.Mode.Custom,
  170. cardEffect: activateClass);
  171. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  172. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  173. yield return StartCoroutine(selectHandEffect.Activate());
  174. IEnumerator SelectCardCoroutine(CardSource cardSource)
  175. {
  176. selectedCards.Add(cardSource);
  177. yield return null;
  178. }
  179. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  180. cardSources: selectedCards,
  181. activateClass: activateClass,
  182. payCost: false,
  183. isTapped: false,
  184. root: SelectCardEffect.Root.Hand,
  185. activateETB: true,
  186. isBreedingArea: true));
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. if (timing == EffectTiming.None)
  194. {
  195. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  196. }
  197. return cardEffects;
  198. }
  199. }
  200. }