Akatorimon_BT15_010.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. public class Akatorimon_BT15_010 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnAllyAttack)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Delete 1 Digimon with 3000 DP or less", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  15. activateClass.SetHashString("Delete_BT15_010");
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Your Turn][Once per turn] When your Digimon attacks a player, delete 1 of your opponent's Digimon with 3000DP or less.";
  20. }
  21. bool PermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  28. {
  29. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (CardEffectCommons.IsOwnerTurn(card))
  41. {
  42. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  43. {
  44. if (GManager.instance.attackProcess.DefendingPermanent == null)
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleArea(card))
  56. {
  57. return true;
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  64. {
  65. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectPermanentCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: null,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Destroy,
  78. cardEffect: activateClass);
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. }
  81. }
  82. }
  83. return cardEffects;
  84. }
  85. }