BT7_076.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT7_076 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnDiscardHand)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "When you trash this card in your hand using one of your effects, trigger <Draw 1>. (Draw 1 card from your deck.)";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. bool SkillCondition(ICardEffect cardEffect)
  26. {
  27. if (cardEffect != null)
  28. {
  29. if (cardEffect.EffectSourceCard != null)
  30. {
  31. if (cardEffect.EffectSourceCard.Owner == card.Owner)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. return CardEffectCommons.CanTriggerOnTrashSelfHand(hashtable, SkillCondition, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnTrash(card))
  44. {
  45. if (card.Owner.LibraryCards.Count >= 1)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  55. }
  56. }
  57. if (timing == EffectTiming.OnAllyAttack)
  58. {
  59. ActivateClass activateClass = new ActivateClass();
  60. activateClass.SetUpICardEffect("Trash 1 card from hand to gain Memory +1", CanUseCondition, card);
  61. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  62. activateClass.SetIsInheritedEffect(true);
  63. activateClass.SetHashString("Memory+1_BT7_076");
  64. cardEffects.Add(activateClass);
  65. string EffectDiscription()
  66. {
  67. return "[When Attacking][Once Per Turn] You may trash 1 card in your hand to gain 1 memory.";
  68. }
  69. bool CanUseCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  72. }
  73. bool CanActivateCondition(Hashtable hashtable)
  74. {
  75. if (CardEffectCommons.IsExistOnBattleArea(card))
  76. {
  77. if (card.Owner.HandCards.Count >= 1)
  78. {
  79. return true;
  80. }
  81. }
  82. return false;
  83. }
  84. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  85. {
  86. if (card.Owner.HandCards.Count >= 1)
  87. {
  88. bool discarded = false;
  89. int discardCount = 1;
  90. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  91. selectHandEffect.SetUp(
  92. selectPlayer: card.Owner,
  93. canTargetCondition: (cardSource) => true,
  94. canTargetCondition_ByPreSelecetedList: null,
  95. canEndSelectCondition: null,
  96. maxCount: discardCount,
  97. canNoSelect: true,
  98. canEndNotMax: false,
  99. isShowOpponent: true,
  100. selectCardCoroutine: null,
  101. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  102. mode: SelectHandEffect.Mode.Discard,
  103. cardEffect: activateClass);
  104. yield return StartCoroutine(selectHandEffect.Activate());
  105. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  106. {
  107. if (cardSources.Count >= 1)
  108. {
  109. discarded = true;
  110. yield return null;
  111. }
  112. }
  113. if (discarded)
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  116. }
  117. }
  118. }
  119. }
  120. return cardEffects;
  121. }
  122. }