BT25_018.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. // Apollomon
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_018 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alt Digivolution
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent permanent)
  17. {
  18. return permanent.TopCard.HasTSTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, true, card, null, level: 5));
  21. }
  22. #endregion
  23. #region Reduce Play Cost
  24. if (timing == EffectTiming.None)
  25. {
  26. bool Condition()
  27. {
  28. return CardEffectCommons.HasMatchConditionOpponentsPermanent(card, Level6EnemyDigimon);
  29. }
  30. bool Level6EnemyDigimon(Permanent permanent)
  31. {
  32. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  33. && permanent.HasDP
  34. && permanent.DP >= 12000;
  35. }
  36. cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
  37. }
  38. #endregion
  39. #region Shared Condition and Deletion
  40. bool IsYourDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  41. bool CanDeleteCondition(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  44. && permanent.HasDP
  45. && permanent.DP < card.PermanentOfThisCard().DP;
  46. }
  47. IEnumerator DeleteWeakerDigimon(ActivateClass activateClass)
  48. {
  49. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanDeleteCondition))
  50. {
  51. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  52. selectPermanentEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: CanDeleteCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: 1,
  58. canNoSelect: false,
  59. canEndNotMax: false,
  60. selectPermanentCoroutine: null,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Destroy,
  63. cardEffect: activateClass);
  64. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  65. }
  66. }
  67. #endregion
  68. #region Shared OP / WD
  69. string SharedEffectName = "-2k for each of your Digimon to all opponent's digimon until end of the turn. Delete 1 enemy Digimon with equal or less DP than this digimon";
  70. string SharedEffectDescription(string tag)
  71. => $"[{tag}] For the turn, all of your opponent's Digimon get -2000 DP for each of your Digimon. Then, delete 1 of their Digimon with as much DP as this Digimon or less.";
  72. bool IsEnemyDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  73. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  74. {
  75. int reduction = -2000 * CardEffectCommons.MatchConditionPermanentCount(IsYourDigimon);
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  77. permanentCondition: IsEnemyDigimon,
  78. changeValue: reduction,
  79. effectDuration: EffectDuration.UntilEachTurnEnd,
  80. activateClass: activateClass));
  81. yield return ContinuousController.instance.StartCoroutine(DeleteWeakerDigimon(activateClass));
  82. }
  83. CardEffectFactory.ActivateClassesForSharedEffects
  84. (ref cardEffects, timing, card,
  85. SharedEffectName,
  86. SharedActivateCoroutine,
  87. SharedEffectDescription,
  88. optional: false,
  89. onPlay: true,
  90. whenDigivolving: true);
  91. #endregion
  92. #region End of your Turn
  93. if (timing == EffectTiming.OnEndTurn)
  94. {
  95. ActivateClass activateClass = new ActivateClass();
  96. activateClass.SetUpICardEffect("DNA digivolve into [GraceNovamon]. 1 of your Digimon may attack.", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  98. cardEffects.Add(activateClass);
  99. string EffectDescription()
  100. => "[End of Your Turn] 2 of your Digimon may DNA digivolve into [GraceNovamon] in the hand. Then, 1 of your Digimon may attack.";
  101. bool CanSelectDNACardCondition(CardSource cardSource)
  102. {
  103. return cardSource.IsDigimon
  104. && cardSource.CanPlayJogress(true)
  105. && cardSource.EqualsCardName("GraceNovamon");
  106. }
  107. bool CanUseCondition(Hashtable hashtable)
  108. {
  109. return CardEffectCommons.IsExistOnBattleArea(card)
  110. && CardEffectCommons.IsOwnerTurn(card);
  111. }
  112. bool CanActivateCondition(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.IsExistOnBattleArea(card);
  115. }
  116. bool YourDigimonThatCanAttack(Permanent permanent)
  117. {
  118. return IsYourDigimon(permanent)
  119. && permanent.CanAttack(activateClass);
  120. }
  121. IEnumerator ActivateCoroutine(Hashtable hashtable)
  122. {
  123. #region DNA digivolve
  124. yield return ContinuousController.instance.StartCoroutine(
  125. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  126. CanSelectDNACardCondition,
  127. payCost: true,
  128. isHand: true,
  129. activateClass
  130. ));
  131. #endregion
  132. #region May Attack
  133. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, YourDigimonThatCanAttack))
  134. {
  135. SelectPermanentEffect selectPermanentEffect =
  136. GManager.instance.GetComponent<SelectPermanentEffect>();
  137. selectPermanentEffect.SetUp(
  138. selectPlayer: card.Owner,
  139. canTargetCondition: YourDigimonThatCanAttack,
  140. canTargetCondition_ByPreSelecetedList: null,
  141. canEndSelectCondition: null,
  142. maxCount: 1,
  143. canNoSelect: true,
  144. canEndNotMax: false,
  145. selectPermanentCoroutine: null,
  146. afterSelectPermanentCoroutine: null,
  147. mode: SelectPermanentEffect.Mode.Attack,
  148. cardEffect: activateClass);
  149. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.",
  150. "The opponent is selecting 1 Digimon that will attack.");
  151. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  152. }
  153. #endregion
  154. }
  155. }
  156. #endregion
  157. #region When Attacking ESS
  158. if (timing == EffectTiming.OnAllyAttack)
  159. {
  160. ActivateClass activateClass = new ActivateClass();
  161. activateClass.SetUpICardEffect("Delete 1 enemy digimon with DP equal or less", CanUseCondition, card);
  162. activateClass.SetUpActivateClass(CanActivateCondition, _ => DeleteWeakerDigimon(activateClass), 1, false, EffectDescription());
  163. activateClass.SetIsInheritedEffect(true);
  164. activateClass.SetHashString("BT25_018_WA_ESS");
  165. cardEffects.Add(activateClass);
  166. string EffectDescription()
  167. => "[When Attacking] [Once Per Turn] Delete 1 of your opponent's Digimon with as much DP as this Digimon or less.";
  168. bool CanUseCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.IsExistOnBattleArea(card)
  171. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  172. }
  173. bool CanActivateCondition(Hashtable hashtable)
  174. {
  175. return CardEffectCommons.IsExistOnBattleArea(card);
  176. }
  177. }
  178. #endregion
  179. return cardEffects;
  180. }
  181. }
  182. }