Meteor_Wing_BT15_089.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class Meteor_Wing_BT15_089 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Delete 1 of your opponent's Digimon with 15000 DP or less. For each of your opponent's security cards, subtract 2000 from the maximum this DP-based deletion effect can delete.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. int maxDP = 15000;
  28. maxDP -= 2000 * card.Owner.Enemy.SecurityCards.Count;
  29. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(maxDP, activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  41. {
  42. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  43. {
  44. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  45. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  46. selectPermanentEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: CanSelectPermanentCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: maxCount,
  52. canNoSelect: false,
  53. canEndNotMax: false,
  54. selectPermanentCoroutine: null,
  55. afterSelectPermanentCoroutine: null,
  56. mode: SelectPermanentEffect.Mode.Destroy,
  57. cardEffect: activateClass);
  58. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  59. }
  60. }
  61. }
  62. if (timing == EffectTiming.SecuritySkill)
  63. {
  64. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Delete 1 Digimon");
  65. }
  66. return cardEffects;
  67. }
  68. }