BT21_087.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT21
  4. {
  5. //Zenith
  6. public class BT21_087 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Your Turn
  12. if (timing == EffectTiming.OnStartTurn)
  13. {
  14. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  15. }
  16. #endregion
  17. #region On Play
  18. if (timing == EffectTiming.OnEnterFieldAnyone)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect($"Reveal the top 3 cards of deck", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  23. cardEffects.Add(activateClass);
  24. string EffectDiscription()
  25. {
  26. return "[On Play] Reveal the top 3 cards of your deck. Among them, play 1 [Vemmon] without paying the cost or add 1 card with [Vemmon] in its text to the hand. Trash the rest.";
  27. }
  28. bool CanSelectCardCondition(CardSource cardSource)
  29. {
  30. return cardSource.HasText("Vemmon");
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.IsExistOnBattleArea(card) &&
  39. card.Owner.LibraryCards.Count >= 1;
  40. }
  41. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  42. {
  43. CardSource selectedCard = null;
  44. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  45. revealCount: 3,
  46. simplifiedSelectCardConditions:
  47. new SimplifiedSelectCardConditionClass[]
  48. {
  49. new SimplifiedSelectCardConditionClass(
  50. canTargetCondition:CanSelectCardCondition,
  51. message: "Select 1 [Vemmon] or 1 card with [Vemmon] in its text.",
  52. mode: SelectCardEffect.Mode.Custom,
  53. maxCount: 1,
  54. selectCardCoroutine: SelectCardCoroutine),
  55. },
  56. remainingCardsPlace: RemainingCardsPlace.Trash,
  57. activateClass: activateClass,
  58. canNoSelect: true
  59. ));
  60. IEnumerator SelectCardCoroutine(CardSource cardSource)
  61. {
  62. selectedCard = cardSource;
  63. yield return null;
  64. }
  65. bool playCard = false;
  66. if(selectedCard != null)
  67. {
  68. if (selectedCard.EqualsCardName("Vemmon"))
  69. {
  70. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  71. {
  72. new SelectionElement<bool>(message: $"Play", value : true, spriteIndex: 0),
  73. new SelectionElement<bool>(message: $"Add to your hand", value : false, spriteIndex: 1),
  74. };
  75. string selectPlayerMessage = "Will you play this card or add it to your hand?";
  76. string notSelectPlayerMessage = "The opponent is choosing whether to play the selected card or add it to their hand.";
  77. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  78. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  79. playCard = GManager.instance.userSelectionManager.SelectedBoolValue;
  80. }
  81. if (playCard)
  82. {
  83. if(CardEffectCommons.CanPlayAsNewPermanent(selectedCard, false, activateClass, SelectCardEffect.Root.Library))
  84. {
  85. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  86. cardSources: new List<CardSource> { selectedCard },
  87. activateClass: activateClass,
  88. payCost: false,
  89. isTapped: false,
  90. root: SelectCardEffect.Root.Library,
  91. activateETB: true));
  92. }
  93. else
  94. {
  95. yield return ContinuousController.instance.StartCoroutine(new ITrashDeckCards(new List<CardSource> { selectedCard }, activateClass).TrashDeckCards());
  96. }
  97. }
  98. else
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(selectedCard, activateClass));
  101. }
  102. }
  103. }
  104. }
  105. #endregion
  106. #region Security
  107. if (timing == EffectTiming.SecuritySkill)
  108. {
  109. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  110. }
  111. #endregion
  112. return cardEffects;
  113. }
  114. }
  115. }