EX5_071.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public class EX5_071 : CEntity_Effect
  5. {
  6. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  7. {
  8. List<ICardEffect> cardEffects = new List<ICardEffect>();
  9. if (timing == EffectTiming.None)
  10. {
  11. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  12. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  13. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  14. cardEffects.Add(ignoreColorConditionClass);
  15. bool PermanentCondition(Permanent permanent)
  16. {
  17. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  18. {
  19. if (permanent.TopCard.CardTraits.Contains("Deva"))
  20. {
  21. return true;
  22. }
  23. if (permanent.TopCard.CardTraits.Contains("Four Sovereigns"))
  24. {
  25. return true;
  26. }
  27. if (permanent.TopCard.CardTraits.Contains("FourSovereigns"))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. if (card.Owner.GetBattleAreaDigimons().Some(PermanentCondition))
  37. {
  38. return true;
  39. }
  40. return false;
  41. }
  42. bool CardCondition(CardSource cardSource)
  43. {
  44. if (cardSource == card)
  45. {
  46. return true;
  47. }
  48. return false;
  49. }
  50. }
  51. if (timing == EffectTiming.OptionSkill)
  52. {
  53. ActivateClass activateClass = new ActivateClass();
  54. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  55. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  56. cardEffects.Add(activateClass);
  57. string EffectDiscription()
  58. {
  59. return "[Main] Reveal the top 3 cards of your deck. Place 1 card with [Deva]/[Four Sovereigns] trait among them as the bottom digivolution card of 1 of your Digimon or add it to your hand. Return the rest to the top or bottom of the deck.";
  60. }
  61. bool CanSelectCardCondition(CardSource cardSource)
  62. {
  63. if (cardSource.CardTraits.Contains("Deva"))
  64. {
  65. return true;
  66. }
  67. if (cardSource.CardTraits.Contains("Four Sovereigns"))
  68. {
  69. return true;
  70. }
  71. if (cardSource.CardTraits.Contains("FourSovereigns"))
  72. {
  73. return true;
  74. }
  75. return false;
  76. }
  77. bool CanSelectPermanentCondition(Permanent permanent)
  78. {
  79. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  80. {
  81. if (!permanent.IsToken)
  82. {
  83. return true;
  84. }
  85. }
  86. return false;
  87. }
  88. bool CanUseCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  93. {
  94. List<CardSource> selectedCards = new List<CardSource>();
  95. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  96. revealCount: 3,
  97. simplifiedSelectCardConditions:
  98. new SimplifiedSelectCardConditionClass[]
  99. {
  100. new SimplifiedSelectCardConditionClass(
  101. canTargetCondition:CanSelectCardCondition,
  102. message: "Select 1 card with [Deva]/[Four Sovereigns] trait.",
  103. mode: SelectCardEffect.Mode.Custom,
  104. maxCount: 1,
  105. selectCardCoroutine: SelectCardCoroutine),
  106. },
  107. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  108. activateClass: activateClass,
  109. canNoSelect: true
  110. ));
  111. IEnumerator SelectCardCoroutine(CardSource cardSource)
  112. {
  113. selectedCards.Add(cardSource);
  114. yield return null;
  115. }
  116. if (selectedCards.Count >= 1)
  117. {
  118. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(selectedCards, "Selected Cards", true, true));
  119. bool canSelectDigimon = CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  120. bool canSelectHand = true;
  121. if (canSelectDigimon || canSelectHand)
  122. {
  123. if (canSelectDigimon && canSelectHand)
  124. {
  125. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  126. {
  127. new SelectionElement<bool>(message: $"Place on digivolution cards", value : true, spriteIndex: 0),
  128. new SelectionElement<bool>(message: $"Add to hand", value : false, spriteIndex: 1),
  129. };
  130. string selectPlayerMessage = "Which effect will you select?";
  131. string notSelectPlayerMessage = "The opponent is choosing effects.";
  132. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  133. }
  134. else
  135. {
  136. GManager.instance.userSelectionManager.SetBool(canSelectDigimon);
  137. }
  138. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  139. bool selectDigimon = GManager.instance.userSelectionManager.SelectedBoolValue;
  140. if (selectDigimon)
  141. {
  142. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  143. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  144. selectPermanentEffect.SetUp(
  145. selectPlayer: card.Owner,
  146. canTargetCondition: CanSelectPermanentCondition,
  147. canTargetCondition_ByPreSelecetedList: null,
  148. canEndSelectCondition: null,
  149. maxCount: maxCount,
  150. canNoSelect: true,
  151. canEndNotMax: false,
  152. selectPermanentCoroutine: SelectPermanentCoroutine,
  153. afterSelectPermanentCoroutine: null,
  154. mode: SelectPermanentEffect.Mode.Custom,
  155. cardEffect: activateClass);
  156. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  157. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  158. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  159. {
  160. Permanent selectedPermanent = permanent;
  161. if (selectedPermanent != null)
  162. {
  163. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  164. }
  165. }
  166. }
  167. else
  168. {
  169. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(selectedCards, "Cards added to hand", true, true));
  170. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(selectedCards, false, activateClass));
  171. }
  172. }
  173. }
  174. }
  175. }
  176. if (timing == EffectTiming.SecuritySkill)
  177. {
  178. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Reveal the top 3 cards of deck");
  179. }
  180. return cardEffects;
  181. }
  182. }