BT9_025.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 BT9_025 : 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.OnEndAttack)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  18. activateClass.SetHashString("Unsuspend_BT9_025");
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[End of Attack][Once Per Turn] You may trash 2 cards in your hand to unsuspend this Digimon.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnBattleArea(card))
  31. {
  32. if (card.Owner.HandCards.Count >= 2)
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  40. {
  41. if (isExistOnField(card))
  42. {
  43. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  44. {
  45. if (card.Owner.HandCards.Count >= 2)
  46. {
  47. if (card.Owner.HandCards.Count >= 1)
  48. {
  49. int discardCount = 2;
  50. if (card.Owner.HandCards.Count < discardCount)
  51. {
  52. discardCount = card.Owner.HandCards.Count;
  53. }
  54. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  55. selectHandEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: (cardSource) => true,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: discardCount,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. isShowOpponent: true,
  64. selectCardCoroutine: null,
  65. afterSelectCardCoroutine: null,
  66. mode: SelectHandEffect.Mode.Discard,
  67. cardEffect: activateClass);
  68. yield return StartCoroutine(selectHandEffect.Activate());
  69. }
  70. Permanent selectedPermanent = card.PermanentOfThisCard();
  71. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  72. }
  73. }
  74. }
  75. }
  76. }
  77. return cardEffects;
  78. }
  79. }