EX12_044.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Angewomon
  5. namespace DCGO.CardEffects.EX12
  6. {
  7. public class EX12_044 : 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.EqualsTraits("NSp")
  18. || targetPermanent.TopCard.EqualsTraits("VB");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null,
  26. level: 4)
  27. );
  28. }
  29. #endregion
  30. #region DNA Digivolution
  31. if (timing == EffectTiming.None)
  32. {
  33. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  34. addJogressConditionClass.SetUpICardEffect("DNA Digivolution", CanUseCondition, card);
  35. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  36. addJogressConditionClass.SetNotShowUI(true);
  37. cardEffects.Add(addJogressConditionClass);
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return true;
  41. }
  42. JogressCondition GetJogress(CardSource cardSource)
  43. {
  44. if (cardSource == card)
  45. {
  46. bool PermanentCondition1(Permanent permanent)
  47. {
  48. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  49. && (permanent.TopCard.CardColors.Contains(CardColor.Yellow)
  50. || permanent.TopCard.CardColors.Contains(CardColor.Blue))
  51. && permanent.Levels_ForJogress(card).Contains(4);
  52. }
  53. bool PermanentCondition2(Permanent permanent)
  54. {
  55. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  56. && (permanent.TopCard.CardColors.Contains(CardColor.Green)
  57. || permanent.TopCard.CardColors.Contains(CardColor.Black))
  58. && permanent.Levels_ForJogress(card).Contains(4);
  59. }
  60. JogressConditionElement[] elements = new JogressConditionElement[]
  61. {
  62. new JogressConditionElement(PermanentCondition1, "a level 4 Yellow or Blue Digimon"),
  63. new JogressConditionElement(PermanentCondition2, "a level 4 Green or Black Digimon"),
  64. };
  65. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  66. return jogressCondition;
  67. }
  68. return null;
  69. }
  70. }
  71. #endregion
  72. #region Shared OP/WD/WA
  73. string SharedEffectName = "1 enemy Digimon gets -4K DP for turn";
  74. CardEffectFactory.ActivateClassesForSharedEffects
  75. (ref cardEffects, timing, card,
  76. SharedEffectName,
  77. SharedActivateCoroutine,
  78. SharedEffectDescription,
  79. optional: false,
  80. onPlay: true,
  81. whenDigivolving: true,
  82. whenAttacking: true);
  83. string SharedEffectDescription(string tag)
  84. {
  85. return $"[{tag}] 1 of your opponent's Digimon gets -4000 DP for the turn.";
  86. }
  87. bool CanSelectPermanentCondition(Permanent permanent)
  88. {
  89. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  90. }
  91. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  92. {
  93. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  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: SelectPermanent,
  105. afterSelectPermanentCoroutine: null,
  106. mode: SelectPermanentEffect.Mode.Custom,
  107. cardEffect: activateClass);
  108. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  109. }
  110. IEnumerator SelectPermanent(Permanent permanent)
  111. {
  112. if (permanent != null)
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  115. permanent,
  116. -4000,
  117. EffectDuration.UntilEachTurnEnd,
  118. activateClass));
  119. }
  120. }
  121. }
  122. #endregion
  123. #region When Attacking
  124. if (timing == EffectTiming.OnAllyAttack)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect("May digivolve into [Angel]/[Holy Angel]/[Three Great Angels]/[NSp]/[VB] trait in hand for 2 less", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  129. activateClass.SetIsSkippable(true);
  130. cardEffects.Add(activateClass);
  131. string EffectDescription()
  132. => "[When Attacking] If this Digimon's stack has 2 or more same-level cards, it may digivolve into an [Angel], [Holy Dragon], [Three Great Angels], [NSp] or [VB] trait Digimon card in the hand with the cost reduced by 2.";
  133. bool CanUseCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  136. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  137. }
  138. bool CanActivateCondition(Hashtable hashtable)
  139. {
  140. return CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass)
  141. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition)
  142. && SameLevelSourcesCondition(hashtable);
  143. }
  144. bool CanSelectCardCondition(CardSource cardSource)
  145. {
  146. return cardSource.EqualsTraits("Angel")
  147. || cardSource.EqualsTraits("Holy Dragon")
  148. || cardSource.EqualsTraits("Three Great Angels")
  149. || cardSource.EqualsTraits("NSp")
  150. || cardSource.EqualsTraits("VB");
  151. }
  152. bool SameLevelSourcesCondition(Hashtable hashtable)
  153. {
  154. return (card.PermanentOfThisCard().StackCards
  155. .Filter(x => !x.IsFlipped)
  156. .GroupBy(x => x.Level)
  157. .Any(g => g.Count() >= 2));
  158. }
  159. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  160. {
  161. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  162. card.PermanentOfThisCard(),
  163. digivolvingCard => CanSelectCardCondition(digivolvingCard),
  164. payCost: true,
  165. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  166. fixedCostTuple: null,
  167. ignoreDigivolutionRequirementFixedCost: -1,
  168. isHand: true,
  169. activateClass: activateClass,
  170. successProcess: null
  171. ));
  172. }
  173. }
  174. #endregion
  175. #region Inherited
  176. if (timing == EffectTiming.WhenRemoveField)
  177. {
  178. bool SourceCondition(CardSource cardSource)
  179. {
  180. return cardSource.IsDigimon
  181. && cardSource.HasLevel
  182. && cardSource.Level <= 4
  183. && (cardSource.EqualsTraits("Holy Beast")
  184. || cardSource.EqualsTraits("NSp")
  185. || cardSource.EqualsTraits("VB"));
  186. }
  187. string[] decodeStrings = { "(Lv.4 or lower w/[Holy Beast]/[NSp]/[VB] trait)", "Level 4 or lower Digimon card with [Holy Beast]/[NSp]/[VB] trait" };
  188. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: true, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  189. }
  190. #endregion
  191. return cardEffects;
  192. }
  193. }
  194. }