BT18_058.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_058 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Trash 1 card with [Knightmon] in text from hand to Draw 2", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] By trashing 1 card with [Knightmon] in its text in your hand, <Draw 2>. (Draw 2 cards from your deck.)";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.HasText("Knightmon"))
  25. {
  26. return true;
  27. }
  28. return false;
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (card.Owner.HandCards.Count >= 1)
  39. {
  40. return true;
  41. }
  42. }
  43. return false;
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  46. {
  47. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  48. {
  49. bool discarded = false;
  50. int discardCount = 1;
  51. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  52. selectHandEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: CanSelectCardCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: discardCount,
  58. canNoSelect: true,
  59. canEndNotMax: false,
  60. isShowOpponent: true,
  61. selectCardCoroutine: null,
  62. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  63. mode: SelectHandEffect.Mode.Discard,
  64. cardEffect: activateClass);
  65. yield return StartCoroutine(selectHandEffect.Activate());
  66. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  67. {
  68. if (cardSources.Count >= 1)
  69. {
  70. discarded = true;
  71. yield return null;
  72. }
  73. }
  74. if (discarded)
  75. {
  76. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  77. }
  78. }
  79. }
  80. }
  81. #endregion
  82. #region All Turn - ESS
  83. if (timing == EffectTiming.None)
  84. {
  85. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: null));
  86. }
  87. #endregion
  88. return cardEffects;
  89. }
  90. }
  91. }