BT7_103.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT7_103 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Suspend 1 of your opponent's Digimon. That Digimon doesn't unsuspend during your opponent's next unsuspend phase.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  30. }
  31. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  32. {
  33. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  34. {
  35. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  36. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  37. selectPermanentEffect.SetUp(
  38. selectPlayer: card.Owner,
  39. canTargetCondition: CanSelectPermanentCondition,
  40. canTargetCondition_ByPreSelecetedList: null,
  41. canEndSelectCondition: null,
  42. maxCount: maxCount,
  43. canNoSelect: false,
  44. canEndNotMax: false,
  45. selectPermanentCoroutine: null,
  46. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  47. mode: SelectPermanentEffect.Mode.Tap,
  48. cardEffect: activateClass);
  49. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  50. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  51. {
  52. foreach (Permanent selectedPermanent in permanents)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  55. targetPermanent: selectedPermanent,
  56. activateClass: activateClass
  57. ));
  58. }
  59. }
  60. }
  61. }
  62. }
  63. if (timing == EffectTiming.SecuritySkill)
  64. {
  65. ActivateClass activateClass = new ActivateClass();
  66. activateClass.SetUpICardEffect($"Suspend 1 Digimon", CanUseCondition, card);
  67. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  68. activateClass.SetIsSecurityEffect(true);
  69. cardEffects.Add(activateClass);
  70. string EffectDiscription()
  71. {
  72. return "[Security] Suspend 1 of your opponent's Digimon.";
  73. }
  74. bool CanSelectPermanentCondition(Permanent permanent)
  75. {
  76. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  77. }
  78. bool CanUseCondition(Hashtable hashtable)
  79. {
  80. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  81. }
  82. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  83. {
  84. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  85. {
  86. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  87. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  88. selectPermanentEffect.SetUp(
  89. selectPlayer: card.Owner,
  90. canTargetCondition: CanSelectPermanentCondition,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. maxCount: maxCount,
  94. canNoSelect: false,
  95. canEndNotMax: false,
  96. selectPermanentCoroutine: null,
  97. afterSelectPermanentCoroutine: null,
  98. mode: SelectPermanentEffect.Mode.Tap,
  99. cardEffect: activateClass);
  100. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  101. }
  102. }
  103. }
  104. return cardEffects;
  105. }
  106. }