Volcanicdramon_EX7_014.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX7
  5. {
  6. public class Volcanicdramon_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: CardEffectCondition);
  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 CardEffectCondition(ICardEffect cardEffect)
  177. {
  178. return true;
  179. }
  180. yield return null;
  181. }
  182. }
  183. #endregion
  184. #region All Turns
  185. if (timing == EffectTiming.WhenRemoveField)
  186. {
  187. ActivateClass activateClass = new ActivateClass();
  188. activateClass.SetUpICardEffect("Play 1 Digimon card with the [Machine Dragon]/[Sky Dragon] trait", CanUseCondition, card);
  189. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  190. activateClass.SetHashString("PlayDigimon_EX7_014");
  191. cardEffects.Add(activateClass);
  192. string EffectDescription()
  193. {
  194. 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.";
  195. }
  196. bool CanUseCondition(Hashtable hashtable)
  197. {
  198. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  199. {
  200. if(CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  201. {
  202. if (!CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card)))
  203. {
  204. return true;
  205. }
  206. }
  207. }
  208. return false;
  209. }
  210. bool CanSelectCardToPlayFromHand(CardSource cardSource)
  211. {
  212. return CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass) &&
  213. cardSource.IsDigimon &&
  214. (cardSource.ContainsTraits("Machine Drago") || cardSource.ContainsTraits("Sky Dragon"));
  215. }
  216. bool CanActivateCondition(Hashtable hashtable)
  217. {
  218. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  219. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardToPlayFromHand);
  220. }
  221. IEnumerator ActivateCoroutine(Hashtable hashtable)
  222. {
  223. List<CardSource> selectedCards = new List<CardSource>();
  224. SelectHandEffect selectCardEffect = GManager.instance.GetComponent<SelectHandEffect>();
  225. selectCardEffect.SetUp(
  226. selectPlayer: card.Owner,
  227. canTargetCondition: CanSelectCardToPlayFromHand,
  228. canTargetCondition_ByPreSelecetedList: null,
  229. canEndSelectCondition: null,
  230. maxCount: 1,
  231. canNoSelect: true,
  232. canEndNotMax: false,
  233. isShowOpponent: true,
  234. selectCardCoroutine: SelectCardCoroutine,
  235. afterSelectCardCoroutine: null,
  236. mode: SelectHandEffect.Mode.Custom,
  237. cardEffect: activateClass);
  238. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  239. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  240. yield return StartCoroutine(selectCardEffect.Activate());
  241. IEnumerator SelectCardCoroutine(CardSource cardSource)
  242. {
  243. selectedCards.Add(cardSource);
  244. yield return null;
  245. }
  246. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  247. cardSources: selectedCards,
  248. activateClass: activateClass,
  249. payCost: false,
  250. isTapped: false,
  251. root: SelectCardEffect.Root.Hand,
  252. activateETB: true));
  253. }
  254. }
  255. #endregion
  256. return cardEffects;
  257. }
  258. }
  259. }