EX7_057.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX7
  6. {
  7. public class EX7_057 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4)
  18. {
  19. if (targetPermanent.TopCard.EqualsTraits("Dark Dragon") || targetPermanent.TopCard.EqualsTraits("Evil Dragon"))
  20. {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  27. }
  28. #endregion
  29. #region On Play
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Trash 2 cards from hand and delete a 7000 DP Digimon", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Play] Trash 2 cards in your hand. Then, delete 1 of your opponent's Digimon with 7000 DP or less.";
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. if(CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  43. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  44. return false;
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  49. }
  50. bool CanSelectPermanentCondition(Permanent permanent)
  51. {
  52. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  53. {
  54. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(7000, activateClass))
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. if (card.Owner.HandCards.Count >= 1)
  64. {
  65. int discardCount = Math.Min(2, card.Owner.HandCards.Count);
  66. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  67. selectHandEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: (cardSource) => true,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: discardCount,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. isShowOpponent: true,
  76. selectCardCoroutine: null,
  77. afterSelectCardCoroutine: null,
  78. mode: SelectHandEffect.Mode.Discard,
  79. cardEffect: activateClass);
  80. yield return StartCoroutine(selectHandEffect.Activate());
  81. }
  82. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  83. {
  84. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  85. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  86. selectPermanentEffect.SetUp(
  87. selectPlayer: card.Owner,
  88. canTargetCondition: CanSelectPermanentCondition,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. maxCount: maxCount,
  92. canNoSelect: false,
  93. canEndNotMax: false,
  94. selectPermanentCoroutine: null,
  95. afterSelectPermanentCoroutine: null,
  96. mode: SelectPermanentEffect.Mode.Destroy,
  97. cardEffect: activateClass);
  98. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  99. }
  100. }
  101. }
  102. #endregion
  103. #region When Digivolving
  104. if (timing == EffectTiming.OnEnterFieldAnyone)
  105. {
  106. ActivateClass activateClass = new ActivateClass();
  107. activateClass.SetUpICardEffect("Trash 2 cards from hand and delete a 7000 DP Digimon", CanUseCondition, card);
  108. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  109. cardEffects.Add(activateClass);
  110. string EffectDiscription()
  111. {
  112. return "[When Digivolving] Trash 2 cards in your hand. Then, delete 1 of your opponent's Digimon with 7000 DP or less.";
  113. }
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. if(CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  117. {
  118. if(CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  119. {
  120. return true;
  121. }
  122. }
  123. return false;
  124. }
  125. bool CanActivateCondition(Hashtable hashtable)
  126. {
  127. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  128. {
  129. if (card.Owner.HandCards.Count >= 1)
  130. {
  131. return true;
  132. }
  133. }
  134. return false;
  135. }
  136. bool CanSelectPermanentCondition(Permanent permanent)
  137. {
  138. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  139. {
  140. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(7000, activateClass))
  141. {
  142. return true;
  143. }
  144. }
  145. return false;
  146. }
  147. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  148. {
  149. if (card.Owner.HandCards.Count >= 1)
  150. {
  151. int discardCount = Math.Min(2, card.Owner.HandCards.Count);
  152. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  153. selectHandEffect.SetUp(
  154. selectPlayer: card.Owner,
  155. canTargetCondition: (cardSource) => true,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canEndSelectCondition: null,
  158. maxCount: discardCount,
  159. canNoSelect: false,
  160. canEndNotMax: false,
  161. isShowOpponent: true,
  162. selectCardCoroutine: null,
  163. afterSelectCardCoroutine: null,
  164. mode: SelectHandEffect.Mode.Discard,
  165. cardEffect: activateClass);
  166. yield return StartCoroutine(selectHandEffect.Activate());
  167. }
  168. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  169. {
  170. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  171. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  172. selectPermanentEffect.SetUp(
  173. selectPlayer: card.Owner,
  174. canTargetCondition: CanSelectPermanentCondition,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canEndSelectCondition: null,
  177. maxCount: maxCount,
  178. canNoSelect: false,
  179. canEndNotMax: false,
  180. selectPermanentCoroutine: null,
  181. afterSelectPermanentCoroutine: null,
  182. mode: SelectPermanentEffect.Mode.Destroy,
  183. cardEffect: activateClass);
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. }
  186. }
  187. }
  188. #endregion
  189. #region Inherit
  190. if (timing == EffectTiming.None)
  191. {
  192. bool PermanentCondition(Permanent permanent)
  193. {
  194. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  195. {
  196. if (permanent.TopCard.ContainsTraits("Dark Dragon") || permanent.TopCard.ContainsTraits("Evil Dragon"))
  197. {
  198. return true;
  199. }
  200. }
  201. return false;
  202. }
  203. bool CanUseCondition()
  204. {
  205. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  206. {
  207. if (CardEffectCommons.IsOwnerTurn(card))
  208. {
  209. if (card.Owner.HandCards.Count <= 4)
  210. {
  211. return true;
  212. }
  213. }
  214. }
  215. return false;
  216. }
  217. cardEffects.Add(CardEffectFactory.ChangeSAttackStaticEffect(PermanentCondition, 1, true, card, CanUseCondition));
  218. }
  219. #endregion
  220. return cardEffects;
  221. }
  222. }
  223. }