P_098.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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_098 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Your 1 Digimon cannot be deleted in battle", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] 1 of your blue Digimon cannot be deleted in battle until the end of your opponent's turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  43. {
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  50. {
  51. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  52. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  53. selectPermanentEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: CanSelectPermanentCondition,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: maxCount,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. selectPermanentCoroutine: SelectPermanentCoroutine,
  62. afterSelectPermanentCoroutine: null,
  63. mode: SelectPermanentEffect.Mode.Custom,
  64. cardEffect: activateClass);
  65. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  66. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  67. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  68. {
  69. bool CanNotBeDestroyedByBattleCondition(Permanent permanent, Permanent AttackingPermanent, Permanent DefendingPermanent, CardSource DefendingCard)
  70. {
  71. if (permanent == AttackingPermanent)
  72. {
  73. return true;
  74. }
  75. if (permanent == DefendingPermanent)
  76. {
  77. return true;
  78. }
  79. return false;
  80. }
  81. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeDeletedByBattle(
  82. targetPermanent: permanent,
  83. canNotBeDestroyedByBattleCondition: CanNotBeDestroyedByBattleCondition,
  84. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  85. activateClass: activateClass,
  86. effectName: "Can't be deleted in battle"));
  87. }
  88. }
  89. }
  90. if (timing == EffectTiming.OnEnterFieldAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Your 1 Digimon cannot be deleted in battle", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[When Digivolving] 1 of your blue Digimon cannot be deleted in battle until the end of your opponent's turn.";
  99. }
  100. bool CanSelectPermanentCondition(Permanent permanent)
  101. {
  102. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  103. {
  104. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  114. }
  115. bool CanActivateCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.IsExistOnBattleArea(card))
  118. {
  119. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  127. {
  128. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  129. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  130. selectPermanentEffect.SetUp(
  131. selectPlayer: card.Owner,
  132. canTargetCondition: CanSelectPermanentCondition,
  133. canTargetCondition_ByPreSelecetedList: null,
  134. canEndSelectCondition: null,
  135. maxCount: maxCount,
  136. canNoSelect: false,
  137. canEndNotMax: false,
  138. selectPermanentCoroutine: SelectPermanentCoroutine,
  139. afterSelectPermanentCoroutine: null,
  140. mode: SelectPermanentEffect.Mode.Custom,
  141. cardEffect: activateClass);
  142. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  143. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  144. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  145. {
  146. bool CanNotBeDestroyedByBattleCondition(Permanent permanent, Permanent AttackingPermanent, Permanent DefendingPermanent, CardSource DefendingCard)
  147. {
  148. if (permanent == AttackingPermanent)
  149. {
  150. return true;
  151. }
  152. if (permanent == DefendingPermanent)
  153. {
  154. return true;
  155. }
  156. return false;
  157. }
  158. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeDeletedByBattle(
  159. targetPermanent: permanent,
  160. canNotBeDestroyedByBattleCondition: CanNotBeDestroyedByBattleCondition,
  161. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  162. activateClass: activateClass,
  163. effectName: "Can't be deleted in battle"));
  164. }
  165. }
  166. }
  167. if (timing == EffectTiming.OnEnterFieldAnyone)
  168. {
  169. ActivateClass activateClass = new ActivateClass();
  170. activateClass.SetUpICardEffect("Your 1 Digimon gains Rush", CanUseCondition, card);
  171. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  172. activateClass.SetIsInheritedEffect(true);
  173. activateClass.SetHashString("GainRush_P_098");
  174. cardEffects.Add(activateClass);
  175. string EffectDiscription()
  176. {
  177. return "[Your Turn] [Once Per Turn] When you play another Digimon by an effect, 1 of your blue Digimon gains <Rush> (This Digimon can attack the turn it comes into play) for the turn.";
  178. }
  179. bool PermanentCondition(Permanent permanent)
  180. {
  181. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  182. {
  183. if (permanent != card.PermanentOfThisCard())
  184. {
  185. return true;
  186. }
  187. }
  188. return false;
  189. }
  190. bool CanSelectPermanentCondition(Permanent permanent)
  191. {
  192. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  193. {
  194. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  195. {
  196. return true;
  197. }
  198. }
  199. return false;
  200. }
  201. bool CanUseCondition(Hashtable hashtable)
  202. {
  203. if (CardEffectCommons.IsExistOnBattleArea(card))
  204. {
  205. if (CardEffectCommons.IsOwnerTurn(card))
  206. {
  207. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  208. {
  209. if (CardEffectCommons.IsByEffect(hashtable, null))
  210. {
  211. return true;
  212. }
  213. }
  214. }
  215. }
  216. return false;
  217. }
  218. bool CanActivateCondition(Hashtable hashtable)
  219. {
  220. if (CardEffectCommons.IsExistOnBattleArea(card))
  221. {
  222. return true;
  223. }
  224. return false;
  225. }
  226. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  227. {
  228. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  229. {
  230. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  231. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  232. selectPermanentEffect.SetUp(
  233. selectPlayer: card.Owner,
  234. canTargetCondition: CanSelectPermanentCondition,
  235. canTargetCondition_ByPreSelecetedList: null,
  236. canEndSelectCondition: null,
  237. maxCount: maxCount,
  238. canNoSelect: false,
  239. canEndNotMax: false,
  240. selectPermanentCoroutine: SelectPermanentCoroutine,
  241. afterSelectPermanentCoroutine: null,
  242. mode: SelectPermanentEffect.Mode.Custom,
  243. cardEffect: activateClass);
  244. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Rush.", "The opponent is selecting 1 Digimon that will get Rush.");
  245. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  246. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  247. {
  248. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  249. targetPermanent: permanent,
  250. effectDuration: EffectDuration.UntilEachTurnEnd,
  251. activateClass: activateClass));
  252. }
  253. }
  254. }
  255. }
  256. return cardEffects;
  257. }
  258. }