BT11_063.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_063 : 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.None)
  12. {
  13. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  14. changeCardNamesClass.SetUpICardEffect("Also treated as [Numemon]", CanUseCondition, card);
  15. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: ChangeCardNames);
  16. cardEffects.Add(changeCardNamesClass);
  17. bool CanUseCondition(Hashtable hashtable)
  18. {
  19. return true;
  20. }
  21. List<string> ChangeCardNames(CardSource cardSource, List<string> CardNames)
  22. {
  23. if (cardSource == card)
  24. {
  25. CardNames.Add("Numemon");
  26. }
  27. return CardNames;
  28. }
  29. }
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Trash 1 card from hand to Draw 2", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Play] By trashing 1 card with [Numemon], [Sukamon], [Nanimon], or [Etemon] in its name in your hand, <Draw 2>. (Draw 2 cards from your deck.)";
  39. }
  40. bool CanSelectCardCondition(CardSource cardSource)
  41. {
  42. if (cardSource.ContainsCardName("Numemon"))
  43. {
  44. return true;
  45. }
  46. if (cardSource.ContainsCardName("Sukamon"))
  47. {
  48. return true;
  49. }
  50. if (cardSource.ContainsCardName("Nanimon"))
  51. {
  52. return true;
  53. }
  54. if (cardSource.ContainsCardName("Etemon"))
  55. {
  56. return true;
  57. }
  58. return false;
  59. }
  60. bool CanUseCondition(Hashtable hashtable)
  61. {
  62. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. if (CardEffectCommons.IsExistOnBattleArea(card))
  67. {
  68. if (card.Owner.HandCards.Count >= 1)
  69. {
  70. return true;
  71. }
  72. }
  73. return false;
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  76. {
  77. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  78. {
  79. bool discarded = false;
  80. int discardCount = 1;
  81. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  82. selectHandEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanSelectCardCondition,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: discardCount,
  88. canNoSelect: true,
  89. canEndNotMax: false,
  90. isShowOpponent: true,
  91. selectCardCoroutine: null,
  92. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  93. mode: SelectHandEffect.Mode.Discard,
  94. cardEffect: activateClass);
  95. yield return StartCoroutine(selectHandEffect.Activate());
  96. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  97. {
  98. if (cardSources.Count >= 1)
  99. {
  100. discarded = true;
  101. yield return null;
  102. }
  103. }
  104. if (discarded)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  107. }
  108. }
  109. }
  110. }
  111. return cardEffects;
  112. }
  113. }
  114. }