BT17_098.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_098 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Main
  12. if (timing == EffectTiming.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Main] Reveal the top 3 cards of your deck. Add 1 card with [Pulsemon] in its text among them to the hand. Return the rest to the bottom of the deck. Then, place this card in the battle area.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.HasPulsemonText)
  25. {
  26. return true;
  27. }
  28. return false;
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  33. }
  34. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  35. {
  36. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  37. revealCount: 3,
  38. simplifiedSelectCardConditions:
  39. new SimplifiedSelectCardConditionClass[]
  40. {
  41. new SimplifiedSelectCardConditionClass(
  42. canTargetCondition:CanSelectCardCondition,
  43. message: "1 card with [Pulsemon] in its text.",
  44. mode: SelectCardEffect.Mode.AddHand,
  45. maxCount: 1,
  46. selectCardCoroutine: null),
  47. },
  48. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  49. activateClass: activateClass
  50. ));
  51. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  52. }
  53. }
  54. #endregion
  55. #region Main Delay
  56. if (timing == EffectTiming.OnDeclaration)
  57. {
  58. ActivateClass activateClass = new ActivateClass();
  59. activateClass.SetUpICardEffect("Place 1 Digimon on top of Security to get 2 memory.", CanUseCondition, card);
  60. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  61. cardEffects.Add(activateClass);
  62. string EffectDiscription()
  63. {
  64. return "[Main][Delay] By placing the top card of 1 of your level 4 or higher Digimon with [Pulsemon] in its text on top of your security stack, gain 2 memory.";
  65. }
  66. bool CanSelectPermanentCondition(Permanent permanent)
  67. {
  68. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  69. {
  70. if (permanent.IsDigimon && permanent.TopCard.HasPulsemonText && permanent.TopCard.Level >= 4)
  71. {
  72. return true;
  73. }
  74. }
  75. return false;
  76. }
  77. bool CanUseCondition(Hashtable hashtable)
  78. {
  79. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  80. }
  81. bool CanActivateCondition(Hashtable hashtable)
  82. {
  83. if (CardEffectCommons.IsExistOnBattleArea(card))
  84. {
  85. if (CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition) >= 1)
  86. return true;
  87. }
  88. return true;
  89. }
  90. IEnumerator ActivateCoroutine(Hashtable hashtable)
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  93. IEnumerator SuccessProcess()
  94. {
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  96. {
  97. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  98. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: true,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: SelectPermanentCoroutine,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Custom,
  110. cardEffect: activateClass);
  111. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to place to security.", "The opponent is selecting 1 Digimon to place to security.");
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  114. {
  115. if (permanent != null)
  116. {
  117. permanent.ShowingPermanentCard.ShowPermanentData(true);
  118. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(permanent.TopCard, permanent));
  119. if (!permanent.TopCard.IsToken)
  120. {
  121. if (permanent.DigivolutionCards.Count >= 1)
  122. {
  123. if (permanent.TopCard.IsACE) yield return ContinuousController.instance.StartCoroutine(new AceOverflowClass(new List<CardSource> { permanent.TopCard }).Overflow());
  124. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(permanent.TopCard));
  125. permanent.willBeRemoveField = false;
  126. if (permanent.ShowingPermanentCard != null)
  127. {
  128. if (permanent.ShowingPermanentCard.WillBeDeletedObject != null)
  129. {
  130. permanent.ShowingPermanentCard.WillBeDeletedObject.SetActive(false);
  131. }
  132. }
  133. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  134. }
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
  142. #endregion
  143. #region Security
  144. if (timing == EffectTiming.SecuritySkill)
  145. {
  146. ActivateClass activateClass = new ActivateClass();
  147. activateClass.SetUpICardEffect($"Reveal the top 3 cards of deck and place this card on battle area", CanUseCondition, card);
  148. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  149. activateClass.SetIsSecurityEffect(true);
  150. cardEffects.Add(activateClass);
  151. string EffectDiscription()
  152. {
  153. return "[Security] Reveal the top 3 cards of your deck. Add 1 card with [Pulsemon] in its text among them to the hand. Return the rest to the bottom of the deck. Then, place this card in the battle area.";
  154. }
  155. bool CanSelectCardCondition(CardSource cardSource)
  156. {
  157. if (cardSource.HasPulsemonText)
  158. {
  159. return true;
  160. }
  161. return false;
  162. }
  163. bool CanUseCondition(Hashtable hashtable)
  164. {
  165. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  166. }
  167. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  168. {
  169. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  170. revealCount: 3,
  171. simplifiedSelectCardConditions:
  172. new SimplifiedSelectCardConditionClass[]
  173. {
  174. new SimplifiedSelectCardConditionClass(
  175. canTargetCondition:CanSelectCardCondition,
  176. message: "1 card with [Pulsemon] in its text.",
  177. mode: SelectCardEffect.Mode.AddHand,
  178. maxCount: 1,
  179. selectCardCoroutine: null),
  180. },
  181. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  182. activateClass: activateClass
  183. ));
  184. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(
  185. card: card,
  186. cardEffect: activateClass));
  187. }
  188. }
  189. #endregion
  190. return cardEffects;
  191. }
  192. }
  193. }