BT25_059.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. // Ceresmon
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_059 : 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. || permanent.TopCard.EqualsTraits("Vegetation");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, true, card, null, level: 5));
  22. }
  23. #endregion
  24. #region Shared Conditions
  25. bool IsSuspendedDigimon(Permanent permanent)
  26. {
  27. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
  28. && permanent.IsSuspended;
  29. }
  30. #endregion
  31. #region Reduce Play Cost
  32. if (timing == EffectTiming.None)
  33. {
  34. bool Condition()
  35. {
  36. return CardEffectCommons.MatchConditionPermanentCount(IsSuspendedDigimon) >= 2;
  37. }
  38. cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
  39. }
  40. #endregion
  41. #region Shared OP / WD
  42. string SharedEffectName = "You may suspend 2 digimon. Your suspended [Vegetation]/[TS] Digimon are immune to opponent's Digimon Effects until end of opponents turn";
  43. string SharedEffectDescription(string tag)
  44. => $"[{tag}] You may suspend up to 2 Digimon. Then, none of your suspended [Vegetation] or [TS] trait Digimon are affected by your opponent's Digimon effects until their turn ends.";
  45. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  46. {
  47. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon));
  48. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  49. selectPermanentEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: maxCount,
  55. canNoSelect: true,
  56. canEndNotMax: true,
  57. selectPermanentCoroutine: null,
  58. afterSelectPermanentCoroutine: null,
  59. mode: SelectPermanentEffect.Mode.Tap,
  60. cardEffect: activateClass);
  61. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  62. #region Effect Immunity
  63. bool CanUseCondition1(Hashtable hashtable)
  64. {
  65. return true;
  66. }
  67. bool CardCondition(CardSource cardSource)
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource)
  70. && cardSource.Owner == card.Owner
  71. && cardSource == cardSource.PermanentOfThisCard().TopCard
  72. && cardSource.PermanentOfThisCard().IsSuspended
  73. && (cardSource.HasTSTraits || cardSource.EqualsTraits("Vegetation"));
  74. }
  75. bool SkillCondition(ICardEffect cardEffect)
  76. {
  77. return CardEffectCommons.IsOpponentEffect(cardEffect, card)
  78. && cardEffect.IsDigimonEffect;
  79. }
  80. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  81. canNotAffectedClass.SetUpICardEffect("Not affected by opponent's Digimon's effects", CanUseCondition1, card);
  82. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  83. CardEffectCommons.AddEffectToPlayer(EffectDuration.UntilOpponentTurnEnd, card, canNotAffectedClass, EffectTiming.None);
  84. #endregion
  85. }
  86. CardEffectFactory.ActivateClassesForSharedEffects
  87. (ref cardEffects, timing, card,
  88. SharedEffectName,
  89. SharedActivateCoroutine,
  90. SharedEffectDescription,
  91. optional: false,
  92. onPlay: true,
  93. whenDigivolving: true);
  94. #endregion
  95. #region All turns
  96. if (timing == EffectTiming.OnTappedAnyone)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect("-3k to 1 enemy digimon per suspended digimon", CanUseCondition, card);
  100. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription1());
  101. activateClass.SetHashString("BT25_059_AT");
  102. cardEffects.Add(activateClass);
  103. string EffectDescription1()
  104. {
  105. return "[All Turns] [Once Per Turn] When any Digimon suspend, to 1 of your opponent's Digimon, give -3000 DP until their turn ends for each suspended Digimon.";
  106. }
  107. bool CanSelectPermanentCondition(Permanent permanent)
  108. {
  109. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  110. }
  111. bool CanTriggerPermanent(Permanent permanent)
  112. {
  113. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  118. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, CanTriggerPermanent);
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable hashtable)
  125. {
  126. int reduction = -3000 * CardEffectCommons.MatchConditionPermanentCount(IsSuspendedDigimon);
  127. if (reduction < 0 && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  128. {
  129. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  130. selectPermanentEffect.SetUp(
  131. selectPlayer: card.Owner,
  132. canTargetCondition: CanSelectPermanentCondition,
  133. canTargetCondition_ByPreSelecetedList: null,
  134. canEndSelectCondition: null,
  135. maxCount: 1,
  136. canNoSelect: false,
  137. canEndNotMax: false,
  138. selectPermanentCoroutine: SelectPermanentCoroutine,
  139. afterSelectPermanentCoroutine: null,
  140. mode: SelectPermanentEffect.Mode.Custom,
  141. cardEffect: activateClass);
  142. selectPermanentEffect.SetUpCustomMessage($"Choose a digimon to give {reduction} DP.", $"Opponent is choosing a digimon to give {reduction} DP.");
  143. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  144. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  145. {
  146. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  147. targetPermanent: permanent,
  148. changeValue: reduction,
  149. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  150. activateClass: activateClass));
  151. }
  152. }
  153. }
  154. }
  155. #endregion
  156. return cardEffects;
  157. }
  158. }
  159. }