P_109.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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 P_109 : 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.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Paildramon") || targetPermanent.TopCard.CardNames.Contains("Dinobeemon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.OnCounterTiming)
  22. {
  23. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  24. }
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Suspend 1 Digimon and unsuspend 1 Digimon", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[On Play] Suspend 1 Digimon, then unsuspend 1 Digimon.";
  34. }
  35. bool CanSelectPermanentCondition(Permanent permanent)
  36. {
  37. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  38. {
  39. if (permanent.IsDigimon)
  40. {
  41. return true;
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  64. {
  65. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectPermanentCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: null,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Tap,
  78. cardEffect: activateClass);
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. }
  81. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  82. {
  83. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  84. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  85. selectPermanentEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectPermanentCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: maxCount,
  91. canNoSelect: false,
  92. canEndNotMax: false,
  93. selectPermanentCoroutine: null,
  94. afterSelectPermanentCoroutine: null,
  95. mode: SelectPermanentEffect.Mode.UnTap,
  96. cardEffect: activateClass);
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. }
  99. }
  100. }
  101. if (timing == EffectTiming.OnEnterFieldAnyone)
  102. {
  103. ActivateClass activateClass = new ActivateClass();
  104. activateClass.SetUpICardEffect("Suspend 1 Digimon and unsuspend 1 Digimon", CanUseCondition, card);
  105. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  106. cardEffects.Add(activateClass);
  107. string EffectDiscription()
  108. {
  109. return "[When Digivolving] Suspend 1 Digimon, then unsuspend 1 Digimon.";
  110. }
  111. bool CanSelectPermanentCondition(Permanent permanent)
  112. {
  113. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  114. {
  115. if (permanent.IsDigimon)
  116. {
  117. return true;
  118. }
  119. }
  120. return false;
  121. }
  122. bool CanUseCondition(Hashtable hashtable)
  123. {
  124. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.IsExistOnBattleArea(card))
  129. {
  130. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  131. {
  132. return true;
  133. }
  134. }
  135. return false;
  136. }
  137. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  138. {
  139. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  140. {
  141. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  142. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  143. selectPermanentEffect.SetUp(
  144. selectPlayer: card.Owner,
  145. canTargetCondition: CanSelectPermanentCondition,
  146. canTargetCondition_ByPreSelecetedList: null,
  147. canEndSelectCondition: null,
  148. maxCount: maxCount,
  149. canNoSelect: false,
  150. canEndNotMax: false,
  151. selectPermanentCoroutine: null,
  152. afterSelectPermanentCoroutine: null,
  153. mode: SelectPermanentEffect.Mode.Tap,
  154. cardEffect: activateClass);
  155. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  156. }
  157. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  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.UnTap,
  172. cardEffect: activateClass);
  173. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  174. }
  175. }
  176. }
  177. if (timing == EffectTiming.OnTappedAnyone)
  178. {
  179. ActivateClass activateClass = new ActivateClass();
  180. activateClass.SetUpICardEffect("Play 1 Tamer or Digimon from hand", CanUseCondition, card);
  181. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  182. activateClass.SetHashString("Unsuspen_EX3_074");
  183. cardEffects.Add(activateClass);
  184. string EffectDiscription()
  185. {
  186. return "[All Turns] [Once Per Turn] When this Digimon becomes suspended, you may play a Tamer card or a Digimon card with 4000 DP or less from your hand without paying the cost.";
  187. }
  188. bool CanSelectCardCondition(CardSource cardSource)
  189. {
  190. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  191. {
  192. if (cardSource.IsTamer)
  193. {
  194. return true;
  195. }
  196. if (cardSource.IsDigimon)
  197. {
  198. if (cardSource.CardDP <= 4000)
  199. {
  200. return true;
  201. }
  202. }
  203. }
  204. return false;
  205. }
  206. bool CanUseCondition(Hashtable hashtable)
  207. {
  208. if (CardEffectCommons.IsExistOnBattleArea(card))
  209. {
  210. if (CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card))
  211. {
  212. return true;
  213. }
  214. }
  215. return false;
  216. }
  217. bool CanActivateCondition(Hashtable hashtable)
  218. {
  219. if (CardEffectCommons.IsExistOnBattleArea(card))
  220. {
  221. if (card.Owner.HandCards.Count >= 1)
  222. {
  223. return true;
  224. }
  225. }
  226. return false;
  227. }
  228. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  229. {
  230. List<CardSource> selectedCards = new List<CardSource>();
  231. int maxCount = 1;
  232. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  233. selectHandEffect.SetUp(
  234. selectPlayer: card.Owner,
  235. canTargetCondition: CanSelectCardCondition,
  236. canTargetCondition_ByPreSelecetedList: null,
  237. canEndSelectCondition: null,
  238. maxCount: maxCount,
  239. canNoSelect: true,
  240. canEndNotMax: false,
  241. isShowOpponent: true,
  242. selectCardCoroutine: SelectCardCoroutine,
  243. afterSelectCardCoroutine: null,
  244. mode: SelectHandEffect.Mode.Custom,
  245. cardEffect: activateClass);
  246. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  247. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  248. yield return StartCoroutine(selectHandEffect.Activate());
  249. IEnumerator SelectCardCoroutine(CardSource cardSource)
  250. {
  251. selectedCards.Add(cardSource);
  252. yield return null;
  253. }
  254. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  255. }
  256. }
  257. return cardEffects;
  258. }
  259. }