BT25_053.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Aegiochusmon: Green
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_053 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternative Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsCardName("Aegiomon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card, null));
  21. }
  22. #endregion
  23. #region Vortex
  24. if (timing == EffectTiming.OnEndTurn)
  25. {
  26. cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card, condition: null));
  27. }
  28. #endregion
  29. #region Decode <[Aegiomon]>
  30. if (timing == EffectTiming.WhenRemoveField)
  31. {
  32. bool SourceCondition(CardSource source)
  33. {
  34. return source.EqualsCardName("Aegiomon");
  35. }
  36. string[] decodeStrings = { "(Aegiomon)", "Aegiomon" };
  37. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  38. }
  39. #endregion
  40. #region Shared OP / WD
  41. string SharedEffectName = "Suspend 1 opponent digimon or tamer, freeze until opponent turn ends. Then if 3 or less security, this gains Piercing & 5K DP";
  42. string SharedEffectDescription(string tag) => $"[{tag}] Suspend 1 of your opponent's Digimon or Tamers. It can't unsuspend until their turn ends. Then, if you have 3 or fewer security cards, this Digimon gains <Piercing> and +5000 DP for the turn.";
  43. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  44. {
  45. bool PermanentCondition(Permanent permanent)
  46. {
  47. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  48. && (permanent.IsDigimon || permanent.IsTamer);
  49. }
  50. // Suspend 1 opponent digimon or tamer, freeze until opponent turn ends.
  51. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  52. {
  53. Permanent selectedPermanent = null;
  54. #region Select 1 opponent digimon or tamer
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: PermanentCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: SelectPermanentCoroutine,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  69. {
  70. selectedPermanent = permanent;
  71. yield return null;
  72. }
  73. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or tamer to suspend and freeze until opponent turn ends.", "The opponent is selecting 1 Digimon or tamer to suspend and freeze until your turn ends.");
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. #endregion
  76. if (selectedPermanent != null)
  77. {
  78. #region Suspend and Freeze
  79. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent }, hashtable).Tap());
  82. }
  83. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(selectedPermanent, EffectDuration.UntilOpponentTurnEnd, activateClass, null, "Can not unsuspend"));
  84. #endregion
  85. }
  86. }
  87. // if 3 or less security, this gains Piercing & 5K DP
  88. if (card.Owner.SecurityCards.Count <= 3)
  89. {
  90. Permanent thisPermanent = card.PermanentOfThisCard();
  91. #region Gain Piercing & +5K DP
  92. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(thisPermanent, EffectDuration.UntilEachTurnEnd, activateClass));
  93. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(thisPermanent, 5000, EffectDuration.UntilEachTurnEnd, activateClass));
  94. #endregion
  95. }
  96. }
  97. CardEffectFactory.ActivateClassesForSharedEffects
  98. (ref cardEffects, timing, card,
  99. SharedEffectName,
  100. SharedActivateCoroutine,
  101. SharedEffectDescription,
  102. optional: false,
  103. maxCountPerTurn: -1,
  104. onPlay: true,
  105. whenDigivolving: true);
  106. #endregion
  107. #region Inherit All Turns - OPT
  108. if (timing == EffectTiming.OnLoseSecurity)
  109. {
  110. ActivateClass activateClass = new ActivateClass();
  111. activateClass.SetUpICardEffect("Suspend 1 Opponent Digimon or Tamer", CanUseCondition, card);
  112. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  113. activateClass.SetHashString("BT25_053_AT");
  114. activateClass.SetIsSkippable(true);
  115. activateClass.SetIsInheritedEffect(true);
  116. cardEffects.Add(activateClass);
  117. string EffectDiscription()
  118. {
  119. return "When your security stack is removed from, you may suspend 1 of your opponent's Digimon or Tamers.";
  120. }
  121. bool CanUseCondition(Hashtable hashtable)
  122. {
  123. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  124. && CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, IsYourSecurity);
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  129. }
  130. bool IsYourSecurity(Player player)
  131. {
  132. return player == card.Owner;
  133. }
  134. bool PermanentCondition(Permanent permanent)
  135. {
  136. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  137. && (permanent.IsDigimon || permanent.IsTamer);
  138. }
  139. IEnumerator ActivateCoroutine(Hashtable hashtable)
  140. {
  141. bool hasUsed = false;
  142. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition))
  143. {
  144. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, PermanentCondition));
  145. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  146. selectPermanentEffect.SetUp(
  147. selectPlayer: card.Owner,
  148. canTargetCondition: PermanentCondition,
  149. canTargetCondition_ByPreSelecetedList: null,
  150. canEndSelectCondition: null,
  151. maxCount: maxCount,
  152. canNoSelect: true,
  153. canEndNotMax: false,
  154. selectPermanentCoroutine: null,
  155. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  156. mode: SelectPermanentEffect.Mode.Tap,
  157. cardEffect: activateClass);
  158. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or tamer to suspend.", "The opponent is selecting 1 Digimon or tamer to suspend.");
  159. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  160. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  161. {
  162. if (permanents.Any()) hasUsed = true;
  163. yield return null;
  164. }
  165. }
  166. if (!hasUsed) activateClass.RemoveUse();
  167. }
  168. }
  169. #endregion
  170. return cardEffects;
  171. }
  172. }
  173. }