EX4_041.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_041 : 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("Trash 1 card from hand to Draw 2", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] By trashing 1 card with the [Blue Flare] or [Twilight] trait in your hand, <Draw 2>. (Draw 2 cards from your deck.)";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource != null)
  24. {
  25. if (cardSource.Owner == card.Owner)
  26. {
  27. if (cardSource.CardTraits.Contains("Blue Flare"))
  28. {
  29. return true;
  30. }
  31. if (cardSource.CardTraits.Contains("BlueFlare"))
  32. {
  33. return true;
  34. }
  35. if (cardSource.CardTraits.Contains("Twilight"))
  36. {
  37. return true;
  38. }
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (card.Owner.HandCards.Count >= 1)
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. if (isExistOnField(card))
  61. {
  62. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  63. {
  64. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  65. {
  66. bool discarded = false;
  67. int discardCount = 1;
  68. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  69. selectHandEffect.SetUp(
  70. selectPlayer: card.Owner,
  71. canTargetCondition: CanSelectCardCondition,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. maxCount: discardCount,
  75. canNoSelect: true,
  76. canEndNotMax: false,
  77. isShowOpponent: true,
  78. selectCardCoroutine: null,
  79. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  80. mode: SelectHandEffect.Mode.Discard,
  81. cardEffect: activateClass);
  82. yield return StartCoroutine(selectHandEffect.Activate());
  83. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  84. {
  85. if (cardSources.Count >= 1)
  86. {
  87. discarded = true;
  88. yield return null;
  89. }
  90. }
  91. if (discarded)
  92. {
  93. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. if (timing == EffectTiming.OnDestroyedAnyone)
  101. {
  102. ActivateClass activateClass = new ActivateClass();
  103. activateClass.SetUpICardEffect("Reveal the top card of deck", CanUseCondition, card);
  104. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  105. cardEffects.Add(activateClass);
  106. string EffectDiscription()
  107. {
  108. return "[On Deletion] Reveal the top card of your deck. If that card has the [Blue Flare] or [Twilight] trait, add it to your hand. Trash the rest.";
  109. }
  110. bool CanSelectCardCondition(CardSource cardSource)
  111. {
  112. if (cardSource.CardTraits.Contains("Blue Flare") || cardSource.CardTraits.Contains("BlueFlare"))
  113. {
  114. return true;
  115. }
  116. if (cardSource.CardTraits.Contains("Twilight"))
  117. {
  118. return true;
  119. }
  120. return false;
  121. }
  122. bool CanUseCondition(Hashtable hashtable)
  123. {
  124. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  129. {
  130. if (card.Owner.LibraryCards.Count >= 1)
  131. {
  132. return true;
  133. }
  134. }
  135. return false;
  136. }
  137. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndProcessForAll(
  140. revealCount: 1,
  141. simplifiedSelectCardCondition:
  142. new SimplifiedSelectCardConditionClass(
  143. canTargetCondition: CanSelectCardCondition,
  144. message: "",
  145. mode: SelectCardEffect.Mode.AddHand,
  146. maxCount: -1,
  147. selectCardCoroutine: null),
  148. remainingCardsPlace: RemainingCardsPlace.Trash,
  149. activateClass: activateClass
  150. ));
  151. }
  152. }
  153. if (timing == EffectTiming.None)
  154. {
  155. bool Condition()
  156. {
  157. if (CardEffectCommons.IsExistOnBattleArea(card))
  158. {
  159. return true;
  160. }
  161. return false;
  162. }
  163. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  164. }
  165. return cardEffects;
  166. }
  167. }
  168. }