EX3_007.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. ));
  118. }
  119. }
  120. if (timing == EffectTiming.OnAllyAttack)
  121. {
  122. ActivateClass activateClass = new ActivateClass();
  123. activateClass.SetUpICardEffect("Delete 1 Digimon with 3000 DP or less", CanUseCondition, card);
  124. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  125. activateClass.SetIsInheritedEffect(true);
  126. cardEffects.Add(activateClass);
  127. string EffectDiscription()
  128. {
  129. return "[When Attacking] If this Digimon has an [On Play] effect, delete 1 of your opponent's Digimon with 3000 DP or less.";
  130. }
  131. bool CanSelectPermanentCondition(Permanent permanent)
  132. {
  133. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  134. {
  135. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  136. {
  137. return true;
  138. }
  139. }
  140. return false;
  141. }
  142. bool CanUseCondition(Hashtable hashtable)
  143. {
  144. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  145. }
  146. bool CanActivateCondition(Hashtable hashtable)
  147. {
  148. if (CardEffectCommons.IsExistOnBattleArea(card))
  149. {
  150. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  151. {
  152. if (card.PermanentOfThisCard().TopCard.HasOnPlayEffect)
  153. {
  154. return true;
  155. }
  156. }
  157. }
  158. return false;
  159. }
  160. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  161. {
  162. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  163. {
  164. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  165. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  166. selectPermanentEffect.SetUp(
  167. selectPlayer: card.Owner,
  168. canTargetCondition: CanSelectPermanentCondition,
  169. canTargetCondition_ByPreSelecetedList: null,
  170. canEndSelectCondition: null,
  171. maxCount: maxCount,
  172. canNoSelect: false,
  173. canEndNotMax: false,
  174. selectPermanentCoroutine: null,
  175. afterSelectPermanentCoroutine: null,
  176. mode: SelectPermanentEffect.Mode.Destroy,
  177. cardEffect: activateClass);
  178. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  179. }
  180. }
  181. }
  182. return cardEffects;
  183. }
  184. }
  185. }