BT23_048.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. // Gotsumon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_048 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasCSTraits
  18. && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel2;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 0,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region On Play
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Hudie] trait and 1 Tamer card or Option card with the [CS] trait among them to the hand. Return the rest to the bottom of the deck..";
  39. }
  40. bool CanSelectCardCondition(CardSource cardSource)
  41. {
  42. return cardSource.EqualsTraits("Hudie");
  43. }
  44. bool CanSelectCardCondition1(CardSource cardSource)
  45. {
  46. return cardSource.HasCSTraits
  47. && (cardSource.IsTamer || cardSource.IsOption);
  48. }
  49. bool CanUseCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.IsExistOnBattleArea(card)
  52. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.IsExistOnBattleArea(card)
  57. && card.Owner.LibraryCards.Count >= 1;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  62. revealCount: 3,
  63. simplifiedSelectCardConditions:
  64. new SimplifiedSelectCardConditionClass[]
  65. {
  66. new SimplifiedSelectCardConditionClass(
  67. canTargetCondition:CanSelectCardCondition,
  68. message: "Select 1 card with [Hudie] trait.",
  69. mode: SelectCardEffect.Mode.AddHand,
  70. maxCount: 1,
  71. selectCardCoroutine: null),
  72. new SimplifiedSelectCardConditionClass(
  73. canTargetCondition:CanSelectCardCondition1,
  74. message: "Select 1 Tamer or option with the [CS] trait.",
  75. mode: SelectCardEffect.Mode.AddHand,
  76. maxCount: 1,
  77. selectCardCoroutine: null),
  78. },
  79. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  80. activateClass: activateClass
  81. ));
  82. }
  83. }
  84. #endregion
  85. #region ESS - When Attacking
  86. if (timing == EffectTiming.OnAllyAttack)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect("Play 1 5 cost or less [Hudie] digimon from hand", CanUseCondition, card);
  90. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  91. activateClass.SetIsInheritedEffect(true);
  92. activateClass.SetHashString("BT23_017_WA");
  93. cardEffects.Add(activateClass);
  94. string EffectDiscription()
  95. {
  96. return "[When Attacking] [Once Per Turn] You may play 1 play cost 5 or lower Digimon card with the [Hudie] trait from your hand without paying the cost. The Digimon this effect played can't digivolve and is deleted at the end of your opponent's turn.";
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  101. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  102. }
  103. bool CanActivateCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  106. }
  107. bool CanSelectCardCondition(CardSource cardSource)
  108. {
  109. return cardSource.IsDigimon
  110. && cardSource.HasPlayCost && cardSource.BasePlayCostFromEntity <= 5
  111. && cardSource.HasHudieTraits
  112. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable hashtable)
  115. {
  116. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  117. {
  118. CardSource selectedCard = null;
  119. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  120. selectHandEffect.SetUp(
  121. selectPlayer: card.Owner,
  122. canTargetCondition: CanSelectCardCondition,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. maxCount: 1,
  126. canNoSelect: true,
  127. canEndNotMax: false,
  128. isShowOpponent: true,
  129. selectCardCoroutine: SelectCardCoroutine,
  130. afterSelectCardCoroutine: null,
  131. mode: SelectHandEffect.Mode.Custom,
  132. cardEffect: activateClass);
  133. IEnumerator SelectCardCoroutine(CardSource cardSource)
  134. {
  135. selectedCard = cardSource;
  136. yield return null;
  137. }
  138. selectHandEffect.SetUpCustomMessage("Select 1 [Hudie] digimon to play", "Your opponent is selecting 1 card to play");
  139. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  140. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  141. if (selectedCard != null)
  142. {
  143. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  144. new List<CardSource>() { selectedCard },
  145. activateClass: activateClass,
  146. payCost: false,
  147. isTapped: false,
  148. root: SelectCardEffect.Root.Hand,
  149. activateETB: true));
  150. yield return new WaitForSeconds(0.2f);
  151. Permanent playedDigimon = selectedCard.PermanentOfThisCard();
  152. #region Can't Digivolve/Delete EoOT
  153. if (playedDigimon != null)
  154. {
  155. #region Can't Digivolve
  156. CanNotDigivolveClass canNotEvolveClass = new CanNotDigivolveClass();
  157. canNotEvolveClass.SetUpICardEffect("Can't digivolve", CanUseCantEvoCondition, card);
  158. canNotEvolveClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
  159. playedDigimon.PermanentEffects.Add((_timing) => canNotEvolveClass);
  160. bool CanUseCantEvoCondition(Hashtable hashtable)
  161. {
  162. return CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon);
  163. }
  164. bool PermanentCondition(Permanent permanent)
  165. {
  166. return permanent == playedDigimon;
  167. }
  168. bool CardCondition(CardSource cardSource)
  169. {
  170. return true;
  171. }
  172. #endregion
  173. #region Delete Digimon Played
  174. yield return ContinuousController.instance.StartCoroutine(
  175. CardEffectCommons.AddSelfDeleteEffect(playedDigimon, CardEffectCommons.DeleteTiming.AtOpponentTurnEnd, activateClass));
  176. #endregion
  177. }
  178. #endregion
  179. }
  180. }
  181. }
  182. }
  183. #endregion
  184. return cardEffects;
  185. }
  186. }
  187. }