BT17_001.cs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_001 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Attacking - ESS
  12. if (timing == EffectTiming.OnAllyAttack)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Pay 1 to delete opponents' Digimon with 3000 DP or less", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  17. activateClass.SetIsInheritedEffect(true);
  18. activateClass.SetHashString("Pay1Delete3000DP_BT17_001");
  19. cardEffects.Add(activateClass);
  20. string EffectDescription()
  21. {
  22. return
  23. "[When Attacking] By paying 1 cost, delete 1 of your opponent's Digimon with 3000 DP or less.";
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  28. }
  29. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  30. {
  31. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  32. {
  33. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable hashtable)
  45. {
  46. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(-1, activateClass));
  47. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  48. {
  49. int maxCount = Math.Min(1,
  50. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  51. SelectPermanentEffect selectPermanentEffect =
  52. GManager.instance.GetComponent<SelectPermanentEffect>();
  53. selectPermanentEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: CanSelectOpponentPermanentCondition,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: maxCount,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. selectPermanentCoroutine: null,
  62. afterSelectPermanentCoroutine: null,
  63. mode: SelectPermanentEffect.Mode.Destroy,
  64. cardEffect: activateClass);
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  66. }
  67. }
  68. }
  69. #endregion
  70. return cardEffects;
  71. }
  72. }
  73. }