BT18_068.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class BT18_068 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Blocker
  11. if (timing == EffectTiming.None)
  12. {
  13. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  14. isInheritedEffect: false,
  15. card: card,
  16. condition: null));
  17. }
  18. #endregion
  19. #region On Play
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Reveal 5 of either player's deck", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[On Play] Reveal the top 5 cards of either player's deck. Return the revealed cards to the top or bottom of the deck.";
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.CanTriggerOnPlay(hashtable,card);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (card.Owner.LibraryCards.Count >= 1)
  39. {
  40. return true;
  41. }
  42. if(card.Owner.Enemy.LibraryCards.Count >=1)
  43. {
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  52. {
  53. new SelectionElement<bool>(message: $"Your deck", value : true, spriteIndex: 0),
  54. new SelectionElement<bool>(message: $"Opponent's deck", value : false, spriteIndex: 1),
  55. };
  56. string selectPlayerMessage = "Reveal your deck or your opponent's deck?";
  57. string notSelectPlayerMessage = "The opponent is choosing which deck to reveal.";
  58. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  59. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  60. bool yourDeck = GManager.instance.userSelectionManager.SelectedBoolValue;
  61. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndProcessForAll(
  62. revealCount: 5,
  63. simplifiedSelectCardCondition:
  64. new SimplifiedSelectCardConditionClass(
  65. canTargetCondition: (cardSource) => false,
  66. message: "",
  67. mode: SelectCardEffect.Mode.Custom,
  68. maxCount: -1,
  69. selectCardCoroutine: null),
  70. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  71. activateClass: activateClass,
  72. revealedCardsCoroutine: null,
  73. isOpponentDeck: !yourDeck
  74. ));
  75. }
  76. }
  77. #endregion
  78. #region When Digivolving
  79. if (timing == EffectTiming.OnEnterFieldAnyone)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("Reveal 5 of either player's deck", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  84. cardEffects.Add(activateClass);
  85. string EffectDiscription()
  86. {
  87. return "[When Digivolving] Reveal the top 5 cards of either player's deck. Return the revealed cards to the top or bottom of the deck.";
  88. }
  89. bool CanUseCondition(Hashtable hashtable)
  90. {
  91. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  92. }
  93. bool CanActivateCondition(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.IsExistOnBattleArea(card))
  96. {
  97. if (card.Owner.LibraryCards.Count >= 1)
  98. {
  99. return true;
  100. }
  101. if (card.Owner.Enemy.LibraryCards.Count >= 1)
  102. {
  103. return true;
  104. }
  105. }
  106. return false;
  107. }
  108. IEnumerator ActivateCoroutine(Hashtable hashtable)
  109. {
  110. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  111. {
  112. new SelectionElement<bool>(message: $"Your deck", value : true, spriteIndex: 0),
  113. new SelectionElement<bool>(message: $"Opponent's deck", value : false, spriteIndex: 1),
  114. };
  115. string selectPlayerMessage = "Reveal your deck or your opponent's deck?";
  116. string notSelectPlayerMessage = "The opponent is choosing which deck to reveal.";
  117. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  118. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  119. bool yourDeck = GManager.instance.userSelectionManager.SelectedBoolValue;
  120. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndProcessForAll(
  121. revealCount: 5,
  122. simplifiedSelectCardCondition:
  123. new SimplifiedSelectCardConditionClass(
  124. canTargetCondition: (cardSource) => false,
  125. message: "",
  126. mode: SelectCardEffect.Mode.Custom,
  127. maxCount: -1,
  128. selectCardCoroutine: null),
  129. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  130. activateClass: activateClass,
  131. revealedCardsCoroutine: null,
  132. isOpponentDeck: !yourDeck
  133. ));
  134. }
  135. }
  136. #endregion
  137. return cardEffects;
  138. }
  139. }
  140. }