BT23_037.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. // Tentomon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_037 : 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.IsLevel2 && targetPermanent.TopCard.HasCSTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 0,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region Your Turn
  29. if (timing == EffectTiming.None)
  30. {
  31. bool Condition()
  32. {
  33. return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card);
  34. }
  35. bool PermanentCondition(Permanent targetPermanent)
  36. {
  37. return targetPermanent == card.PermanentOfThisCard();
  38. }
  39. bool CardSourceCondition(CardSource cardSource)
  40. {
  41. return cardSource.HasCSTraits;
  42. }
  43. bool RootCondition(SelectCardEffect.Root root)
  44. {
  45. return true;
  46. }
  47. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  48. changeValue: -1,
  49. permanentCondition: PermanentCondition,
  50. cardCondition: CardSourceCondition,
  51. rootCondition: RootCondition,
  52. isInheritedEffect: false,
  53. card: card,
  54. condition: Condition,
  55. setFixedCost: false));
  56. }
  57. #endregion
  58. #region ESS - When Attacking
  59. if (timing == EffectTiming.OnAllyAttack)
  60. {
  61. ActivateClass activateClass = new ActivateClass();
  62. activateClass.SetUpICardEffect("Play 1 5 cost or less [Hudie] digimon from hand", CanUseCondition, card);
  63. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  64. activateClass.SetIsInheritedEffect(true);
  65. activateClass.SetHashString("BT23_017_WA");
  66. cardEffects.Add(activateClass);
  67. string EffectDiscription()
  68. {
  69. 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.";
  70. }
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  74. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  75. }
  76. bool CanActivateCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.IsExistOnBattleArea(card);
  79. }
  80. bool CanSelectCardCondition(CardSource cardSource)
  81. {
  82. return cardSource.IsDigimon
  83. && cardSource.HasPlayCost && cardSource.BasePlayCostFromEntity <= 5
  84. && cardSource.EqualsTraits("Hudie")
  85. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  86. }
  87. IEnumerator ActivateCoroutine(Hashtable hashtable)
  88. {
  89. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  90. {
  91. CardSource selectedCard = null;
  92. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  93. selectHandEffect.SetUp(
  94. selectPlayer: card.Owner,
  95. canTargetCondition: CanSelectCardCondition,
  96. canTargetCondition_ByPreSelecetedList: null,
  97. canEndSelectCondition: null,
  98. maxCount: 1,
  99. canNoSelect: true,
  100. canEndNotMax: false,
  101. isShowOpponent: true,
  102. selectCardCoroutine: SelectCardCoroutine,
  103. afterSelectCardCoroutine: null,
  104. mode: SelectHandEffect.Mode.Custom,
  105. cardEffect: activateClass);
  106. IEnumerator SelectCardCoroutine(CardSource cardSource)
  107. {
  108. selectedCard = cardSource;
  109. yield return null;
  110. }
  111. selectHandEffect.SetUpCustomMessage("Select 1 [Hudie] digimon to play", "Your opponent is selecting 1 card to play");
  112. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  113. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  114. if (selectedCard != null)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  117. new List<CardSource>() { selectedCard },
  118. activateClass: activateClass,
  119. payCost: false,
  120. isTapped: false,
  121. root: SelectCardEffect.Root.Hand,
  122. activateETB: true));
  123. yield return new WaitForSeconds(0.2f);
  124. Permanent playedDigimon = selectedCard.PermanentOfThisCard();
  125. #region Can't Digivolve/Delete EoOT
  126. if (playedDigimon != null)
  127. {
  128. #region Can't Digivolve
  129. CanNotDigivolveClass canNotEvolveClass = new CanNotDigivolveClass();
  130. canNotEvolveClass.SetUpICardEffect("Can't digivolve", CanUseCantEvoCondition, card);
  131. canNotEvolveClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
  132. playedDigimon.PermanentEffects.Add((_timing) => canNotEvolveClass);
  133. bool CanUseCantEvoCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon);
  136. }
  137. bool PermanentCondition(Permanent permanent)
  138. {
  139. return permanent == playedDigimon;
  140. }
  141. bool CardCondition(CardSource cardSource)
  142. {
  143. return true;
  144. }
  145. #endregion
  146. #region Delete Digimon Played
  147. yield return ContinuousController.instance.StartCoroutine(
  148. CardEffectCommons.AddSelfDeleteEffect(playedDigimon, CardEffectCommons.DeleteTiming.AtOpponentTurnEnd, activateClass));
  149. #endregion
  150. }
  151. #endregion
  152. }
  153. }
  154. }
  155. }
  156. #endregion
  157. return cardEffects;
  158. }
  159. }
  160. }