ST13_14.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ST13_14 : CEntity_Effect
  5. {
  6. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  7. {
  8. List<ICardEffect> cardEffects = new List<ICardEffect>();
  9. if (timing == EffectTiming.OnAddDigivolutionCards)
  10. {
  11. ActivateClass activateClass = new ActivateClass();
  12. activateClass.SetUpICardEffect("Can't be deleted and can't return to hand or deck by opponent's effect", CanUseCondition, card);
  13. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  14. activateClass.SetHashString("GainEffect_ST13_14");
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[Your Turn][Once Per Turn] When one of your effects places a digivolution card under this Digimon, your opponent's effects can't delete this Digimon or return it to its owner's hand or deck until the end of their turn.";
  19. }
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. if (CardEffectCommons.IsExistOnBattleArea(card))
  23. {
  24. if (CardEffectCommons.IsOwnerTurn(card))
  25. {
  26. if (CardEffectCommons.CanTriggerOnAddDigivolutionCard(
  27. hashtable: hashtable,
  28. permanentCondition: permanent => permanent == card.PermanentOfThisCard(),
  29. cardEffectCondition: cardEffect => cardEffect.EffectSourceCard != null && cardEffect.EffectSourceCard.Owner == card.Owner,
  30. cardCondition: null))
  31. {
  32. return true;
  33. }
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleArea(card);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. bool CardEffectCondition(ICardEffect cardEffect)
  45. {
  46. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  47. }
  48. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeDeletedByEffect(
  49. targetPermanent: card.PermanentOfThisCard(),
  50. cardEffectCondition: CardEffectCondition,
  51. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  52. activateClass: activateClass,
  53. effectName: "Can't be deleted by opponent's effects"));
  54. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToHand(
  55. targetPermanent: card.PermanentOfThisCard(),
  56. cardEffectCondition: CardEffectCondition,
  57. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  58. activateClass: activateClass,
  59. effectName: "Can't return to hand by opponent's effects"));
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToDeck(
  61. targetPermanent: card.PermanentOfThisCard(),
  62. cardEffectCondition: CardEffectCondition,
  63. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  64. activateClass: activateClass,
  65. effectName: "Can't return to deck by opponent's effects"));
  66. }
  67. }
  68. if (timing == EffectTiming.OnEnterFieldAnyone)
  69. {
  70. ActivateClass activateClass = new ActivateClass();
  71. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  72. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  73. cardEffects.Add(activateClass);
  74. string EffectDiscription()
  75. {
  76. return "[When Digivolving] Reveal the top 3 cards of your deck. You may play 1 Digimon card with [Legend-Arms] in its traits and a play cost of 7 or less among them without paying its memory cost. Place the rest at the bottom of your deck in any order.";
  77. }
  78. bool CanSelectCardCondition(CardSource cardSource)
  79. {
  80. if (cardSource.IsDigimon)
  81. {
  82. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  83. {
  84. if (cardSource.GetCostItself <= 7 && cardSource.HasPlayCost)
  85. {
  86. if (cardSource.CardTraits.Contains("Legend-Arms"))
  87. {
  88. return true;
  89. }
  90. }
  91. }
  92. }
  93. return false;
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  98. }
  99. bool CanActivateCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (card.Owner.LibraryCards.Count >= 1)
  104. {
  105. return true;
  106. }
  107. }
  108. return false;
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  111. {
  112. List<CardSource> selectedCards = new List<CardSource>();
  113. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  114. revealCount: 3,
  115. simplifiedSelectCardConditions:
  116. new SimplifiedSelectCardConditionClass[]
  117. {
  118. new SimplifiedSelectCardConditionClass(
  119. canTargetCondition:CanSelectCardCondition,
  120. message: "Select 1 Digimon card with [Legend-Arms] in its traits and a play cost of 7 or less.",
  121. mode: SelectCardEffect.Mode.Custom,
  122. maxCount: 1,
  123. selectCardCoroutine: SelectCardCoroutine),
  124. },
  125. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  126. activateClass: activateClass,
  127. canNoSelect: true
  128. ));
  129. IEnumerator SelectCardCoroutine(CardSource cardSource)
  130. {
  131. selectedCards.Add(cardSource);
  132. yield return null;
  133. }
  134. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  135. cardSources: selectedCards,
  136. activateClass: activateClass,
  137. payCost: false,
  138. isTapped: false,
  139. root: SelectCardEffect.Root.Library,
  140. activateETB: true));
  141. }
  142. }
  143. if (timing == EffectTiming.None)
  144. {
  145. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  146. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effect", CanUseCondition, card);
  147. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  148. canNotAffectedClass.SetIsInheritedEffect(true);
  149. cardEffects.Add(canNotAffectedClass);
  150. bool CanUseCondition(Hashtable hashtable)
  151. {
  152. if (CardEffectCommons.IsExistOnBattleArea(card))
  153. {
  154. if (CardEffectCommons.IsOpponentTurn(card))
  155. {
  156. return true;
  157. }
  158. }
  159. return false;
  160. }
  161. bool CardCondition(CardSource cardSource)
  162. {
  163. if (CardEffectCommons.IsExistOnBattleArea(card))
  164. {
  165. if (cardSource == card.PermanentOfThisCard().TopCard)
  166. {
  167. if (card.PermanentOfThisCard().TopCard.CardNames.Contains("RagnaLoardmon"))
  168. {
  169. return true;
  170. }
  171. }
  172. }
  173. return false;
  174. }
  175. bool SkillCondition(ICardEffect cardEffect)
  176. {
  177. if (cardEffect != null)
  178. {
  179. if (cardEffect.EffectSourceCard != null)
  180. {
  181. if (cardEffect.EffectSourceCard.Owner == card.Owner.Enemy)
  182. {
  183. if (cardEffect.IsDigimonEffect)
  184. {
  185. return true;
  186. }
  187. }
  188. }
  189. }
  190. return false;
  191. }
  192. }
  193. return cardEffects;
  194. }
  195. }