ST23_15.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Runtime.CompilerServices;
  5. // e-Pulse
  6. namespace DCGO.CardEffects.ST23
  7. {
  8. public class ST23_15 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Ignore Color Requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
  17. bool CardCondition(CardSource cardSource)
  18. {
  19. return cardSource.EqualsTraits("BEATBREAK");
  20. }
  21. }
  22. #endregion
  23. #region Main
  24. if (timing == EffectTiming.OptionSkill)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Play 1 [BEATBREAK] card with a play cost of 4 or less from hand or trash for free, place this card in battle area", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  29. cardEffects.Add(activateClass);
  30. string EffectDescription()
  31. {
  32. return "[Main] You may play 1 [BEATBREAK] trait card with a play cost of 4 or less from your hand or trash without paying the cost. Then, place this card in the battle area.";
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable hashtable)
  39. {
  40. bool CanSelectPlayCondition(CardSource cardSource)
  41. {
  42. return (cardSource.IsDigimon
  43. || cardSource.IsTamer)
  44. && cardSource.HasPlayCost
  45. && cardSource.EqualsTraits("BEATBREAK")
  46. && cardSource.GetCostItself <= 4
  47. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  48. }
  49. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectPlayCondition);
  50. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectPlayCondition);
  51. if (canSelectHand || canSelectTrash)
  52. {
  53. #region Setup Location Selection
  54. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>();
  55. if (canSelectHand)
  56. {
  57. selectionElements.Add(new(message: $"From hand", value: 1, spriteIndex: 0));
  58. }
  59. if (canSelectTrash)
  60. {
  61. selectionElements.Add(new(message: $"From trash", value: 2, spriteIndex: 0));
  62. }
  63. selectionElements.Add(new(message: $"Do not play", value: 3, spriteIndex: 1));
  64. string selectPlayerMessage = "From which area do you select a card?";
  65. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  66. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  67. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  68. #endregion
  69. SelectCardEffect.Root root = GManager.instance.userSelectionManager.SelectedIntValue == 1 ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash;
  70. bool doSelect = GManager.instance.userSelectionManager.SelectedIntValue != 3;
  71. if (doSelect)
  72. {
  73. #region Hand/Trash Card Selection & Play
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  75. canTargetCondition: CanSelectPlayCondition,
  76. root,
  77. activateClass,
  78. payCost: false
  79. ));
  80. #endregion
  81. }
  82. }
  83. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  84. }
  85. }
  86. #endregion
  87. #region Security
  88. if (timing == EffectTiming.SecuritySkill)
  89. {
  90. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  91. card: card,
  92. cardEffects: ref cardEffects,
  93. effectName: "[Security] You may play 1 [DATA SQUAD] trait card with a play cost of 4 or less from your hand or trash without paying the cost. Then, place this card in the battle area.");
  94. }
  95. #endregion
  96. #region Start of Your Main Phase
  97. if (timing == EffectTiming.OnStartMainPhase)
  98. {
  99. ActivateClass activateClass = new ActivateClass();
  100. activateClass.SetUpICardEffect("Place this card under 1 [BEATBREAK] tamer face down to <Draw 1> and gain 1 memory", CanUseCondition, card);
  101. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  102. cardEffects.Add(activateClass);
  103. string EffectDescription()
  104. {
  105. return "[Start of Your Main Phase] By placing this card from the battle area face down under any of your [BEATBREAK] trait Tamers, <Draw 1> and gain 1 memory.";
  106. }
  107. bool CanUseCondition(Hashtable hashtable)
  108. {
  109. return CardEffectCommons.IsExistOnBattleArea(card)
  110. && CardEffectCommons.IsOwnerTurn(card);
  111. }
  112. bool CanActivateCondition(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.IsExistOnBattleArea(card)
  115. && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermamentCondition);
  116. }
  117. bool CanSelectPermamentCondition(Permanent permanent)
  118. {
  119. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card)
  120. && permanent.TopCard.EqualsTraits("BEATBREAK");
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable hashtable)
  123. {
  124. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermamentCondition))
  125. {
  126. Permanent selectedPermanent = null;
  127. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermamentCondition));
  128. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  129. selectPermanentEffect.SetUp(
  130. selectPlayer: card.Owner,
  131. canTargetCondition: CanSelectPermamentCondition,
  132. canTargetCondition_ByPreSelecetedList: null,
  133. canEndSelectCondition: null,
  134. maxCount: maxCount,
  135. canNoSelect: true,
  136. canEndNotMax: false,
  137. selectPermanentCoroutine: SelectPermanentCoroutine,
  138. afterSelectPermanentCoroutine: null,
  139. mode: SelectPermanentEffect.Mode.Custom,
  140. cardEffect: activateClass);
  141. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer that will get a digivolution card.", "The opponent is selecting 1 Tamer that will get a digivolution card.");
  142. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  143. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  144. {
  145. selectedPermanent = permanent;
  146. yield return null;
  147. }
  148. if (selectedPermanent != null && !selectedPermanent.IsToken)
  149. {
  150. yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
  151. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { card }, activateClass, false, true));
  152. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  153. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  154. }
  155. }
  156. }
  157. }
  158. #endregion
  159. return cardEffects;
  160. }
  161. }
  162. }