EX3_007.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX3
  5. {
  6. public class EX3_007 : 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 Digimon card with [Rock Dragon], [Earth Dragon], [Bird Dragon], [Machine Dragon] or [Sky Dragon] in its traits and 1 [Hina Kurihara] 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.IsDigimon)
  24. {
  25. if (cardSource.CardTraits.Contains("Rock Dragon"))
  26. {
  27. return true;
  28. }
  29. if (cardSource.CardTraits.Contains("RockDragon"))
  30. {
  31. return true;
  32. }
  33. if (cardSource.CardTraits.Contains("Earth Dragon"))
  34. {
  35. return true;
  36. }
  37. if (cardSource.CardTraits.Contains("EarthDragon"))
  38. {
  39. return true;
  40. }
  41. if (cardSource.CardTraits.Contains("Bird Dragon"))
  42. {
  43. return true;
  44. }
  45. if (cardSource.CardTraits.Contains("BirdDragon"))
  46. {
  47. return true;
  48. }
  49. if (cardSource.CardTraits.Contains("Machine Dragon"))
  50. {
  51. return true;
  52. }
  53. if (cardSource.CardTraits.Contains("MachineDragon"))
  54. {
  55. return true;
  56. }
  57. if (cardSource.CardTraits.Contains("Sky Dragon"))
  58. {
  59. return true;
  60. }
  61. if (cardSource.CardTraits.Contains("SkyDragon"))
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. bool CanSelectCardCondition1(CardSource cardSource)
  69. {
  70. if (cardSource.CardNames.Contains("Hina Kurihara"))
  71. {
  72. return true;
  73. }
  74. if (cardSource.CardNames.Contains("HinaKurihara"))
  75. {
  76. return true;
  77. }
  78. return false;
  79. }
  80. bool CanUseCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  83. }
  84. bool CanActivateCondition(Hashtable hashtable)
  85. {
  86. if (CardEffectCommons.IsExistOnBattleArea(card))
  87. {
  88. if (card.Owner.LibraryCards.Count >= 1)
  89. {
  90. return true;
  91. }
  92. }
  93. return false;
  94. }
  95. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  96. {
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  98. revealCount: 4,
  99. simplifiedSelectCardConditions:
  100. new SimplifiedSelectCardConditionClass[]
  101. {
  102. new SimplifiedSelectCardConditionClass(
  103. canTargetCondition:CanSelectCardCondition,
  104. message: "Select 1 Digimon card with [Rock Dragon], [Earth Dragon], [Bird Dragon], [Machine Dragon] or [Sky Dragon] in its traits.",
  105. mode: SelectCardEffect.Mode.AddHand,
  106. maxCount: 1,
  107. selectCardCoroutine: null),
  108. new SimplifiedSelectCardConditionClass(
  109. canTargetCondition:CanSelectCardCondition1,
  110. message: "Select 1 [Hina Kurihara].",
  111. mode: SelectCardEffect.Mode.AddHand,
  112. maxCount: 1,
  113. selectCardCoroutine: null),
  114. },
  115. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  116. activateClass: activateClass,
  117. mutualConditions: true
  118. ));
  119. }
  120. }
  121. if (timing == EffectTiming.OnAllyAttack)
  122. {
  123. ActivateClass activateClass = new ActivateClass();
  124. activateClass.SetUpICardEffect("Delete 1 Digimon with 3000 DP or less", CanUseCondition, card);
  125. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  126. activateClass.SetIsInheritedEffect(true);
  127. cardEffects.Add(activateClass);
  128. string EffectDiscription()
  129. {
  130. return "[When Attacking] If this Digimon has an [On Play] effect, delete 1 of your opponent's Digimon with 3000 DP or less.";
  131. }
  132. bool CanSelectPermanentCondition(Permanent permanent)
  133. {
  134. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  135. {
  136. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  137. {
  138. return true;
  139. }
  140. }
  141. return false;
  142. }
  143. bool CanUseCondition(Hashtable hashtable)
  144. {
  145. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  146. }
  147. bool CanActivateCondition(Hashtable hashtable)
  148. {
  149. if (CardEffectCommons.IsExistOnBattleArea(card))
  150. {
  151. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  152. {
  153. if (card.PermanentOfThisCard().TopCard.HasOnPlayEffect)
  154. {
  155. return true;
  156. }
  157. }
  158. }
  159. return false;
  160. }
  161. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  162. {
  163. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  164. {
  165. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  166. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  167. selectPermanentEffect.SetUp(
  168. selectPlayer: card.Owner,
  169. canTargetCondition: CanSelectPermanentCondition,
  170. canTargetCondition_ByPreSelecetedList: null,
  171. canEndSelectCondition: null,
  172. maxCount: maxCount,
  173. canNoSelect: false,
  174. canEndNotMax: false,
  175. selectPermanentCoroutine: null,
  176. afterSelectPermanentCoroutine: null,
  177. mode: SelectPermanentEffect.Mode.Destroy,
  178. cardEffect: activateClass);
  179. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  180. }
  181. }
  182. }
  183. return cardEffects;
  184. }
  185. }
  186. }