ST22_09.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //High-Speed Plug-In H
  5. namespace DCGO.CardEffects.ST22
  6. {
  7. public class ST22_09 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Ignore Color Requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  17. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  18. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  19. cardEffects.Add(ignoreColorConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer);
  23. }
  24. bool CardCondition(CardSource cardSource)
  25. {
  26. return cardSource == card;
  27. }
  28. }
  29. #endregion
  30. #region Link Condition
  31. if (timing == EffectTiming.None)
  32. {
  33. static bool PermanentCondition(Permanent targetPermanent)
  34. {
  35. return targetPermanent.TopCard.HasLevel && targetPermanent.Level >= 3;
  36. }
  37. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  38. }
  39. #endregion
  40. #region Link
  41. if (timing == EffectTiming.OnDeclaration)
  42. {
  43. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  44. }
  45. #endregion
  46. #endregion
  47. #region Security
  48. if (timing == EffectTiming.SecuritySkill)
  49. {
  50. ActivateClass activateClass = new ActivateClass();
  51. activateClass.SetUpICardEffect("Delete opponent's lowest DP Digimon and add this card to hand", CanUseCondition, card);
  52. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  53. activateClass.SetIsSecurityEffect(true);
  54. cardEffects.Add(activateClass);
  55. string EffectDiscription()
  56. => "[Security] Until your turn ends, 1 of your opponent's Digimon or Tamers can't suspend. Then, add this card to the hand.";
  57. bool CanUseCondition(Hashtable hashtable)
  58. {
  59. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  60. }
  61. bool CanSelectPermanentCondition(Permanent permanent)
  62. {
  63. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  64. && (permanent.IsTamer || permanent.IsDigimon);
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  69. {
  70. Permanent selectedPermanent = null;
  71. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectPermanentCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: maxCount,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: SelectPermanentCoroutine,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Custom,
  84. cardEffect: activateClass);
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. selectedPermanent = permanent;
  88. yield return null;
  89. }
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotSuspend(
  92. targetPermanent: selectedPermanent,
  93. effectDuration: EffectDuration.UntilOwnerTurnEnd,
  94. activateClass: activateClass,
  95. condition: null,
  96. effectName: "Can not suspend"));
  97. }
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  99. }
  100. }
  101. #endregion
  102. #region Main
  103. if (timing == EffectTiming.OptionSkill)
  104. {
  105. ActivateClass activateClass = new ActivateClass();
  106. activateClass.SetUpICardEffect("You may link this to 1 digimon. Then, 1 opponent digimon or tamers cant suspend until their turn ends", CanUseCondition, card);
  107. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  108. cardEffects.Add(activateClass);
  109. string EffectDiscription()
  110. => "[Main] You may link this card to 1 of your Digimon without paying the cost. Then, 1 of your opponent's Digimon or Tamers can't suspend until their turn ends.";
  111. bool CanUseCondition(Hashtable hashtable)
  112. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  113. bool CanSelectPermanentCondition(Permanent permanent)
  114. {
  115. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  116. card.CanLinkToTargetPermanent(permanent, false);
  117. }
  118. bool CanSelectOpponentPermamentCondition(Permanent permanent)
  119. {
  120. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  121. && (permanent.IsTamer || permanent.IsDigimon);
  122. }
  123. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  124. {
  125. #region Select Digimon To Link
  126. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  127. {
  128. Permanent selectedPermanent = null;
  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: true,
  137. canEndNotMax: false,
  138. selectPermanentCoroutine: SelectPermanentCoroutine,
  139. afterSelectPermanentCoroutine: null,
  140. mode: SelectPermanentEffect.Mode.Custom,
  141. cardEffect: activateClass);
  142. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to link.", "The opponent is selecting 1 Digimon to link.");
  143. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  144. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  145. {
  146. selectedPermanent = permanent;
  147. yield return null;
  148. }
  149. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddLinkCard(card, activateClass));
  150. }
  151. #endregion
  152. #region Freeze Digimon or Tamer
  153. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentPermamentCondition))
  154. {
  155. Permanent selectedPermanent = null;
  156. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermamentCondition));
  157. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  158. selectPermanentEffect.SetUp(
  159. selectPlayer: card.Owner,
  160. canTargetCondition: CanSelectOpponentPermamentCondition,
  161. canTargetCondition_ByPreSelecetedList: null,
  162. canEndSelectCondition: null,
  163. maxCount: maxCount,
  164. canNoSelect: false,
  165. canEndNotMax: false,
  166. selectPermanentCoroutine: SelectPermanentCoroutine,
  167. afterSelectPermanentCoroutine: null,
  168. mode: SelectPermanentEffect.Mode.Custom,
  169. cardEffect: activateClass);
  170. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  171. {
  172. selectedPermanent = permanent;
  173. yield return null;
  174. }
  175. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  176. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotSuspend(
  177. targetPermanent: selectedPermanent,
  178. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  179. activateClass: activateClass,
  180. condition: null,
  181. effectName: "Can not suspend"));
  182. }
  183. #endregion
  184. }
  185. }
  186. #endregion
  187. #region Link ESS
  188. if (timing == EffectTiming.None)
  189. {
  190. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: false, card: card, condition: null, isLinkedEffect: true));
  191. }
  192. #endregion
  193. return cardEffects;
  194. }
  195. }
  196. }