BT15_007.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_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.OnStartMainPhase)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Trash 1 card from hand to reveal the top 4 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Start of Your Main Phase] By trashing 1 Digimon with [Avian], [Bird], [Beast], or [Sovereign], other that [Sea Animal], in one of its traits in your hard, reveal the top 4 cards of your deck. Add 1 red card among them to your hand. Return the rest to the bottom of the deck.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.IsDigimon)
  24. {
  25. if (cardSource.HasAvianBeastAnimalTraits)
  26. return true;
  27. }
  28. return false;
  29. }
  30. bool CanSelectCardCondition1(CardSource cardSource)
  31. {
  32. return cardSource.HasCardColor(CardColor.Red);
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (CardEffectCommons.IsOwnerTurn(card))
  39. {
  40. return true;
  41. }
  42. }
  43. return false;
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (card.Owner.HandCards.Count >= 1)
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  59. {
  60. bool discarded = false;
  61. int discardCount = 1;
  62. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  63. selectHandEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: CanSelectCardCondition,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: discardCount,
  69. canNoSelect: true,
  70. canEndNotMax: false,
  71. isShowOpponent: true,
  72. selectCardCoroutine: null,
  73. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  74. mode: SelectHandEffect.Mode.Discard,
  75. cardEffect: activateClass);
  76. yield return StartCoroutine(selectHandEffect.Activate());
  77. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  78. {
  79. if (cardSources.Count >= 1)
  80. {
  81. discarded = true;
  82. yield return null;
  83. }
  84. }
  85. if (discarded)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  88. revealCount: 4,
  89. simplifiedSelectCardConditions:
  90. new SimplifiedSelectCardConditionClass[]
  91. {
  92. new SimplifiedSelectCardConditionClass(
  93. canTargetCondition:CanSelectCardCondition1,
  94. message: "Select 1 red card.",
  95. mode: SelectCardEffect.Mode.AddHand,
  96. maxCount: 1,
  97. selectCardCoroutine: null),
  98. },
  99. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  100. activateClass: activateClass
  101. ));
  102. }
  103. }
  104. }
  105. }
  106. if (timing == EffectTiming.OnLoseSecurity)
  107. {
  108. ActivateClass activateClass = new ActivateClass();
  109. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  110. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  111. activateClass.SetIsInheritedEffect(true);
  112. activateClass.SetHashString("Memory+1_BT15_007");
  113. cardEffects.Add(activateClass);
  114. string EffectDiscription()
  115. {
  116. return "[Your Turn][Once Per Turn] When a card is removed from your opponent's security stack, gain 1 memory.";
  117. }
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnBattleArea(card))
  121. {
  122. if (CardEffectCommons.IsOwnerTurn(card))
  123. {
  124. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner.Enemy))
  125. {
  126. return true;
  127. }
  128. }
  129. }
  130. return false;
  131. }
  132. bool CanActivateCondition(Hashtable hashtable)
  133. {
  134. if (CardEffectCommons.IsExistOnBattleArea(card))
  135. {
  136. return true;
  137. }
  138. return false;
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  141. {
  142. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  143. }
  144. }
  145. return cardEffects;
  146. }
  147. }
  148. }