EX2_067.cs 4.4 KB

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