BT18_012.cs 11 KB

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