BT24_095.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Sonic Shot
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_095 : 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. => CardEffectCommons.HasMatchConditionPermanent((permanent) => permanent.TopCard.Owner == card.Owner && (permanent.IsTamer || permanent.IsDigimon) && permanent.TopCard.HasTSTraits, true);
  22. bool CardCondition(CardSource cardSource)
  23. => cardSource == card;
  24. }
  25. #endregion
  26. #region Link Condition
  27. if (timing == EffectTiming.None)
  28. {
  29. static bool PermanentCondition(Permanent targetPermanent)
  30. {
  31. return targetPermanent.IsDigimon && targetPermanent.TopCard.HasTSTraits;
  32. }
  33. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 3, card: card));
  34. }
  35. #endregion
  36. #region Link
  37. if (timing == EffectTiming.OnDeclaration)
  38. {
  39. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  40. }
  41. #endregion
  42. #endregion
  43. #region Security Effect
  44. if (timing == EffectTiming.SecuritySkill)
  45. {
  46. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  47. card: card,
  48. cardEffects: ref cardEffects,
  49. effectName: "Suspend 1 of opponent's Digimon or Tamers. It can't unsuspend in their next unsuspend phase. Then, you may link this card.");
  50. }
  51. #endregion
  52. #region Main
  53. if (timing == EffectTiming.OptionSkill)
  54. {
  55. ActivateClass activateClass = new ActivateClass();
  56. activateClass.SetUpICardEffect("Suspend 1 of opponent's Digimon or Tamers. It can't unsuspend in their next unsuspend phase. Then, you may link this card.", CanUseCondition, card);
  57. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  58. cardEffects.Add(activateClass);
  59. string EffectDescription()
  60. => "[Main] Suspend 1 of your opponent's Digimon or Tamers. It can't unsuspend in their next unsuspend phase. Then, you may link this card to 1 of your Digimon on the field without paying the cost.";
  61. bool CanUseCondition(Hashtable hashtable)
  62. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  63. bool CanSelectPermanentCondition(Permanent permanent)
  64. {
  65. return permanent.IsDigimon
  66. && CardEffectCommons.IsOwnerPermanent(permanent, card)
  67. && card.CanLinkToTargetPermanent(permanent, false, true);
  68. }
  69. bool CanSelectTargetCondition(Permanent permanent)
  70. {
  71. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) && (permanent.IsDigimon || permanent.IsTamer);
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable hashtable)
  74. {
  75. #region Suspend 1 opponent's digimon
  76. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTargetCondition))
  77. {
  78. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectTargetCondition));
  79. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectTargetCondition,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: maxCount,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: null,
  89. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  90. mode: SelectPermanentEffect.Mode.Tap,
  91. cardEffect: activateClass);
  92. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  93. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  94. {
  95. foreach (Permanent selectedPermanent in permanents)
  96. {
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  98. targetPermanent: selectedPermanent,
  99. activateClass: activateClass
  100. ));
  101. }
  102. yield return null;
  103. }
  104. }
  105. #endregion
  106. #region Select Digimon To Link
  107. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition, true))
  108. {
  109. Permanent selectedPermanent = null;
  110. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  111. selectPermanentEffect.SetUp(
  112. selectPlayer: card.Owner,
  113. canTargetCondition: CanSelectPermanentCondition,
  114. canTargetCondition_ByPreSelecetedList: null,
  115. canEndSelectCondition: null,
  116. maxCount: 1,
  117. canNoSelect: true,
  118. canEndNotMax: false,
  119. selectPermanentCoroutine: SelectPermanentCoroutine,
  120. afterSelectPermanentCoroutine: null,
  121. mode: SelectPermanentEffect.Mode.Custom,
  122. cardEffect: activateClass);
  123. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to link.", "The opponent is selecting 1 Digimon to link.");
  124. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  125. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  126. {
  127. selectedPermanent = permanent;
  128. yield return null;
  129. }
  130. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddLinkCard(card, activateClass));
  131. }
  132. #endregion
  133. }
  134. }
  135. #endregion
  136. #region Link ESS
  137. if (timing == EffectTiming.OnAllyAttack)
  138. {
  139. ActivateClass activateClass = new ActivateClass();
  140. activateClass.SetUpICardEffect("Bounce 1 opponent's suspended Digimon.", CanUseCondition, card);
  141. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  142. activateClass.SetIsLinkedEffect(true);
  143. activateClass.SetHashString("WA_BT24-095");
  144. cardEffects.Add(activateClass);
  145. string EffectDescription()
  146. {
  147. return "[When Attacking] [Once Per Turn] Return 1 of your opponent's suspended Digimon to the hand.";
  148. }
  149. bool CanUseCondition(Hashtable hashtable)
  150. {
  151. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  152. }
  153. bool CanSelectOpponentDigimon(Permanent permanent)
  154. {
  155. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  156. {
  157. return permanent.IsSuspended;
  158. }
  159. return false;
  160. }
  161. bool CanActivateCondition(Hashtable hashtable)
  162. {
  163. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  164. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentDigimon);
  165. }
  166. IEnumerator ActivateCoroutine(Hashtable hashtable)
  167. {
  168. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentDigimon));
  169. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  170. selectPermanentEffect.SetUp(
  171. selectPlayer: card.Owner,
  172. canTargetCondition: CanSelectOpponentDigimon,
  173. canTargetCondition_ByPreSelecetedList: null,
  174. canEndSelectCondition: null,
  175. maxCount: maxCount,
  176. canNoSelect: false,
  177. canEndNotMax: false,
  178. selectPermanentCoroutine: null,
  179. afterSelectPermanentCoroutine: null,
  180. mode: SelectPermanentEffect.Mode.Bounce,
  181. cardEffect: activateClass);
  182. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to bounce.", "The opponent is selecting a digimon to bounce.");
  183. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  184. }
  185. }
  186. #endregion
  187. return cardEffects;
  188. }
  189. }
  190. }