EX4_065.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX4
  6. {
  7. public class EX4_065 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Main] Delete 1 of your opponent's Digimon with the highest DP. If a Digimon with 13000 DP or more is deleted by this effect, trash the top card of your opponent's security stack.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsMaxDP(permanent, card.Owner.Enemy, null);
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  29. }
  30. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  31. {
  32. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  33. {
  34. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  35. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  36. selectPermanentEffect.SetUp(
  37. selectPlayer: card.Owner,
  38. canTargetCondition: CanSelectPermanentCondition,
  39. canTargetCondition_ByPreSelecetedList: null,
  40. canEndSelectCondition: null,
  41. maxCount: maxCount,
  42. canNoSelect: false,
  43. canEndNotMax: false,
  44. selectPermanentCoroutine: SelectPermanentCoroutine,
  45. afterSelectPermanentCoroutine: null,
  46. mode: SelectPermanentEffect.Mode.Custom,
  47. cardEffect: activateClass);
  48. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  49. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  50. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  51. {
  52. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  53. targetPermanents: new List<Permanent>() { permanent },
  54. activateClass: activateClass,
  55. successProcess: SuccessProcess,
  56. failureProcess: null));
  57. IEnumerator SuccessProcess(List<Permanent> permanents)
  58. {
  59. if (permanents.Count(permanent => permanent.DPJustBeforeRemoveField >= 13000) >= 1)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  62. player: card.Owner.Enemy,
  63. destroySecurityCount: 1,
  64. cardEffect: activateClass,
  65. fromTop: true).DestroySecurity());
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. if (timing == EffectTiming.SecuritySkill)
  73. {
  74. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Delete opponent's 1 Digimon with the highest DP and trash the top card of opponent's security");
  75. }
  76. return cardEffects;
  77. }
  78. }
  79. }