P_230.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. //Unique Emblem: Honeycomb Commander
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_230 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Main
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal 3, add 1 [Royal Base] in text and 1 [Liberator] trait, bot deck the rest, place in battle area.", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Reveal the top 3 cards of your deck. Add 1 Digimon card with [Royal Base] in its text and 1 [LIBERATOR] trait card among them to the hand. Return the rest to the bottom of the deck. Then, place this card in the battle area.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  26. }
  27. bool CanSelectCardCondition(CardSource cardSource)
  28. {
  29. return cardSource.HasText("Royal Base");
  30. }
  31. bool CanSelectCardCondition1(CardSource cardSource)
  32. {
  33. return cardSource.EqualsTraits("LIBERATOR");
  34. }
  35. IEnumerator ActivateCoroutine(Hashtable hashtable)
  36. {
  37. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  38. revealCount: 3,
  39. simplifiedSelectCardConditions:
  40. new SimplifiedSelectCardConditionClass[]
  41. {
  42. new SimplifiedSelectCardConditionClass(
  43. canTargetCondition:CanSelectCardCondition,
  44. message: "Select 1 card with [Royal Base] in text.",
  45. mode: SelectCardEffect.Mode.AddHand,
  46. maxCount: 1,
  47. selectCardCoroutine: null),
  48. new SimplifiedSelectCardConditionClass(
  49. canTargetCondition:CanSelectCardCondition1,
  50. message: "Select 1 [LIBERATOR] trait card.",
  51. mode: SelectCardEffect.Mode.AddHand,
  52. maxCount: 1,
  53. selectCardCoroutine: null),
  54. },
  55. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  56. activateClass: activateClass));
  57. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  58. }
  59. }
  60. #endregion
  61. #region Your turn - Delay
  62. if (timing == EffectTiming.OnEnterFieldAnyone)
  63. {
  64. ActivateClass activateClass = new ActivateClass();
  65. activateClass.SetUpICardEffect("Digivolve into a level 6 or lower [LIBERATOR] Digimon for 3 less.", CanUseCondition, card);
  66. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  67. cardEffects.Add(activateClass);
  68. string EffectDiscription()
  69. {
  70. return "[Your Turn] When any of your [Winr]s are played, <Delay>.\r\n 1 of your Digimon may digivolve into a level 6 or lower [LIBERATOR] trait card in the hand with the digivolution cost reduced by 3.";
  71. }
  72. bool CanUseCondition(Hashtable hashtable)
  73. {
  74. return CardEffectCommons.IsExistOnBattleArea(card)
  75. && CardEffectCommons.CanDeclareOptionDelayEffect(card)
  76. && CardEffectCommons.IsOwnerTurn(card)
  77. && CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedPermanentCondition);
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.IsExistOnBattleArea(card);
  82. }
  83. bool PlayedPermanentCondition(Permanent permanent)
  84. {
  85. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  86. && permanent.TopCard.EqualsCardName("Winr");
  87. }
  88. bool PermanentCondition(Permanent permanent)
  89. {
  90. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  91. }
  92. bool CardCondition(CardSource cardSource)
  93. {
  94. return cardSource.IsDigimon
  95. && cardSource.HasLevel
  96. && cardSource.Level <= 6
  97. && cardSource.HasLiberatorTraits;
  98. }
  99. IEnumerator ActivateCoroutine(Hashtable hashtable)
  100. {
  101. bool delaySuccessful = false;
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  103. IEnumerator SuccessProcess()
  104. {
  105. delaySuccessful = true;
  106. yield return null;
  107. }
  108. if (delaySuccessful)
  109. {
  110. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition))
  111. {
  112. Permanent selectedDigimon = null;
  113. #region Select Permanent
  114. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, PermanentCondition));
  115. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  116. selectPermanentEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: PermanentCondition,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: maxCount,
  122. canNoSelect: true,
  123. canEndNotMax: false,
  124. selectPermanentCoroutine: SelectPermanentCoroutine,
  125. afterSelectPermanentCoroutine: null,
  126. mode: SelectPermanentEffect.Mode.Custom,
  127. cardEffect: activateClass);
  128. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  129. {
  130. selectedDigimon = permanent;
  131. yield return null;
  132. }
  133. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve", "The opponent is selecting 1 Digimon to digivolve");
  134. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  135. #endregion
  136. if (selectedDigimon != null) yield return ContinuousController.instance.StartCoroutine(
  137. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  138. targetPermanent: selectedDigimon,
  139. cardCondition: CardCondition,
  140. payCost: true,
  141. reduceCostTuple: (reduceCost: 3, reduceCostCardCondition: null),
  142. fixedCostTuple: null,
  143. ignoreDigivolutionRequirementFixedCost: -1,
  144. isHand: true,
  145. activateClass: activateClass,
  146. successProcess: null
  147. )
  148. );
  149. }
  150. }
  151. }
  152. }
  153. #endregion
  154. #region Security Effect
  155. if (timing == EffectTiming.SecuritySkill)
  156. {
  157. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  158. card: card,
  159. cardEffects: ref cardEffects,
  160. effectName: "Reveal 3, add 1 [Royal Base] in text and 1 [Liberator] trait, bot deck the rest, place in battle area.");
  161. }
  162. #endregion
  163. return cardEffects;
  164. }
  165. }
  166. }