ST24_11.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Rosemon
  6. namespace DCGO.CardEffects.ST24
  7. {
  8. public class ST24_11 : 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 Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsCardName("Lilamon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. if (timing == EffectTiming.None)
  23. {
  24. static bool PermanentCondition(Permanent targetPermanent)
  25. {
  26. return targetPermanent.TopCard.EqualsTraits("DATA SQUAD");
  27. }
  28. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 5, permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  29. }
  30. #endregion
  31. #region Shared WD/WA
  32. string SharedEffectName = "May suspend up to 2 enemy Digimon or Tamers, then may trash bottom face-down card from your Tamer so enemy Digimon cannot unsuspend until their turn ends";
  33. string SharedEffectHash = "ST24_11_SharedEffect";
  34. CardEffectFactory.ActivateClassesForSharedEffects
  35. (ref cardEffects, timing, card,
  36. SharedEffectName,
  37. SharedActivateCoroutine,
  38. SharedEffectDescription,
  39. optional: false,
  40. maxCountPerTurn: 1,
  41. hashValue: SharedEffectHash,
  42. whenDigivolving: true,
  43. whenAttacking: true);
  44. string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] You may suspend up to 2 of your opponent's Digimon or Tamers. Then, by trashing the bottom face-down card from under any of your Tamers, none of their Digimon can unsuspend until their turn ends.";
  45. bool TamerWithOneFaceDownSource(Permanent permanent)
  46. {
  47. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card)
  48. && permanent.DigivolutionCards.Any(CanSelectTrashSourceCardCondition);
  49. }
  50. bool CanSelectTrashSourceCardCondition(CardSource cardSource)
  51. {
  52. return cardSource.IsFlipped;
  53. }
  54. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  55. {
  56. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  57. && (permanent.IsDigimon
  58. || permanent.IsTamer);
  59. }
  60. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  63. {
  64. int maxCount = Math.Min(2,
  65. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectOpponentPermanentCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: true,
  74. canEndNotMax: true,
  75. selectPermanentCoroutine: null,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Tap,
  78. cardEffect: activateClass);
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. }
  81. bool trashed = false;
  82. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  83. selectPermanentEffect1.SetUp(
  84. selectPlayer: card.Owner,
  85. canTargetCondition: TamerWithOneFaceDownSource,
  86. canTargetCondition_ByPreSelecetedList: null,
  87. canEndSelectCondition: null,
  88. maxCount: 1,
  89. canNoSelect: true,
  90. canEndNotMax: true,
  91. selectPermanentCoroutine: null,
  92. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  93. mode: SelectPermanentEffect.Mode.Custom,
  94. cardEffect: activateClass);
  95. selectPermanentEffect1.SetUpCustomMessage("Select 1 Tamer to trash 1 bottom face-down card from", "The opponent is selecting 1 Tamer to trash 1 bottom face-down card from");
  96. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  97. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  98. {
  99. if (permanents.Count == 1)
  100. {
  101. trashed = true;
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: permanents[0], trashCount: 1, isFromTop: false, activateClass: activateClass, CanSelectTrashSourceCardCondition));
  103. }
  104. }
  105. if (trashed)
  106. {
  107. bool PermanentCondition(Permanent permanent)
  108. {
  109. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  110. && !permanent.TopCard.CanNotBeAffected(activateClass);
  111. }
  112. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  113. permanentCondition: PermanentCondition,
  114. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  115. activateClass: activateClass,
  116. isOnlyActivePhase: false,
  117. effectName: "Your Digimon can't unsuspend"));
  118. }
  119. }
  120. #endregion
  121. #region Shared All Turns
  122. string SharedEffectName1 = "Trash your opponent's top security card";
  123. string SharedHashString = "ST24_11_AT";
  124. string SharedEffectDescription1() => "[All Turns] [Once Per Turn] When any of your opponent's Digimon or Tamers suspend, or effects trash cards from under your Tamers, trash your opponent's top security card.";
  125. bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleArea(card);
  126. IEnumerator SharedActivateCoroutine1(Hashtable hashtable, ActivateClass activateClass)
  127. {
  128. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  129. player: card.Owner.Enemy,
  130. destroySecurityCount: 1,
  131. cardEffect: activateClass,
  132. fromTop: true).DestroySecurity());
  133. }
  134. #endregion
  135. #region All turns Trigger - On Suspend
  136. if (timing == EffectTiming.OnTappedAnyone)
  137. {
  138. ActivateClass activateClass = new();
  139. activateClass.SetUpICardEffect(SharedEffectName1, CanUseCondition, card);
  140. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine1(hash, activateClass), 1, false, SharedEffectDescription1());
  141. activateClass.SetHashString(SharedHashString);
  142. cardEffects.Add(activateClass);
  143. bool CanUseCondition(Hashtable hashtable)
  144. {
  145. return CardEffectCommons.IsExistOnBattleArea(card)
  146. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition);
  147. }
  148. bool PermanentCondition(Permanent permanent)
  149. {
  150. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  151. && (permanent.IsDigimon
  152. || permanent.IsTamer);
  153. }
  154. }
  155. #endregion
  156. #region All Turns Trigger - On Trashed
  157. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  158. {
  159. ActivateClass activateClass = new();
  160. activateClass.SetUpICardEffect(SharedEffectName1, CanUseCondition, card);
  161. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine1(hash, activateClass), 1, false, SharedEffectDescription1());
  162. activateClass.SetHashString(SharedHashString);
  163. cardEffects.Add(activateClass);
  164. bool CanUseCondition(Hashtable hashtable)
  165. {
  166. return CardEffectCommons.IsExistOnBattleArea(card)
  167. && CardEffectCommons.CanTriggerOnTrashDigivolutionCard(hashtable, PermanentCondition, cardEffect => cardEffect != null, cardSource => true);
  168. }
  169. bool PermanentCondition(Permanent permanent)
  170. {
  171. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card);
  172. }
  173. }
  174. #endregion
  175. return cardEffects;
  176. }
  177. }
  178. }