EX6_071.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX6
  4. {
  5. public class EX6_071 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Main Effect
  11. if (timing == EffectTiming.OptionSkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Opponent Trashes 1 card, Then Delete 1 digimon with level less than or equal to cards in opponents hand.", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Main] If your opponent has 5 or more cards in their hand, your opponent trashes 1 card in their hand. Then, delete 1 of your opponent’s Digimon with a level greater than or equal to the cards in their hand.";
  20. }
  21. bool SelectOpponentsDigimon(Permanent permanent)
  22. {
  23. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  24. {
  25. if(permanent.TopCard.HasLevel && permanent.Level >= card.Owner.Enemy.HandCards.Count)
  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. if(card.Owner.Enemy.HandCards.Count >= 5)
  39. {
  40. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  41. selectHandEffect.SetUp(
  42. selectPlayer: card.Owner.Enemy,
  43. canTargetCondition: (CardSource) => true,
  44. canTargetCondition_ByPreSelecetedList: null,
  45. canEndSelectCondition: null,
  46. maxCount: 1,
  47. canNoSelect: false,
  48. canEndNotMax: false,
  49. isShowOpponent: true,
  50. selectCardCoroutine: null,
  51. afterSelectCardCoroutine: null,
  52. mode: SelectHandEffect.Mode.Discard,
  53. cardEffect: activateClass);
  54. yield return StartCoroutine(selectHandEffect.Activate());
  55. }
  56. if(CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SelectOpponentsDigimon))
  57. {
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: SelectOpponentsDigimon,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: 1,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: null,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Destroy,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. }
  74. yield return null;
  75. }
  76. }
  77. #endregion
  78. #region Security Effect
  79. if (timing == EffectTiming.SecuritySkill)
  80. {
  81. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  82. card: card,
  83. cardEffects: ref cardEffects,
  84. effectName: $"Delete 1 of your opponent’s Digimon with a level greater than or equal to the cards in their hand");
  85. }
  86. #endregion
  87. return cardEffects;
  88. }
  89. }
  90. }