BT15_070.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_070 : 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 card with [Myotismon] in its text among them to the hand. Return the rest to the bottom of the deck. If you added cards, trash 1 card in your hand.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.HasText("Myotismon"))
  24. {
  25. return true;
  26. }
  27. return false;
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (card.Owner.LibraryCards.Count >= 1)
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. bool added = false;
  47. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  48. revealCount: 4,
  49. simplifiedSelectCardConditions:
  50. new SimplifiedSelectCardConditionClass[]
  51. {
  52. new SimplifiedSelectCardConditionClass(
  53. canTargetCondition:CanSelectCardCondition,
  54. message: "Select 1 card with [Myotismon] in its text.",
  55. mode: SelectCardEffect.Mode.AddHand,
  56. maxCount: 1,
  57. selectCardCoroutine: null),
  58. },
  59. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  60. activateClass: activateClass,
  61. revealedCardsCoroutine: RevealedCardsCoroutine
  62. ));
  63. IEnumerator RevealedCardsCoroutine(List<CardSource> revealedCards)
  64. {
  65. added = revealedCards.Count(CanSelectCardCondition) >= 1;
  66. yield return null;
  67. }
  68. if (added)
  69. {
  70. if (card.Owner.HandCards.Count >= 1)
  71. {
  72. int discardCount = 1;
  73. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  74. selectHandEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: (cardSource) => true,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: discardCount,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. isShowOpponent: true,
  83. selectCardCoroutine: null,
  84. afterSelectCardCoroutine: null,
  85. mode: SelectHandEffect.Mode.Discard,
  86. cardEffect: activateClass);
  87. yield return StartCoroutine(selectHandEffect.Activate());
  88. }
  89. }
  90. }
  91. }
  92. if (timing == EffectTiming.OnDestroyedAnyone)
  93. {
  94. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  95. }
  96. return cardEffects;
  97. }
  98. }
  99. }