EX4_014.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX4
  6. {
  7. public class EX4_014 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Draw 1 or return 1 card from trash to hand", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  17. activateClass.SetHashString("Draw1_EX4_014");
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Your Turn][Once Per Turn] When a card with the [Blue Flare] trait is played, <Draw 1>. (Draw 1 card from your deck.) When a card with the [Twilight] trait is played, return 1 Digimon card with DigiXros requirements from your trash to your hand.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.IsDigimon)
  26. {
  27. if (cardSource.HasDigiXros)
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool PermanentCondition(Permanent permanent)
  35. {
  36. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  37. {
  38. if (!permanent.TopCard.IsOption)
  39. {
  40. if (permanent.TopCard.CardTraits.Contains("Blue Flare") || permanent.TopCard.CardTraits.Contains("BlueFlare"))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. bool PermanentCondition1(Permanent permanent)
  49. {
  50. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  51. {
  52. if (permanent.TopCard.CardTraits.Contains("Twilight"))
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. if (CardEffectCommons.IsExistOnBattleArea(card))
  62. {
  63. if (CardEffectCommons.IsOwnerTurn(card))
  64. {
  65. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  66. {
  67. return true;
  68. }
  69. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition1))
  70. {
  71. return true;
  72. }
  73. }
  74. }
  75. return false;
  76. }
  77. bool CanActivateCondition(Hashtable hashtable)
  78. {
  79. if (CardEffectCommons.IsExistOnBattleArea(card))
  80. {
  81. return true;
  82. }
  83. return false;
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  86. {
  87. if (CardEffectCommons.CanTriggerOnPermanentPlay(_hashtable, PermanentCondition))
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  90. }
  91. if (CardEffectCommons.CanTriggerOnPermanentPlay(_hashtable, PermanentCondition1))
  92. {
  93. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  94. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  95. selectCardEffect.SetUp(
  96. canTargetCondition: CanSelectCardCondition,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. canNoSelect: () => false,
  100. selectCardCoroutine: null,
  101. afterSelectCardCoroutine: null,
  102. message: "Select 1 card to add to your hand.",
  103. maxCount: maxCount,
  104. canEndNotMax: false,
  105. isShowOpponent: true,
  106. mode: SelectCardEffect.Mode.AddHand,
  107. root: SelectCardEffect.Root.Trash,
  108. customRootCardList: null,
  109. canLookReverseCard: true,
  110. selectPlayer: card.Owner,
  111. cardEffect: activateClass);
  112. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  113. }
  114. }
  115. }
  116. return cardEffects;
  117. }
  118. }
  119. }