P_231.cs 9.3 KB

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