BT21_049.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_049 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return (targetPermanent.TopCard.EqualsTraits("WG") && targetPermanent.TopCard.IsLevel3);
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region On Play
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[On Play] You may suspend 1 Digimon.";
  32. }
  33. bool PermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsExistOnBattleAreaDigimon(permanent.TopCard);
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  48. {
  49. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  50. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  51. selectPermanentEffect.SetUp(
  52. selectPlayer: card.Owner,
  53. canTargetCondition: PermanentCondition,
  54. canTargetCondition_ByPreSelecetedList: null,
  55. canEndSelectCondition: null,
  56. maxCount: maxCount,
  57. canNoSelect: true,
  58. canEndNotMax: false,
  59. selectPermanentCoroutine: null,
  60. afterSelectPermanentCoroutine: null,
  61. mode: SelectPermanentEffect.Mode.Tap,
  62. cardEffect: activateClass);
  63. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  64. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  65. }
  66. }
  67. }
  68. #endregion
  69. #region When Digivolving
  70. if (timing == EffectTiming.OnEnterFieldAnyone)
  71. {
  72. ActivateClass activateClass = new ActivateClass();
  73. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  74. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  75. cardEffects.Add(activateClass);
  76. string EffectDiscription()
  77. {
  78. return "[When Digivolving] You may suspend 1 Digimon.";
  79. }
  80. bool PermanentCondition(Permanent permanent)
  81. {
  82. return CardEffectCommons.IsExistOnBattleAreaDigimon(permanent.TopCard);
  83. }
  84. bool CanUseCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  87. }
  88. bool CanActivateCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable hashtable)
  93. {
  94. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  95. {
  96. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  97. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  98. selectPermanentEffect.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: PermanentCondition,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: maxCount,
  104. canNoSelect: true,
  105. canEndNotMax: false,
  106. selectPermanentCoroutine: null,
  107. afterSelectPermanentCoroutine: null,
  108. mode: SelectPermanentEffect.Mode.Tap,
  109. cardEffect: activateClass);
  110. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. }
  113. }
  114. }
  115. #endregion
  116. #region All Turns
  117. if (timing == EffectTiming.OnEnterFieldAnyone)
  118. {
  119. ActivateClass activateClass = new ActivateClass();
  120. activateClass.SetUpICardEffect("Suspend an opponent's Digimon", CanUseCondition, card);
  121. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  122. activateClass.SetHashString("Suspend_BT21_049");
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[All Turns][Once Per Turn] When any of your opponent's Digimon are played, if this Digimon is suspended, Suspend 1 of your opponent's Digimon.";
  127. }
  128. bool CanSelectPermanentCondition(Permanent permanent)
  129. {
  130. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  131. }
  132. bool CanUseCondition(Hashtable hashtable)
  133. {
  134. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  135. {
  136. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, CanSelectPermanentCondition))
  137. {
  138. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  139. {
  140. return true;
  141. }
  142. }
  143. }
  144. return false;
  145. }
  146. bool CanActivateCondition(Hashtable hashtable)
  147. {
  148. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  149. {
  150. if (card.PermanentOfThisCard().IsSuspended)
  151. {
  152. return true;
  153. }
  154. }
  155. return false;
  156. }
  157. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  158. {
  159. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  160. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  161. selectPermanentEffect.SetUp(
  162. selectPlayer: card.Owner,
  163. canTargetCondition: CanSelectPermanentCondition,
  164. canTargetCondition_ByPreSelecetedList: null,
  165. canEndSelectCondition: null,
  166. maxCount: maxCount,
  167. canNoSelect: false,
  168. canEndNotMax: false,
  169. selectPermanentCoroutine: null,
  170. afterSelectPermanentCoroutine: null,
  171. mode: SelectPermanentEffect.Mode.Tap,
  172. cardEffect: activateClass);
  173. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  174. }
  175. }
  176. #endregion
  177. #region Inherit
  178. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  179. {
  180. cardEffects.Add(CardEffectFactory.PierceSelfEffect(
  181. isInheritedEffect: true,
  182. card: card,
  183. condition: null));
  184. }
  185. #endregion
  186. return cardEffects;
  187. }
  188. }
  189. }