EX3_030.cs 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. mutualConditions: true
  82. ));
  83. }
  84. }
  85. if (timing == EffectTiming.OnEnterFieldAnyone)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("The played Digimon gains Rush", CanUseCondition, card);
  89. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  90. activateClass.SetIsInheritedEffect(true);
  91. activateClass.SetHashString("GainRush_EX3_030");
  92. cardEffects.Add(activateClass);
  93. string EffectDiscription()
  94. {
  95. 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.)";
  96. }
  97. bool PermanentCondition(Permanent permanent)
  98. {
  99. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  100. {
  101. if (permanent.TopCard.CardTraits.Contains("Four Great Dragons"))
  102. {
  103. return true;
  104. }
  105. if (permanent.TopCard.CardTraits.Contains("FourGreatDragons"))
  106. {
  107. return true;
  108. }
  109. }
  110. return false;
  111. }
  112. bool CanUseCondition(Hashtable hashtable)
  113. {
  114. if (CardEffectCommons.IsExistOnBattleArea(card))
  115. {
  116. if (CardEffectCommons.IsOwnerTurn(card))
  117. {
  118. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  119. {
  120. return true;
  121. }
  122. }
  123. }
  124. return false;
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.IsExistOnBattleArea(card))
  129. {
  130. return true;
  131. }
  132. return false;
  133. }
  134. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  135. {
  136. List<Permanent> permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
  137. hashtable: _hashtable,
  138. rootCondition: null);
  139. if (permanents != null)
  140. {
  141. bool CanSelectPermanentCondition(Permanent permanent)
  142. {
  143. if (PermanentCondition(permanent))
  144. {
  145. if (permanents.Contains(permanent))
  146. {
  147. return true;
  148. }
  149. }
  150. return false;
  151. }
  152. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  153. {
  154. Permanent selectedPermanent = null;
  155. if (card.Owner.GetBattleAreaDigimons().Count(CanSelectPermanentCondition) == 1)
  156. {
  157. selectedPermanent = card.Owner.GetBattleAreaDigimons().Find(CanSelectPermanentCondition);
  158. }
  159. else
  160. {
  161. int maxCount = 1;
  162. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  163. selectPermanentEffect.SetUp(
  164. selectPlayer: card.Owner,
  165. canTargetCondition: CanSelectPermanentCondition,
  166. canTargetCondition_ByPreSelecetedList: null,
  167. canEndSelectCondition: null,
  168. maxCount: maxCount,
  169. canNoSelect: false,
  170. canEndNotMax: false,
  171. selectPermanentCoroutine: SelectPermanentCoroutine,
  172. afterSelectPermanentCoroutine: null,
  173. mode: SelectPermanentEffect.Mode.Custom,
  174. cardEffect: activateClass);
  175. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Rush.", "The opponent is selecting 1 Digimon that will get Rush.");
  176. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  177. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  178. {
  179. selectedPermanent = permanent;
  180. yield return null;
  181. }
  182. }
  183. if (selectedPermanent != null)
  184. {
  185. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  186. targetPermanent: selectedPermanent,
  187. effectDuration: EffectDuration.UntilEachTurnEnd,
  188. activateClass: activateClass));
  189. }
  190. }
  191. }
  192. }
  193. }
  194. return cardEffects;
  195. }
  196. }
  197. }