ST17_08.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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. namespace DCGO.CardEffects.ST17
  9. {
  10. public class ST17_08 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. #region Digivolution Condition
  16. if (timing == EffectTiming.None)
  17. {
  18. bool PermanentCondition(Permanent targetPermanent)
  19. {
  20. return targetPermanent.TopCard.ContainsCardName("Rapidmon");
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  23. permanentCondition: PermanentCondition,
  24. digivolutionCost: 5,
  25. ignoreDigivolutionRequirement: true,
  26. card: card,
  27. condition: null));
  28. }
  29. #endregion
  30. #region Blocker and Reboot
  31. if (timing == EffectTiming.None)
  32. {
  33. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  34. }
  35. if (timing == EffectTiming.None)
  36. {
  37. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  38. }
  39. #endregion
  40. #region Counter Timing
  41. if (timing == EffectTiming.OnCounterTiming)
  42. {
  43. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  44. }
  45. #endregion
  46. #region When Digivolving
  47. if (timing == EffectTiming.OnEnterFieldAnyone)
  48. {
  49. ActivateClass activateClass = new ActivateClass();
  50. activateClass.SetUpICardEffect("Suspend Digimon and Tamers and give effects", CanUseCondition, card);
  51. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  52. activateClass.SetHashString("SuspendAndGiveEffects_ST17_08");
  53. cardEffects.Add(activateClass);
  54. string EffectDiscription()
  55. {
  56. return "[When Digivolving] Suspend 2 of your opponent's Digimon and/or Tamers. Then, 2 of your opponent's Digimon or Tamers can't unsuspend or digivolve until the end of your opponent's turn.";
  57. }
  58. bool CanSelectPermanentCondition(Permanent permanent)
  59. {
  60. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  61. {
  62. if (permanent.IsDigimon)
  63. {
  64. return true;
  65. }
  66. if (permanent.IsTamer)
  67. {
  68. return true;
  69. }
  70. }
  71. return false;
  72. }
  73. bool CanUseCondition(Hashtable hashtable)
  74. {
  75. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  76. }
  77. bool CanActivateCondition(Hashtable hashtable)
  78. {
  79. if (CardEffectCommons.IsExistOnBattleArea(card))
  80. {
  81. return true;
  82. }
  83. return false;
  84. }
  85. bool CanSelectPermanentCondition1(Permanent permanent)
  86. {
  87. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  88. {
  89. if (permanent.IsDigimon)
  90. {
  91. return true;
  92. }
  93. if (permanent.IsTamer)
  94. {
  95. return true;
  96. }
  97. }
  98. return false;
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  101. {
  102. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  103. {
  104. int maxCount = Math.Min(2, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  105. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  106. selectPermanentEffect.SetUp(
  107. selectPlayer: card.Owner,
  108. canTargetCondition: CanSelectPermanentCondition,
  109. canTargetCondition_ByPreSelecetedList: null,
  110. canEndSelectCondition: CanEndSelectCondition,
  111. maxCount: maxCount,
  112. canNoSelect: false,
  113. canEndNotMax: false,
  114. selectPermanentCoroutine: null,
  115. afterSelectPermanentCoroutine: null,
  116. mode: SelectPermanentEffect.Mode.Tap,
  117. cardEffect: activateClass);
  118. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  119. bool CanEndSelectCondition(List<Permanent> permanents)
  120. {
  121. if (CardEffectCommons.HasNoElement(permanents))
  122. {
  123. return false;
  124. }
  125. return true;
  126. }
  127. }
  128. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  129. {
  130. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  131. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  132. selectPermanentEffect.SetUp(
  133. selectPlayer: card.Owner,
  134. canTargetCondition: CanSelectPermanentCondition1,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. maxCount: maxCount,
  138. canNoSelect: false,
  139. canEndNotMax: false,
  140. selectPermanentCoroutine: SelectPermanentCoroutine,
  141. afterSelectPermanentCoroutine: null,
  142. mode: SelectPermanentEffect.Mode.Custom,
  143. cardEffect: activateClass);
  144. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon or Tamers that will not unsuspend or digivolve.", "The opponent is selecting 2 Digimon that will not unsuspend or digivolve.");
  145. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  146. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  147. {
  148. Permanent selectedPermanent = permanent;
  149. CanNotDigivolveClass canNotPutFieldClass = new CanNotDigivolveClass();
  150. canNotPutFieldClass.SetUpICardEffect("Can't Digivolve", CanUseCondition1, card);
  151. canNotPutFieldClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
  152. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  153. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().DebuffSE);
  154. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  155. bool CanUseCondition1(Hashtable hashtable)
  156. {
  157. return true;
  158. }
  159. bool PermanentCondition(Permanent permanent)
  160. {
  161. if (permanent == selectedPermanent)
  162. {
  163. if (permanent.TopCard != null)
  164. {
  165. if (permanent.IsDigimon || permanent.IsTamer)
  166. {
  167. if (!permanent.TopCard.CanNotBeAffected(canNotPutFieldClass))
  168. {
  169. return true;
  170. }
  171. }
  172. }
  173. }
  174. return false;
  175. }
  176. bool CardCondition(CardSource cardSource)
  177. {
  178. if (cardSource.Owner == card.Owner.Enemy)
  179. {
  180. if (cardSource.IsDigimon || cardSource.IsTamer)
  181. {
  182. if (!cardSource.CanNotBeAffected(canNotPutFieldClass))
  183. {
  184. return true;
  185. }
  186. }
  187. }
  188. return false;
  189. }
  190. ICardEffect GetCardEffect(EffectTiming _timing)
  191. {
  192. if (_timing == EffectTiming.None)
  193. {
  194. return canNotPutFieldClass;
  195. }
  196. return null;
  197. }
  198. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  199. targetPermanent: selectedPermanent,
  200. activateClass: activateClass
  201. ));
  202. }
  203. }
  204. }
  205. }
  206. if (timing == EffectTiming.OnEnterFieldAnyone)
  207. {
  208. ActivateClass activateClass = new ActivateClass();
  209. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  210. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  211. activateClass.SetHashString("Unsuspend_ST17_08");
  212. cardEffects.Add(activateClass);
  213. string EffectDiscription()
  214. {
  215. return "[When Digivolving] You may unsuspend this Digimon.";
  216. }
  217. bool CanUseCondition(Hashtable hashtable)
  218. {
  219. if (CardEffectCommons.IsExistOnBattleArea(card))
  220. {
  221. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable,card))
  222. {
  223. return true;
  224. }
  225. }
  226. return false;
  227. }
  228. bool CanActivateCondition(Hashtable hashtable)
  229. {
  230. if (CardEffectCommons.IsExistOnBattleArea(card))
  231. {
  232. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  233. {
  234. return true;
  235. }
  236. }
  237. return false;
  238. }
  239. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  240. {
  241. Permanent selectedPermanent = card.PermanentOfThisCard();
  242. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  243. }
  244. }
  245. #endregion
  246. #region End of Attack
  247. if(timing == EffectTiming.OnEndAttack)
  248. {
  249. ActivateClass activateClass = new ActivateClass();
  250. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  251. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  252. activateClass.SetHashString("Unsuspend_ST17_08");
  253. cardEffects.Add(activateClass);
  254. string EffectDiscription()
  255. {
  256. return "[End of Attack] You may unsuspend this Digimon.";
  257. }
  258. bool CanUseCondition(Hashtable hashtable)
  259. {
  260. if (CardEffectCommons.IsExistOnBattleArea(card))
  261. {
  262. return true;
  263. }
  264. return false;
  265. }
  266. bool CanActivateCondition(Hashtable hashtable)
  267. {
  268. if (CardEffectCommons.IsExistOnBattleArea(card))
  269. {
  270. if (CardEffectCommons.IsOwnerTurn(card))
  271. {
  272. if (CardEffectCommons.CanTriggerOnAttack(hashtable, card))
  273. {
  274. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  275. {
  276. return true;
  277. }
  278. }
  279. }
  280. }
  281. return false;
  282. }
  283. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  284. {
  285. Permanent selectedPermanent = card.PermanentOfThisCard();
  286. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  287. }
  288. }
  289. #endregion
  290. return cardEffects;
  291. }
  292. }
  293. }