EX3_071.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX3
  5. {
  6. public class EX3_071 : 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] <De-Digivolve 1> 1 of your opponent's Digimon. (Trash 1 card from the top of 1 of your opponent's Digimon. Stop trashing when you would trash a level 3 card or the Digimon's last card.) Then, delete 1 of your opponent's Digimon with a play cost of 5 or less.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanSelectPermanentCondition1(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  28. {
  29. if (permanent.TopCard.GetCostItself <= 5)
  30. {
  31. if (permanent.TopCard.HasPlayCost)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  44. {
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  48. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  49. selectPermanentEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: CanSelectPermanentCondition,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: maxCount,
  55. canNoSelect: false,
  56. canEndNotMax: false,
  57. selectPermanentCoroutine: SelectPermanentCoroutine,
  58. afterSelectPermanentCoroutine: null,
  59. mode: SelectPermanentEffect.Mode.Custom,
  60. cardEffect: activateClass);
  61. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  62. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  63. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  64. {
  65. Permanent selectedPermanent = permanent;
  66. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  67. }
  68. }
  69. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  70. {
  71. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectPermanentCondition1,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: maxCount,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: null,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Destroy,
  84. cardEffect: activateClass);
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. }
  87. }
  88. }
  89. if (timing == EffectTiming.SecuritySkill)
  90. {
  91. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"De-Digivolve 1 and delete 1 Digimon with 5 or less Cost");
  92. }
  93. return cardEffects;
  94. }
  95. }
  96. }