ST15_16.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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 ST15_16 : 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] <De-Digivolve 3> 1 of your opponent's Digimon. Then, until the end of your opponent's turn, 1 of your opponent's Digimon gains \"[Start of Your Main Phase] This Digimon attacks.\"";
  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: SelectPermanentCoroutine,
  46. afterSelectPermanentCoroutine: null,
  47. mode: SelectPermanentEffect.Mode.Custom,
  48. cardEffect: activateClass);
  49. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  50. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  51. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  52. {
  53. Permanent selectedPermanent = permanent;
  54. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 3, activateClass).Degeneration());
  55. }
  56. }
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  58. {
  59. Permanent selectedPermanent = null;
  60. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectPermanentCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: maxCount,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: SelectPermanentCoroutine,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  76. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  77. {
  78. selectedPermanent = permanent;
  79. yield return null;
  80. }
  81. if (selectedPermanent != null)
  82. {
  83. ActivateClass activateClass1 = new ActivateClass();
  84. activateClass1.SetUpICardEffect("Attack with this Digimon", CanUseCondition1, selectedPermanent.TopCard);
  85. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  86. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  87. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  88. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  89. {
  90. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  91. }
  92. string EffectDiscription1()
  93. {
  94. return "[Start of Your Main Phase] Attack with this Digimon.";
  95. }
  96. bool CanUseCondition1(Hashtable hashtable1)
  97. {
  98. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  99. {
  100. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  101. {
  102. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner)
  103. {
  104. return true;
  105. }
  106. }
  107. }
  108. return false;
  109. }
  110. bool CanActivateCondition1(Hashtable hashtable1)
  111. {
  112. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  113. {
  114. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  115. {
  116. if (selectedPermanent.CanAttack(activateClass1))
  117. {
  118. return true;
  119. }
  120. }
  121. }
  122. return false;
  123. }
  124. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  125. {
  126. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  127. {
  128. if (selectedPermanent.CanAttack(activateClass1))
  129. {
  130. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  131. selectAttackEffect.SetUp(
  132. attacker: selectedPermanent,
  133. canAttackPlayerCondition: () => true,
  134. defenderCondition: (permanent) => true,
  135. cardEffect: activateClass1);
  136. selectAttackEffect.SetCanNotSelectNotAttack();
  137. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  138. }
  139. }
  140. }
  141. ICardEffect GetCardEffect(EffectTiming _timing)
  142. {
  143. if (_timing == EffectTiming.OnStartMainPhase)
  144. {
  145. return activateClass1;
  146. }
  147. return null;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. if (timing == EffectTiming.SecuritySkill)
  154. {
  155. ActivateClass activateClass = new ActivateClass();
  156. activateClass.SetUpICardEffect($"De-Digivolve 3 to 1 Digimon", CanUseCondition, card);
  157. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  158. activateClass.SetIsSecurityEffect(true);
  159. cardEffects.Add(activateClass);
  160. string EffectDiscription()
  161. {
  162. return "[Security] <De-Digivolve 3> 1 of your opponent's Digimon. (Trash up to 3 cards from the top. You can't trash past level 3 cards.)";
  163. }
  164. bool CanSelectPermanentCondition(Permanent permanent)
  165. {
  166. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  167. }
  168. bool CanUseCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  171. }
  172. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  173. {
  174. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  175. {
  176. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  177. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  178. selectPermanentEffect.SetUp(
  179. selectPlayer: card.Owner,
  180. canTargetCondition: CanSelectPermanentCondition,
  181. canTargetCondition_ByPreSelecetedList: null,
  182. canEndSelectCondition: null,
  183. maxCount: maxCount,
  184. canNoSelect: false,
  185. canEndNotMax: false,
  186. selectPermanentCoroutine: SelectPermanentCoroutine,
  187. afterSelectPermanentCoroutine: null,
  188. mode: SelectPermanentEffect.Mode.Custom,
  189. cardEffect: activateClass);
  190. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  191. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  192. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  193. {
  194. Permanent selectedPermanent = permanent;
  195. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 3, activateClass).Degeneration());
  196. }
  197. }
  198. }
  199. }
  200. return cardEffects;
  201. }
  202. }