BT25_050.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Kiwimon
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_050 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent) => targetPermanent.TopCard.HasTSTraits;
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 2,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null,
  23. level: 3));
  24. }
  25. #endregion
  26. #region Shared OP / WD
  27. string SharedEffectName = "May suspend 1 digimon, then if 2 or more suspended, 1 opponent digimon gains cannot unsuspend";
  28. string SharedEffectDescription(string tag) => $"[{tag}] You may suspend 1 Digimon. Then, if there are 2 or more suspended Digimon, 1 of your opponent's Digimon can't unsuspend until their turn ends.";
  29. CardEffectFactory.ActivateClassesForSharedEffects
  30. (ref cardEffects, timing, card,
  31. SharedEffectName,
  32. SharedActivateCoroutine,
  33. SharedEffectDescription,
  34. optional: false,
  35. onPlay: true,
  36. whenDigivolving: true);
  37. bool CanSuspendPermamentCondition(Permanent permanent)
  38. => CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  39. bool SuspendedDigimon(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
  42. && permanent.IsSuspended;
  43. }
  44. bool CanSelectPermamentCondition(Permanent permanent)
  45. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  46. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  47. {
  48. if (CardEffectCommons.HasMatchConditionPermanent(CanSuspendPermamentCondition))
  49. {
  50. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  51. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSuspendPermamentCondition));
  52. selectPermanentEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: CanSuspendPermamentCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: maxCount,
  58. canNoSelect: true,
  59. canEndNotMax: false,
  60. selectPermanentCoroutine: null,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Tap,
  63. cardEffect: activateClass);
  64. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to Suspend.", "The opponent is selecting 1 Digimon to Suspend.");
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  66. }
  67. if (CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon) >= 2 && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermamentCondition))
  68. {
  69. Permanent selectedPermanent = null;
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermamentCondition));
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermamentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: SelectPermanentCoroutine,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  85. {
  86. selectedPermanent = permanent;
  87. yield return null;
  88. }
  89. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain cannot suspend.", "The opponent is selecting 1 Digimon to gain cannot suspend.");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
  92. targetPermanent: selectedPermanent,
  93. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  94. activateClass: activateClass,
  95. condition: null,
  96. effectName: "Cannot unsuspend until the end of your turn"));
  97. }
  98. }
  99. #endregion
  100. #region ESS
  101. if (timing == EffectTiming.None)
  102. {
  103. bool Condition()
  104. => CardEffectCommons.IsExistOnBattleArea(card)
  105. && CardEffectCommons.IsOwnerTurn(card);
  106. bool PermanentCondition(Permanent permanent)
  107. => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  108. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  109. permanentCondition: PermanentCondition,
  110. changeValue: 1000,
  111. isInheritedEffect: true,
  112. card: card,
  113. condition: Condition,
  114. effectName: () => "Your Digimon gain DP +1000"));
  115. }
  116. #endregion
  117. return cardEffects;
  118. }
  119. }
  120. }