EX12_032.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // WereGarurumon
  5. namespace DCGO.CardEffects.EX12
  6. {
  7. public class EX12_032 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.ContainsCardName("Garurumon")
  18. || targetPermanent.TopCard.EqualsTraits("NSo")
  19. || targetPermanent.TopCard.EqualsTraits("VB");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  22. permanentCondition: PermanentCondition,
  23. digivolutionCost: 3,
  24. ignoreDigivolutionRequirement: false,
  25. card: card,
  26. condition: null,
  27. level: 4)
  28. );
  29. }
  30. #endregion
  31. #region DNA Digivolution
  32. if (timing == EffectTiming.None)
  33. {
  34. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  35. addJogressConditionClass.SetUpICardEffect("DNA Digivolution", CanUseCondition, card);
  36. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  37. addJogressConditionClass.SetNotShowUI(true);
  38. cardEffects.Add(addJogressConditionClass);
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return true;
  42. }
  43. JogressCondition GetJogress(CardSource cardSource)
  44. {
  45. if (cardSource == card)
  46. {
  47. bool PermanentCondition1(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  50. && (permanent.TopCard.CardColors.Contains(CardColor.Blue)
  51. || permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  52. && permanent.Levels_ForJogress(card).Contains(4);
  53. }
  54. bool PermanentCondition2(Permanent permanent)
  55. {
  56. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  57. && (permanent.TopCard.CardColors.Contains(CardColor.Purple)
  58. || permanent.TopCard.CardColors.Contains(CardColor.Red))
  59. && permanent.Levels_ForJogress(card).Contains(4);
  60. }
  61. JogressConditionElement[] elements = new JogressConditionElement[]
  62. {
  63. new JogressConditionElement(PermanentCondition1, "a level 4 Blue or Yellow Digimon"),
  64. new JogressConditionElement(PermanentCondition2, "a level 4 Purple or Red Digimon"),
  65. };
  66. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  67. return jogressCondition;
  68. }
  69. return null;
  70. }
  71. }
  72. #endregion
  73. #region Shared OP/WD
  74. string SharedEffectName = "Stun 1 enemy Digimon/Tamer";
  75. CardEffectFactory.ActivateClassesForSharedEffects
  76. (ref cardEffects, timing, card,
  77. SharedEffectName,
  78. SharedActivateCoroutine,
  79. SharedEffectDescription,
  80. optional: false,
  81. onPlay: true,
  82. whenDigivolving: true);
  83. string SharedEffectDescription(string tag)
  84. {
  85. return $"[{tag}] 1 of your opponent's Digimon or Tamers can't suspend until their turn ends.";
  86. }
  87. bool CanSelectPermanentCondition(Permanent permanent)
  88. {
  89. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  90. && (permanent.IsDigimon
  91. || permanent.IsTamer);
  92. }
  93. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  94. {
  95. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  96. selectPermanentEffect.SetUp(
  97. selectPlayer: card.Owner,
  98. canTargetCondition: CanSelectPermanentCondition,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. maxCount: 1,
  102. canNoSelect: false,
  103. canEndNotMax: false,
  104. selectPermanentCoroutine: SelectPermanentCoroutine,
  105. afterSelectPermanentCoroutine: null,
  106. mode: SelectPermanentEffect.Mode.Custom,
  107. cardEffect: activateClass);
  108. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will get unable to suspend.", "The opponent is selecting 1 Digimon or Tamer that will get unable to suspend.");
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  111. {
  112. Permanent selectedPermanent = permanent;
  113. if (selectedPermanent != null)
  114. {
  115. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  116. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  117. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  118. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  119. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  122. }
  123. bool CanUseCondition1(Hashtable hashtable)
  124. {
  125. return selectedPermanent.TopCard != null
  126. && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  127. }
  128. bool PermanentCondition(Permanent permanent)
  129. {
  130. return permanent == selectedPermanent;
  131. }
  132. }
  133. }
  134. }
  135. #endregion
  136. #region When Attacking
  137. if (timing == EffectTiming.OnAllyAttack)
  138. {
  139. ActivateClass activateClass = new ActivateClass();
  140. activateClass.SetUpICardEffect("May digivolve into [Garurumon] in name/[NSo]/[VB] trait in trash for 2 less", CanUseCondition, card);
  141. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  142. activateClass.SetIsSkippable(true);
  143. cardEffects.Add(activateClass);
  144. string EffectDescription()
  145. => "[When Attacking] If this Digimon's stack has 2 or more same-level cards, it may digivolve into a Digimon card with [Garurumon] in its name or the [NSo] or [VB] trait in the trash with the cost reduced by 2.";
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  149. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  150. }
  151. bool CanActivateCondition(Hashtable hashtable)
  152. {
  153. return CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass)
  154. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition)
  155. && SameLevelSourcesCondition(hashtable);
  156. }
  157. bool CanSelectCardCondition(CardSource cardSource)
  158. {
  159. return cardSource.ContainsCardName("Garurumon")
  160. || cardSource.EqualsTraits("NSo")
  161. || cardSource.EqualsTraits("VB");
  162. }
  163. bool SameLevelSourcesCondition(Hashtable hashtable)
  164. {
  165. return (card.PermanentOfThisCard().StackCards
  166. .Filter(x => !x.IsFlipped)
  167. .GroupBy(x => x.Level)
  168. .Any(g => g.Count() >= 2));
  169. }
  170. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  171. {
  172. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  173. card.PermanentOfThisCard(),
  174. digivolvingCard => CanSelectCardCondition(digivolvingCard),
  175. payCost: true,
  176. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  177. fixedCostTuple: null,
  178. ignoreDigivolutionRequirementFixedCost: -1,
  179. isHand: false,
  180. activateClass: activateClass,
  181. successProcess: null
  182. ));
  183. }
  184. }
  185. #endregion
  186. #region Inherited
  187. if (timing == EffectTiming.WhenRemoveField)
  188. {
  189. bool SourceCondition(CardSource cardSource)
  190. {
  191. return cardSource.IsDigimon
  192. && cardSource.HasLevel
  193. && cardSource.Level <= 4
  194. && (cardSource.ContainsCardName("Gabumon")
  195. || cardSource.ContainsCardName("Garurumon")
  196. || cardSource.EqualsTraits("NSo")
  197. || cardSource.EqualsTraits("VB"));
  198. }
  199. string[] decodeStrings = { "(Lv.4 or lower w/[Gabumon]/[Garurumon] in name or w/[NSo]/[VB] trait)", "Level 4 or lower Digimon card with [Gabumon]/[Garurumon] in name or [NSo]/[VB] trait" };
  200. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: true, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  201. }
  202. #endregion
  203. return cardEffects;
  204. }
  205. }
  206. }