EX7_014.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX7
  5. {
  6. public class EX7_014 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] Delete 1 of your opponent's Digimon with the lowest DP.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
  25. }
  26. bool CanActivateCondition(Hashtable hashtable)
  27. {
  28. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  29. {
  30. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  42. {
  43. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  44. {
  45. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  46. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  47. selectPermanentEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: CanSelectPermanentCondition,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: maxCount,
  53. canNoSelect: false,
  54. canEndNotMax: false,
  55. selectPermanentCoroutine: null,
  56. afterSelectPermanentCoroutine: null,
  57. mode: SelectPermanentEffect.Mode.Destroy,
  58. cardEffect: activateClass);
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. }
  61. }
  62. }
  63. #endregion
  64. #region When Attacking
  65. if (timing == EffectTiming.OnAllyAttack)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  69. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  70. cardEffects.Add(activateClass);
  71. string EffectDiscription()
  72. {
  73. return "[When Attacking] Delete 1 of your opponent's Digimon with the lowest DP.";
  74. }
  75. bool CanSelectPermanentCondition(Permanent permanent)
  76. {
  77. return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  82. {
  83. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  84. {
  85. return true;
  86. }
  87. }
  88. return false;
  89. }
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  93. }
  94. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  95. {
  96. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  97. {
  98. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  99. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  100. selectPermanentEffect.SetUp(
  101. selectPlayer: card.Owner,
  102. canTargetCondition: CanSelectPermanentCondition,
  103. canTargetCondition_ByPreSelecetedList: null,
  104. canEndSelectCondition: null,
  105. maxCount: maxCount,
  106. canNoSelect: false,
  107. canEndNotMax: false,
  108. selectPermanentCoroutine: null,
  109. afterSelectPermanentCoroutine: null,
  110. mode: SelectPermanentEffect.Mode.Destroy,
  111. cardEffect: activateClass);
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. }
  114. }
  115. }
  116. #endregion
  117. #region When Digivolving
  118. if (timing == EffectTiming.OnEnterFieldAnyone)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect("Opponent can't play or move Digimon with 6000 DP or less", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[When Digivolving] Your opponent can't play or move Digimon with 6000 DP or less until the end of their turn.";
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. if(CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  131. {
  132. if(CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  133. {
  134. return true;
  135. }
  136. }
  137. return false;
  138. }
  139. bool CanActivateCondition(Hashtable hashtable)
  140. {
  141. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  142. {
  143. return true;
  144. }
  145. return false;
  146. }
  147. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  148. {
  149. CanNotMoveClass canNotMoveClass = new CanNotMoveClass();
  150. canNotMoveClass.SetUpICardEffect("Can't move Digimon with 6000 DP or less", CanUseCondition1, card);
  151. canNotMoveClass.SetUpCanNotMoveClass(cardCondition: CardCondition, cardEffectCondition: MoveCardEffectCondition);
  152. card.Owner.Enemy.UntilOwnerTurnEndEffects.Add((_timing) => canNotMoveClass);
  153. CanNotPutFieldClass canNotPutFieldClass = new CanNotPutFieldClass();
  154. canNotPutFieldClass.SetUpICardEffect("Can't play Digimon with 6000 DP or less", CanUseCondition1, card);
  155. canNotPutFieldClass.SetUpCanNotPutFieldClass(cardCondition: CardCondition, cardEffectCondition: CardEffectCondition);
  156. card.Owner.Enemy.UntilOwnerTurnEndEffects.Add((_timing) => canNotPutFieldClass);
  157. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().DebuffSE);
  158. bool CanUseCondition1(Hashtable hashtable)
  159. {
  160. return true;
  161. }
  162. bool CardCondition(CardSource cardSource)
  163. {
  164. if (cardSource.Owner == card.Owner.Enemy)
  165. {
  166. if (cardSource.IsDigimon)
  167. {
  168. if (cardSource.CardDP <= 6000)
  169. {
  170. return true;
  171. }
  172. }
  173. }
  174. return false;
  175. }
  176. bool MoveCardEffectCondition(ICardEffect cardEffect)
  177. {
  178. return true;
  179. }
  180. bool CardEffectCondition(ICardEffect cardEffect)
  181. {
  182. if (cardEffect == null)
  183. return true;
  184. else
  185. return cardEffect.EffectSourceCard.Owner == card.Owner.Enemy;
  186. }
  187. yield return null;
  188. }
  189. }
  190. #endregion
  191. #region All Turns
  192. if (timing == EffectTiming.WhenRemoveField)
  193. {
  194. ActivateClass activateClass = new ActivateClass();
  195. activateClass.SetUpICardEffect("Play 1 Digimon card with the [Machine Dragon]/[Sky Dragon] trait", CanUseCondition, card);
  196. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  197. activateClass.SetHashString("PlayDigimon_EX7_014");
  198. cardEffects.Add(activateClass);
  199. string EffectDescription()
  200. {
  201. return "[All Turns] [Once Per Turn] When this Digimon would leave battle area other than by one of your effects, you may play 1 Digimon card with the [Machine Dragon]/[Sky Dragon] trait from your hand without paying the cost.";
  202. }
  203. bool CanUseCondition(Hashtable hashtable)
  204. {
  205. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  206. {
  207. if(CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  208. {
  209. if (!CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card)))
  210. {
  211. return true;
  212. }
  213. }
  214. }
  215. return false;
  216. }
  217. bool CanSelectCardToPlayFromHand(CardSource cardSource)
  218. {
  219. return CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass) &&
  220. cardSource.IsDigimon &&
  221. (cardSource.ContainsTraits("Machine Dragon") || cardSource.ContainsTraits("Sky Dragon"));
  222. }
  223. bool CanActivateCondition(Hashtable hashtable)
  224. {
  225. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  226. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardToPlayFromHand);
  227. }
  228. IEnumerator ActivateCoroutine(Hashtable hashtable)
  229. {
  230. List<CardSource> selectedCards = new List<CardSource>();
  231. SelectHandEffect selectCardEffect = GManager.instance.GetComponent<SelectHandEffect>();
  232. selectCardEffect.SetUp(
  233. selectPlayer: card.Owner,
  234. canTargetCondition: CanSelectCardToPlayFromHand,
  235. canTargetCondition_ByPreSelecetedList: null,
  236. canEndSelectCondition: null,
  237. maxCount: 1,
  238. canNoSelect: true,
  239. canEndNotMax: false,
  240. isShowOpponent: true,
  241. selectCardCoroutine: SelectCardCoroutine,
  242. afterSelectCardCoroutine: null,
  243. mode: SelectHandEffect.Mode.Custom,
  244. cardEffect: activateClass);
  245. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  246. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  247. yield return StartCoroutine(selectCardEffect.Activate());
  248. IEnumerator SelectCardCoroutine(CardSource cardSource)
  249. {
  250. selectedCards.Add(cardSource);
  251. yield return null;
  252. }
  253. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  254. cardSources: selectedCards,
  255. activateClass: activateClass,
  256. payCost: false,
  257. isTapped: false,
  258. root: SelectCardEffect.Root.Hand,
  259. activateETB: true));
  260. }
  261. }
  262. #endregion
  263. return cardEffects;
  264. }
  265. }
  266. }