EX3_030.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX3
  5. {
  6. public class EX3_030 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Reveal the top 4 cards of your deck. Add 1 yellow card with [Angel], [Cherub], [Throne], [Authority], [Seraph] or [Virtue], other than [Three Great Angels], in one of its traits and 1 card with the [Four Great Dragons] trait among them to your hand. Place the rest at the bottom of your deck in any order.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.CardColors.Contains(CardColor.Yellow))
  24. {
  25. if (cardSource.HasAngelTraits)
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanSelectCardCondition1(CardSource cardSource)
  33. {
  34. if (cardSource.CardTraits.Contains("Four Great Dragons"))
  35. {
  36. return true;
  37. }
  38. if (cardSource.CardTraits.Contains("FourGreatDragons"))
  39. {
  40. return true;
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (card.Owner.LibraryCards.Count >= 1)
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  62. revealCount: 4,
  63. simplifiedSelectCardConditions:
  64. new SimplifiedSelectCardConditionClass[]
  65. {
  66. new SimplifiedSelectCardConditionClass(
  67. canTargetCondition:CanSelectCardCondition,
  68. message: "Select 1 yellow card with [Angel], [Cherub], [Throne], [Authority], [Seraph] or [Virtue], other than [Three Great Angels], in one of its traits.",
  69. mode: SelectCardEffect.Mode.AddHand,
  70. maxCount: 1,
  71. selectCardCoroutine: null),
  72. new SimplifiedSelectCardConditionClass(
  73. canTargetCondition:CanSelectCardCondition1,
  74. message: "Select 1 card with the [Four Great Dragons] trait.",
  75. mode: SelectCardEffect.Mode.AddHand,
  76. maxCount: 1,
  77. selectCardCoroutine: null),
  78. },
  79. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  80. activateClass: activateClass
  81. ));
  82. }
  83. }
  84. if (timing == EffectTiming.OnEnterFieldAnyone)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("The played Digimon gains Rush", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  89. activateClass.SetIsInheritedEffect(true);
  90. activateClass.SetHashString("GainRush_EX3_030");
  91. cardEffects.Add(activateClass);
  92. string EffectDiscription()
  93. {
  94. return "[Your Turn] [Once Per Turn] When you play a Digimon with the [Four Great Dragons] trait, 1 of those Digimon gains <Rush> for the turn. (This Digimon may attack the turn it was played.)";
  95. }
  96. bool PermanentCondition(Permanent permanent)
  97. {
  98. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  99. {
  100. if (permanent.TopCard.CardTraits.Contains("Four Great Dragons"))
  101. {
  102. return true;
  103. }
  104. if (permanent.TopCard.CardTraits.Contains("FourGreatDragons"))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. if (CardEffectCommons.IsExistOnBattleArea(card))
  114. {
  115. if (CardEffectCommons.IsOwnerTurn(card))
  116. {
  117. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  118. {
  119. return true;
  120. }
  121. }
  122. }
  123. return false;
  124. }
  125. bool CanActivateCondition(Hashtable hashtable)
  126. {
  127. if (CardEffectCommons.IsExistOnBattleArea(card))
  128. {
  129. return true;
  130. }
  131. return false;
  132. }
  133. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  134. {
  135. List<Permanent> permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
  136. hashtable: _hashtable,
  137. rootCondition: null);
  138. if (permanents != null)
  139. {
  140. bool CanSelectPermanentCondition(Permanent permanent)
  141. {
  142. if (PermanentCondition(permanent))
  143. {
  144. if (permanents.Contains(permanent))
  145. {
  146. return true;
  147. }
  148. }
  149. return false;
  150. }
  151. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  152. {
  153. Permanent selectedPermanent = null;
  154. if (card.Owner.GetBattleAreaDigimons().Count(CanSelectPermanentCondition) == 1)
  155. {
  156. selectedPermanent = card.Owner.GetBattleAreaDigimons().Find(CanSelectPermanentCondition);
  157. }
  158. else
  159. {
  160. int maxCount = 1;
  161. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  162. selectPermanentEffect.SetUp(
  163. selectPlayer: card.Owner,
  164. canTargetCondition: CanSelectPermanentCondition,
  165. canTargetCondition_ByPreSelecetedList: null,
  166. canEndSelectCondition: null,
  167. maxCount: maxCount,
  168. canNoSelect: false,
  169. canEndNotMax: false,
  170. selectPermanentCoroutine: SelectPermanentCoroutine,
  171. afterSelectPermanentCoroutine: null,
  172. mode: SelectPermanentEffect.Mode.Custom,
  173. cardEffect: activateClass);
  174. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Rush.", "The opponent is selecting 1 Digimon that will get Rush.");
  175. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  176. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  177. {
  178. selectedPermanent = permanent;
  179. yield return null;
  180. }
  181. }
  182. if (selectedPermanent != null)
  183. {
  184. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  185. targetPermanent: selectedPermanent,
  186. effectDuration: EffectDuration.UntilEachTurnEnd,
  187. activateClass: activateClass));
  188. }
  189. }
  190. }
  191. }
  192. }
  193. return cardEffects;
  194. }
  195. }
  196. }