BT15_027.cs 11 KB

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