EX6_046.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX6
  4. {
  5. public class EX6_046 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Deletion
  11. if (timing == EffectTiming.OnDestroyedAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Draw 1, Trash 1/Opponent trashes card", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Deletion] If your opponent has 5 or fewer cards in their hand, [Draw 1] and trash 1 card in your hand. If your opponent has 7 or more cards in their hand, your opponent trashes 1 card in their hand.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  24. }
  25. bool CanActivateCondition(Hashtable hashtable)
  26. {
  27. if(card.Owner.Enemy.HandCards.Count <= 5)
  28. {
  29. return true;
  30. }
  31. if(card.Owner.Enemy.HandCards.Count >= 7)
  32. {
  33. return true;
  34. }
  35. return false;
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable hashtable)
  38. {
  39. if(card.Owner.Enemy.HandCards.Count <= 5)
  40. {
  41. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  42. if (card.Owner.HandCards.Count >= 1)
  43. {
  44. int discardCount = 1;
  45. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  46. selectHandEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: (cardSource) => true,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: discardCount,
  52. canNoSelect: false,
  53. canEndNotMax: false,
  54. isShowOpponent: true,
  55. selectCardCoroutine: null,
  56. afterSelectCardCoroutine: null,
  57. mode: SelectHandEffect.Mode.Discard,
  58. cardEffect: activateClass);
  59. yield return StartCoroutine(selectHandEffect.Activate());
  60. }
  61. }
  62. if(card.Owner.Enemy.HandCards.Count >= 7)
  63. {
  64. int discardCount = 1;
  65. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  66. selectHandEffect.SetUp(
  67. selectPlayer: card.Owner.Enemy,
  68. canTargetCondition: (cardSource) => true,
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. maxCount: discardCount,
  72. canNoSelect: false,
  73. canEndNotMax: false,
  74. isShowOpponent: true,
  75. selectCardCoroutine: null,
  76. afterSelectCardCoroutine: null,
  77. mode: SelectHandEffect.Mode.Discard,
  78. cardEffect: activateClass);
  79. yield return StartCoroutine(selectHandEffect.Activate());
  80. }
  81. }
  82. }
  83. #endregion
  84. #region Inherit
  85. if (timing == EffectTiming.None)
  86. {
  87. bool Condition()
  88. {
  89. if (CardEffectCommons.IsExistOnBattleArea(card))
  90. {
  91. if (card.Owner.Enemy.HandCards.Count <= 6)
  92. {
  93. return true;
  94. }
  95. }
  96. return false;
  97. }
  98. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  99. }
  100. #endregion
  101. return cardEffects;
  102. }
  103. }
  104. }