EX12_058.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // HiAndromon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_058 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("ME");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 3,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null,
  24. level: 5)
  25. );
  26. }
  27. #endregion
  28. #region DNA Digivolution
  29. if (timing == EffectTiming.None)
  30. {
  31. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  32. addJogressConditionClass.SetUpICardEffect("DNA Digivolution", CanUseCondition, card);
  33. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  34. addJogressConditionClass.SetNotShowUI(true);
  35. cardEffects.Add(addJogressConditionClass);
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return true;
  39. }
  40. JogressCondition GetJogress(CardSource cardSource)
  41. {
  42. if (cardSource == card)
  43. {
  44. bool PermanentCondition1(Permanent permanent)
  45. {
  46. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  47. && (permanent.TopCard.CardColors.Contains(CardColor.Black)
  48. || permanent.TopCard.CardColors.Contains(CardColor.Purple))
  49. && permanent.Levels_ForJogress(card).Contains(5);
  50. }
  51. bool PermanentCondition2(Permanent permanent)
  52. {
  53. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  54. && (permanent.TopCard.CardColors.Contains(CardColor.Red)
  55. || permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  56. && permanent.Levels_ForJogress(card).Contains(5);
  57. }
  58. JogressConditionElement[] elements = new JogressConditionElement[]
  59. {
  60. new JogressConditionElement(PermanentCondition1, "a level 5 Black or Purple Digimon"),
  61. new JogressConditionElement(PermanentCondition2, "a level 5 Red or Yellow Digimon"),
  62. };
  63. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  64. return jogressCondition;
  65. }
  66. return null;
  67. }
  68. }
  69. #endregion
  70. #region Shared OP/WD/WA
  71. string SharedEffectName = "Reveal 3, may play 1 7 cost or lower [Machine]/[Cyborg]/[ME] among them for free, trash the rest";
  72. string SharedEffectHash = "EX12_058_OP_WD_WA";
  73. CardEffectFactory.ActivateClassesForSharedEffects
  74. (ref cardEffects, timing, card,
  75. SharedEffectName,
  76. SharedActivateCoroutine,
  77. SharedEffectDescription,
  78. optional: false,
  79. maxCountPerTurn: 1,
  80. hashValue: SharedEffectHash,
  81. onPlay: true,
  82. whenDigivolving: true,
  83. whenAttacking: true);
  84. string SharedEffectDescription(string tag)
  85. {
  86. return $"[{tag}] [Once Per Turn] Reveal the top 3 cards of your deck. You may play 1 play cost 7 or lower [Machine], [Cyborg] or [ME] trait card among them without paying the cost. Trash the rest.";
  87. }
  88. bool CanSelectCardCondition(CardSource cardSource)
  89. {
  90. return cardSource.HasPlayCost
  91. && cardSource.GetCostItself <= 7
  92. && (cardSource.EqualsTraits("Machine")
  93. || cardSource.EqualsTraits("Cyborg")
  94. || cardSource.EqualsTraits("ME"));
  95. }
  96. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  97. {
  98. CardSource selectedCard = null;
  99. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  100. revealCount: 3,
  101. simplifiedSelectCardConditions:
  102. new SimplifiedSelectCardConditionClass[]
  103. {
  104. new SimplifiedSelectCardConditionClass(
  105. canTargetCondition:CanSelectCardCondition,
  106. message: "May select 1 7 cost or less [Machine]/[Cyborg]/[ME] card to play for free.",
  107. mode: SelectCardEffect.Mode.Custom,
  108. maxCount: 1,
  109. selectCardCoroutine: SelectCardCoroutine),
  110. },
  111. remainingCardsPlace: RemainingCardsPlace.Trash,
  112. activateClass: activateClass,
  113. canNoSelect: true
  114. ));
  115. IEnumerator SelectCardCoroutine(CardSource cardSource)
  116. {
  117. selectedCard = cardSource;
  118. if (selectedCard != null)
  119. {
  120. if (CardEffectCommons.CanPlayAsNewPermanent(selectedCard, false, activateClass, SelectCardEffect.Root.Library))
  121. {
  122. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  123. cardSources: new List<CardSource> { selectedCard },
  124. activateClass: activateClass,
  125. payCost: false,
  126. isTapped: false,
  127. root: SelectCardEffect.Root.Library,
  128. activateETB: true));
  129. }
  130. else
  131. {
  132. yield return ContinuousController.instance.StartCoroutine(new ITrashDeckCards(new List<CardSource> { selectedCard }, activateClass).TrashDeckCards());
  133. }
  134. }
  135. }
  136. }
  137. #endregion
  138. #region All Turns
  139. {
  140. bool PermanentCondition(Permanent permanent)
  141. {
  142. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  143. && permanent.TopCard.EqualsTraits("ME");
  144. }
  145. bool Condition()
  146. {
  147. return CardEffectCommons.IsExistOnBattleArea(card);
  148. }
  149. if (timing == EffectTiming.None)
  150. {
  151. cardEffects.Add(CardEffectFactory.RebootStaticEffect(PermanentCondition, false, card, Condition));
  152. }
  153. if (timing == EffectTiming.OnAllyAttack)
  154. {
  155. cardEffects.Add(CardEffectFactory.AllianceStaticEffect(PermanentCondition, false, card, Condition));
  156. }
  157. }
  158. #endregion
  159. return cardEffects;
  160. }
  161. }
  162. }