P_227.cs 9.5 KB

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