BT15_077.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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_077 : 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. #region On End Your Turn
  70. if (timing == EffectTiming.OnEndTurn)
  71. {
  72. ActivateClass activateClass = new ActivateClass();
  73. activateClass.SetUpICardEffect("Delete your 1 Digimon to play 1 Digimon from hand", CanUseCondition, card);
  74. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  75. cardEffects.Add(activateClass);
  76. string EffectDiscription()
  77. {
  78. 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.";
  79. }
  80. bool CanSelectPermanentCondition(Permanent permanent)
  81. {
  82. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  83. }
  84. bool CanSelectCardCondition(CardSource cardSource)
  85. {
  86. if (card.Owner.GetBreedingAreaPermanents().Count == 0)
  87. {
  88. if (cardSource.CardTraits.Contains("Dark Masters") || cardSource.CardTraits.Contains("DarkMasters"))
  89. {
  90. if (cardSource.IsDigimon)
  91. {
  92. if (CardEffectCommons.CanPlayAsNewPermanent(
  93. cardSource: cardSource,
  94. payCost: false,
  95. cardEffect: activateClass,
  96. isBreedingArea: true))
  97. {
  98. return true;
  99. }
  100. }
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleArea(card))
  108. {
  109. if (CardEffectCommons.IsOwnerTurn(card))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  121. {
  122. return true;
  123. }
  124. }
  125. return false;
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  128. {
  129. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  130. {
  131. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  132. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectPermanentCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: maxCount,
  139. canNoSelect: true,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: SelectPermanentCoroutine,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.Custom,
  144. cardEffect: activateClass);
  145. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  146. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  147. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  148. {
  149. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  150. targetPermanents: new List<Permanent>() { permanent },
  151. activateClass: activateClass,
  152. successProcess: permanents => SuccessProcess(),
  153. failureProcess: null));
  154. IEnumerator SuccessProcess()
  155. {
  156. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  157. {
  158. List<CardSource> selectedCards = new List<CardSource>();
  159. int maxCount = 1;
  160. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  161. selectHandEffect.SetUp(
  162. selectPlayer: card.Owner,
  163. canTargetCondition: CanSelectCardCondition,
  164. canTargetCondition_ByPreSelecetedList: null,
  165. canEndSelectCondition: null,
  166. maxCount: maxCount,
  167. canNoSelect: true,
  168. canEndNotMax: false,
  169. isShowOpponent: true,
  170. selectCardCoroutine: SelectCardCoroutine,
  171. afterSelectCardCoroutine: null,
  172. mode: SelectHandEffect.Mode.Custom,
  173. cardEffect: activateClass);
  174. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  175. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  176. yield return StartCoroutine(selectHandEffect.Activate());
  177. IEnumerator SelectCardCoroutine(CardSource cardSource)
  178. {
  179. selectedCards.Add(cardSource);
  180. yield return null;
  181. }
  182. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  183. cardSources: selectedCards,
  184. activateClass: activateClass,
  185. payCost: false,
  186. isTapped: false,
  187. root: SelectCardEffect.Root.Hand,
  188. activateETB: true,
  189. isBreedingArea: true));
  190. }
  191. }
  192. }
  193. }
  194. }
  195. }
  196. #endregion
  197. //Inherited Effect
  198. if (timing == EffectTiming.OnDestroyedAnyone)
  199. {
  200. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  201. }
  202. return cardEffects;
  203. }
  204. }
  205. }