LM_044.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //Ghoulmon
  5. namespace DCGO.CardEffects.LM
  6. {
  7. public class LM_044 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Blast Digivolve
  13. if (timing == EffectTiming.OnCounterTiming)
  14. {
  15. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  16. }
  17. #endregion
  18. #region Blocker
  19. if (timing == EffectTiming.None)
  20. {
  21. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  22. isInheritedEffect: false,
  23. card: card,
  24. condition: null));
  25. }
  26. #endregion
  27. #region Retaliation
  28. if (timing == EffectTiming.OnDestroyedAnyone)
  29. {
  30. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: false, card: card, condition: null));
  31. }
  32. #endregion
  33. #region On Deletion
  34. if (timing == EffectTiming.OnDestroyedAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Trash 1 hand card, then delete digimon", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  39. cardEffects.Add(activateClass);
  40. string EffectDiscription()
  41. {
  42. return "[On Deletion] If your opponent has 5 or more cards in their hand, they trash 1 card in their hand. Then, if they have 4 or fewer cards in their hand, delete 1 of their level 6 or lower Digimon.";
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  51. }
  52. bool CanSelectPermanentCondition(Permanent permanent)
  53. {
  54. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  55. {
  56. if (permanent.Level <= 6)
  57. {
  58. return true;
  59. }
  60. }
  61. return false;
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable hashtable)
  64. {
  65. if (card.Owner.Enemy.HandCards.Count >= 5)
  66. {
  67. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  68. selectHandEffect.SetUp(
  69. selectPlayer: card.Owner.Enemy,
  70. canTargetCondition: (cardSource) => true,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: 1,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. isShowOpponent: true,
  77. selectCardCoroutine: null,
  78. afterSelectCardCoroutine: null,
  79. mode: SelectHandEffect.Mode.Discard,
  80. cardEffect: activateClass);
  81. yield return StartCoroutine(selectHandEffect.Activate());
  82. }
  83. if (card.Owner.Enemy.HandCards.Count <= 4 && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  84. {
  85. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  86. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  87. selectPermanentEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectPermanentCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: maxCount,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: null,
  96. afterSelectPermanentCoroutine: null,
  97. mode: SelectPermanentEffect.Mode.Destroy,
  98. cardEffect: activateClass);
  99. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete", "The opponent is selecting 1 Digimon to delete");
  100. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  101. }
  102. }
  103. }
  104. #endregion
  105. return cardEffects;
  106. }
  107. }
  108. }