ST2_14.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 ST2_14 : 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] Choose 1 of your opponent's Digimon with no digivolution cards. That Digimon can't attack or block until the end of your opponent's next turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.HasNoDigivolutionCards)
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  39. {
  40. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  41. {
  42. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  43. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  44. selectPermanentEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: CanSelectPermanentCondition,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: maxCount,
  50. canNoSelect: false,
  51. canEndNotMax: false,
  52. selectPermanentCoroutine: SelectPermanentCoroutine,
  53. afterSelectPermanentCoroutine: null,
  54. mode: SelectPermanentEffect.Mode.Custom,
  55. cardEffect: activateClass);
  56. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  58. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  61. targetPermanent: permanent,
  62. defenderCondition: null,
  63. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  64. activateClass: activateClass,
  65. effectName: "Can't Attack"));
  66. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBlock(
  67. targetPermanent: permanent,
  68. attackerCondition: null,
  69. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  70. activateClass: activateClass,
  71. effectName: "Can't Block"));
  72. }
  73. }
  74. }
  75. }
  76. if (timing == EffectTiming.SecuritySkill)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect($"Opponent's 1 Digimon can't Attack or Block", CanUseCondition, card);
  80. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  81. activateClass.SetIsSecurityEffect(true);
  82. cardEffects.Add(activateClass);
  83. string EffectDiscription()
  84. {
  85. return "[Security] Choose 1 of your opponent's Digimon with no digivolution cards. That Digimon can't attack or block until the end of your next turn.";
  86. }
  87. bool CanSelectPermanentCondition(Permanent permanent)
  88. {
  89. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  90. {
  91. if (permanent.HasNoDigivolutionCards)
  92. {
  93. return true;
  94. }
  95. }
  96. return false;
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  101. }
  102. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  103. {
  104. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  105. {
  106. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  107. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  108. selectPermanentEffect.SetUp(
  109. selectPlayer: card.Owner,
  110. canTargetCondition: CanSelectPermanentCondition,
  111. canTargetCondition_ByPreSelecetedList: null,
  112. canEndSelectCondition: null,
  113. maxCount: maxCount,
  114. canNoSelect: false,
  115. canEndNotMax: false,
  116. selectPermanentCoroutine: SelectPermanentCoroutine,
  117. afterSelectPermanentCoroutine: null,
  118. mode: SelectPermanentEffect.Mode.Custom,
  119. cardEffect: activateClass);
  120. selectPermanentEffect.SetUpCustomMessage(
  121. "Select 1 Digimon that will get effects.",
  122. "The opponent is selecting 1 Digimon that will get effects.");
  123. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  124. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  127. targetPermanent: permanent,
  128. defenderCondition: null,
  129. effectDuration: EffectDuration.UntilOwnerTurnEnd,
  130. activateClass: activateClass,
  131. effectName: "Can't Attack"));
  132. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBlock(
  133. targetPermanent: permanent,
  134. attackerCondition: null,
  135. effectDuration: EffectDuration.UntilOwnerTurnEnd,
  136. activateClass: activateClass,
  137. effectName: "Can't Block"));
  138. }
  139. }
  140. }
  141. }
  142. return cardEffects;
  143. }
  144. }