BT23_092.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Ice Archery
  6. namespace DCGO.CardEffects.BT23
  7. {
  8. public class BT23_092 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Ignore Color Requirment
  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 HasAppmonTrait(Permanent permanent)
  21. {
  22. if (CardEffectCommons.IsOwnerPermanent(permanent, card))
  23. {
  24. if (permanent.TopCard.HasCSTraits)
  25. {
  26. if (permanent.IsDigimon || permanent.IsTamer)
  27. {
  28. return true;
  29. }
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.HasMatchConditionPermanent(HasAppmonTrait, true);
  37. }
  38. bool CardCondition(CardSource cardSource)
  39. {
  40. return cardSource == card;
  41. }
  42. }
  43. #endregion
  44. #region Main/YT/Security Shared
  45. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  46. {
  47. bool CanSelectDigimonCondition(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  50. }
  51. bool CanSelectTamerCondition(Permanent permanent)
  52. {
  53. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  54. && permanent.IsTamer;
  55. }
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimonCondition) || CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerCondition))
  57. {
  58. List<Permanent> selectedCards = new List<Permanent>();
  59. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  60. {
  61. selectedCards.Add(permanent);
  62. yield return null;
  63. }
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimonCondition))
  65. {
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigimonCondition));
  68. selectPermanentEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanSelectDigimonCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: SelectPermanentCoroutine,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Custom,
  79. cardEffect: activateClass);
  80. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to gain cant suspend", "Your opponent is choosing 1 digimon to gain cant suspend");
  81. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  82. }
  83. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerCondition))
  84. {
  85. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  86. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectTamerCondition));
  87. selectPermanentEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectTamerCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: maxCount,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: SelectPermanentCoroutine,
  96. afterSelectPermanentCoroutine: null,
  97. mode: SelectPermanentEffect.Mode.Custom,
  98. cardEffect: activateClass);
  99. selectPermanentEffect.SetUpCustomMessage("Select 1 tamer to gain cant suspend", "Your opponent is choosing 1 tamer to gain cant suspend");
  100. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  101. }
  102. if (selectedCards.Any())
  103. {
  104. foreach (var permament in selectedCards)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotSuspend(
  107. targetPermanent: permament,
  108. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  109. activateClass: activateClass,
  110. condition: null,
  111. effectName: "Can not suspend"));
  112. }
  113. }
  114. }
  115. }
  116. #endregion
  117. #region Main
  118. if (timing == EffectTiming.OptionSkill)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect("1 digimon and tamer cant suspend until their turn ends", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[Main] Until your opponent's turn ends, 1 of their Digimon and 1 of their Tamers can't suspend. Then, place this card in the battle area.";
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable hashtable)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  135. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  136. }
  137. }
  138. #endregion
  139. #region Your Turn - Delay
  140. if (timing == EffectTiming.OnAllyAttack)
  141. {
  142. ActivateClass activateClass = new ActivateClass();
  143. activateClass.SetUpICardEffect("1 digimon and tamer cant suspend until their turn ends", CanUseCondition, card);
  144. activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, true, EffectDiscription());
  145. cardEffects.Add(activateClass);
  146. string EffectDiscription()
  147. {
  148. return "[Your Turn] When one of your [CS] trait Digimon attacks <Delay>, Until your opponent's turn ends, 1 of their Digimon and 1 of their Tamers can't suspend.";
  149. }
  150. bool CanUseCondition(Hashtable hashtable)
  151. {
  152. return CardEffectCommons.IsExistOnBattleArea(card)
  153. && CardEffectCommons.CanDeclareOptionDelayEffect(card)
  154. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition);
  155. }
  156. bool CanActivateCondition(Hashtable hashtable)
  157. {
  158. return CardEffectCommons.IsExistOnBattleArea(card)
  159. && CardEffectCommons.IsOwnerTurn(card);
  160. }
  161. bool PermanentCondition(Permanent permanent)
  162. {
  163. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  164. && permanent.TopCard.HasCSTraits;
  165. }
  166. }
  167. #endregion
  168. #region Security
  169. if (timing == EffectTiming.SecuritySkill)
  170. {
  171. ActivateClass activateClass = new ActivateClass();
  172. activateClass.SetUpICardEffect("1 digimon and tamer cant suspend until their turn ends", CanUseCondition, card);
  173. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDiscription());
  174. cardEffects.Add(activateClass);
  175. string EffectDiscription()
  176. {
  177. return "[Security] Until your opponent's turn ends, 1 of their Digimon and 1 of their Tamers can't suspend. Then, place this card in the battle area.";
  178. }
  179. bool CanUseCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  182. }
  183. IEnumerator ActivateCoroutine(Hashtable hashtable)
  184. {
  185. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  186. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  187. }
  188. }
  189. #endregion
  190. return cardEffects;
  191. }
  192. }
  193. }