BT20_014.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class BT20_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("Delete a Digimon with 5000DP or less", 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 5000DP or less.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  25. }
  26. bool CanActivateCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  29. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanent);
  30. }
  31. bool CanSelectPermanent(Permanent permanent)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  34. permanent.DP <= card.Owner.MaxDP_DeleteEffect(5000, activateClass);
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable hashtable)
  37. {
  38. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  39. selectPermanentEffect.SetUp(
  40. selectPlayer: card.Owner,
  41. canTargetCondition: CanSelectPermanent,
  42. canTargetCondition_ByPreSelecetedList: null,
  43. canEndSelectCondition: null,
  44. maxCount: 1,
  45. canNoSelect: false,
  46. canEndNotMax: false,
  47. selectPermanentCoroutine: null,
  48. afterSelectPermanentCoroutine: null,
  49. mode: SelectPermanentEffect.Mode.Destroy,
  50. cardEffect: activateClass
  51. );
  52. selectPermanentEffect.SetUpCustomMessage("Select 1 card to delete.", "The opponent is selecting 1 card to delete.");
  53. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  54. }
  55. }
  56. #endregion
  57. #region When Digivolving
  58. if (timing == EffectTiming.OnEnterFieldAnyone)
  59. {
  60. ActivateClass activateClass = new ActivateClass();
  61. activateClass.SetUpICardEffect("Delete a Digimon with 5000DP or less", CanUseCondition, card);
  62. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  63. cardEffects.Add(activateClass);
  64. string EffectDiscription()
  65. {
  66. return "[When Digivolving] Delete 1 of your opponent's Digimon with 5000DP or less.";
  67. }
  68. bool CanUseCondition(Hashtable hashtable)
  69. {
  70. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  71. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  72. }
  73. bool CanActivateCondition(Hashtable hashtable)
  74. {
  75. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  76. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanent);
  77. }
  78. bool CanSelectPermanent(Permanent permanent)
  79. {
  80. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  81. permanent.DP <= card.Owner.MaxDP_DeleteEffect(5000, activateClass);
  82. }
  83. IEnumerator ActivateCoroutine(Hashtable hashtable)
  84. {
  85. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  86. selectPermanentEffect.SetUp(
  87. selectPlayer: card.Owner,
  88. canTargetCondition: CanSelectPermanent,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. maxCount: 1,
  92. canNoSelect: false,
  93. canEndNotMax: false,
  94. selectPermanentCoroutine: null,
  95. afterSelectPermanentCoroutine: null,
  96. mode: SelectPermanentEffect.Mode.Destroy,
  97. cardEffect: activateClass
  98. );
  99. selectPermanentEffect.SetUpCustomMessage("Select 1 card to delete.", "The opponent is selecting 1 card to delete.");
  100. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  101. }
  102. }
  103. #endregion
  104. #region End of Turn
  105. if (timing == EffectTiming.OnEndTurn)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("By suspending a Digimon, this Digimon may digivolve into a Digimon card with [Jesmon] in its name", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  110. cardEffects.Add(activateClass);
  111. string EffectDiscription()
  112. {
  113. return "[End of Your Turn] By suspending 1 of your other Digimon, this Digiomon may digivolve into a Digimon card with [Jesmon] in its name in the hand without paying the cost.";
  114. }
  115. bool CanSelectPermanentToSuspend(Permanent permanent)
  116. {
  117. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  118. CardEffectCommons.CanActivateSuspendCostEffect(permanent.TopCard) &&
  119. (permanent != card.PermanentOfThisCard());
  120. }
  121. bool CanSelectCardToDigivolveInto(CardSource cardSource)
  122. {
  123. return cardSource.ContainsCardName("Jesmon") &&
  124. cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
  125. }
  126. bool CanUseCondition(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  129. {
  130. if (CardEffectCommons.IsOwnerTurn(card))
  131. {
  132. return true;
  133. }
  134. }
  135. return false;
  136. }
  137. bool CanActivateCondition(Hashtable hashtable)
  138. {
  139. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  140. {
  141. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentToSuspend))
  142. {
  143. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardToDigivolveInto))
  144. {
  145. return true;
  146. }
  147. }
  148. }
  149. return false;
  150. }
  151. IEnumerator ActivateCoroutine(Hashtable hashtable)
  152. {
  153. #region select card to suspend
  154. List<Permanent> selectedPermanents = new List<Permanent>();
  155. int maxCount = 1;
  156. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  157. selectPermanentEffect.SetUp(
  158. selectPlayer: card.Owner,
  159. canTargetCondition: CanSelectPermanentToSuspend,
  160. canTargetCondition_ByPreSelecetedList: null,
  161. canEndSelectCondition: null,
  162. maxCount: maxCount,
  163. canNoSelect: true,
  164. canEndNotMax: false,
  165. selectPermanentCoroutine: selectPermanentCoroutine,
  166. afterSelectPermanentCoroutine: null,
  167. mode: SelectPermanentEffect.Mode.Tap,
  168. cardEffect: activateClass
  169. );
  170. selectPermanentEffect.SetUpCustomMessage("Select 1 card to suspend.", "The opponent is selecting 1 card to suspend.");
  171. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  172. IEnumerator selectPermanentCoroutine (Permanent permanent)
  173. {
  174. selectedPermanents.Add( permanent );
  175. yield return null;
  176. }
  177. #endregion
  178. if (selectedPermanents.Count > 0)
  179. {
  180. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  181. targetPermanent: card.PermanentOfThisCard(),
  182. cardCondition: CanSelectCardToDigivolveInto,
  183. payCost: false,
  184. reduceCostTuple: null,
  185. fixedCostTuple: null,
  186. ignoreDigivolutionRequirementFixedCost: -1,
  187. isHand: true,
  188. activateClass: activateClass,
  189. successProcess: null));
  190. }
  191. }
  192. }
  193. #endregion
  194. #region Your Turn - ESS
  195. if (timing == EffectTiming.OnAllyAttack)
  196. {
  197. bool CanUseCondition()
  198. {
  199. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  200. CardEffectCommons.IsOwnerTurn(card) &&
  201. card.PermanentOfThisCard().TopCard.HasRoyalKnightTraits;
  202. }
  203. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: true, card: card, condition: CanUseCondition));
  204. }
  205. #endregion
  206. return cardEffects;
  207. }
  208. }
  209. }