BT13_078.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT13
  4. {
  5. public class BT13_078 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnDestroyedAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Deletion] Trigger <Draw 1>. (Draw 1 card from your deck.) Then trash 1 card from your hand.";
  19. }
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  23. }
  24. bool CanActivateCondition(Hashtable hashtable)
  25. {
  26. if (CardEffectCommons.IsExistOnTrash(card))
  27. {
  28. if (card.Owner.LibraryCards.Count >= 1)
  29. {
  30. return true;
  31. }
  32. if (card.Owner.HandCards.Count >= 1)
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  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. }
  63. if (timing == EffectTiming.OnEndTurn)
  64. {
  65. ActivateClass activateClass = new ActivateClass();
  66. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  67. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  68. activateClass.SetIsInheritedEffect(true);
  69. activateClass.SetHashString("Draw1_BT13_078");
  70. cardEffects.Add(activateClass);
  71. string EffectDiscription()
  72. {
  73. return "[End of Opponent�'s Turn][Once Per Turn] <Draw 1>. Then, trash 1 card in your hand.";
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. if (CardEffectCommons.IsExistOnBattleArea(card))
  78. {
  79. if (CardEffectCommons.IsOpponentTurn(card))
  80. {
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. if (CardEffectCommons.IsExistOnBattleArea(card))
  89. {
  90. return true;
  91. }
  92. return false;
  93. }
  94. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  97. if (card.Owner.HandCards.Count >= 1)
  98. {
  99. int discardCount = 1;
  100. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  101. selectHandEffect.SetUp(
  102. selectPlayer: card.Owner,
  103. canTargetCondition: (cardSource) => true,
  104. canTargetCondition_ByPreSelecetedList: null,
  105. canEndSelectCondition: null,
  106. maxCount: discardCount,
  107. canNoSelect: false,
  108. canEndNotMax: false,
  109. isShowOpponent: true,
  110. selectCardCoroutine: null,
  111. afterSelectCardCoroutine: null,
  112. mode: SelectHandEffect.Mode.Discard,
  113. cardEffect: activateClass);
  114. yield return StartCoroutine(selectHandEffect.Activate());
  115. }
  116. }
  117. }
  118. return cardEffects;
  119. }
  120. }
  121. }