EX6_055.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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.EX6
  9. {
  10. public class EX6_055 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. #region On Play
  16. if (timing == EffectTiming.OnEnterFieldAnyone)
  17. {
  18. ActivateClass activateClass = new ActivateClass();
  19. activateClass.SetUpICardEffect("Delete 1 opponent level 5 or lower/Your opponent trashes 1 card", CanUseCondition, card);
  20. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[On Play] Delete 1 of your opponent's level 5 or lower Digimon. If this effect didn't delete, your opponent trashes 1 card in their hand.";
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerOnPlay(hashtable,card);
  29. }
  30. bool CanSelectPermanentCondition(Permanent permanent)
  31. {
  32. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  33. {
  34. if (permanent.IsDigimon && permanent.Level <= 5)
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if(CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. return true;
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  52. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  53. {
  54. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: CanSelectPermanentCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: maxCount,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: null,
  65. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  66. mode: SelectPermanentEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  71. {
  72. deleteTargetPermanents = permanents.Clone();
  73. yield return null;
  74. }
  75. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  76. IEnumerator FailureProcess()
  77. {
  78. if (card.Owner.Enemy.HandCards.Count >= 1)
  79. {
  80. int discardCount = 1;
  81. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  82. selectHandEffect.SetUp(
  83. selectPlayer: card.Owner.Enemy,
  84. canTargetCondition: (cardSource) => true,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: discardCount,
  88. canNoSelect: false,
  89. canEndNotMax: false,
  90. isShowOpponent: true,
  91. selectCardCoroutine: null,
  92. afterSelectCardCoroutine: null,
  93. mode: SelectHandEffect.Mode.Discard,
  94. cardEffect: activateClass);
  95. yield return StartCoroutine(selectHandEffect.Activate());
  96. }
  97. }
  98. }
  99. else
  100. {
  101. if (card.Owner.Enemy.HandCards.Count >= 1)
  102. {
  103. int discardCount = 1;
  104. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  105. selectHandEffect.SetUp(
  106. selectPlayer: card.Owner.Enemy,
  107. canTargetCondition: (cardSource) => true,
  108. canTargetCondition_ByPreSelecetedList: null,
  109. canEndSelectCondition: null,
  110. maxCount: discardCount,
  111. canNoSelect: false,
  112. canEndNotMax: false,
  113. isShowOpponent: true,
  114. selectCardCoroutine: null,
  115. afterSelectCardCoroutine: null,
  116. mode: SelectHandEffect.Mode.Discard,
  117. cardEffect: activateClass);
  118. yield return StartCoroutine(selectHandEffect.Activate());
  119. }
  120. }
  121. }
  122. }
  123. #endregion
  124. #region When Digivolving
  125. if (timing == EffectTiming.OnEnterFieldAnyone)
  126. {
  127. ActivateClass activateClass = new ActivateClass();
  128. activateClass.SetUpICardEffect("Delete 1 opponent level 5 or lower/Your opponent trashes 1 card", CanUseCondition, card);
  129. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  130. cardEffects.Add(activateClass);
  131. string EffectDiscription()
  132. {
  133. return "[When Digivolving] Delete 1 of your opponent's level 5 or lower Digimon. If this effect didn't delete, your opponent trashes 1 card in their hand.";
  134. }
  135. bool CanUseCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  138. }
  139. bool CanSelectPermanentCondition(Permanent permanent)
  140. {
  141. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  142. {
  143. if (permanent.IsDigimon && permanent.Level <= 5)
  144. {
  145. return true;
  146. }
  147. }
  148. return false;
  149. }
  150. bool CanActivateCondition(Hashtable hashtable)
  151. {
  152. if (CardEffectCommons.IsExistOnBattleArea(card))
  153. {
  154. return true;
  155. }
  156. return false;
  157. }
  158. IEnumerator ActivateCoroutine(Hashtable hashtable)
  159. {
  160. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  161. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  162. {
  163. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  164. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  165. selectPermanentEffect.SetUp(
  166. selectPlayer: card.Owner,
  167. canTargetCondition: CanSelectPermanentCondition,
  168. canTargetCondition_ByPreSelecetedList: null,
  169. canEndSelectCondition: null,
  170. maxCount: maxCount,
  171. canNoSelect: false,
  172. canEndNotMax: false,
  173. selectPermanentCoroutine: null,
  174. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  175. mode: SelectPermanentEffect.Mode.Custom,
  176. cardEffect: activateClass);
  177. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  178. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  179. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  180. {
  181. deleteTargetPermanents = permanents.Clone();
  182. yield return null;
  183. }
  184. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  185. IEnumerator FailureProcess()
  186. {
  187. if (card.Owner.Enemy.HandCards.Count >= 1)
  188. {
  189. int discardCount = 1;
  190. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  191. selectHandEffect.SetUp(
  192. selectPlayer: card.Owner.Enemy,
  193. canTargetCondition: (cardSource) => true,
  194. canTargetCondition_ByPreSelecetedList: null,
  195. canEndSelectCondition: null,
  196. maxCount: discardCount,
  197. canNoSelect: false,
  198. canEndNotMax: false,
  199. isShowOpponent: true,
  200. selectCardCoroutine: null,
  201. afterSelectCardCoroutine: null,
  202. mode: SelectHandEffect.Mode.Discard,
  203. cardEffect: activateClass);
  204. yield return StartCoroutine(selectHandEffect.Activate());
  205. }
  206. }
  207. }
  208. else
  209. {
  210. if (card.Owner.Enemy.HandCards.Count >= 1)
  211. {
  212. int discardCount = 1;
  213. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  214. selectHandEffect.SetUp(
  215. selectPlayer: card.Owner.Enemy,
  216. canTargetCondition: (cardSource) => true,
  217. canTargetCondition_ByPreSelecetedList: null,
  218. canEndSelectCondition: null,
  219. maxCount: discardCount,
  220. canNoSelect: false,
  221. canEndNotMax: false,
  222. isShowOpponent: true,
  223. selectCardCoroutine: null,
  224. afterSelectCardCoroutine: null,
  225. mode: SelectHandEffect.Mode.Discard,
  226. cardEffect: activateClass);
  227. yield return StartCoroutine(selectHandEffect.Activate());
  228. }
  229. }
  230. }
  231. }
  232. #endregion
  233. #region All Turns
  234. if (timing == EffectTiming.None)
  235. {
  236. bool Condition()
  237. {
  238. if (CardEffectCommons.IsExistOnBattleArea(card))
  239. {
  240. if (card.Owner.Enemy.HandCards.Count <= 5)
  241. {
  242. return true;
  243. }
  244. }
  245. return false;
  246. }
  247. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: Condition));
  248. cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card:card, condition: Condition));
  249. }
  250. #endregion
  251. return cardEffects;
  252. }
  253. }
  254. }