BT1_039.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 BT1_039 : 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.OnAllyAttack)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 2, true, EffectDiscription());
  18. activateClass.SetHashString("Unsuspend_BT1_039");
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[When Attacking][Twice Per Turn] You can unsuspend this Digimon by trashing 3 cards in your hand.";
  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 >= 3)
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  40. {
  41. int discardCount = Math.Min(3, card.Owner.HandCards.Count);
  42. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  43. selectHandEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: (cardSource) => true,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: discardCount,
  49. canNoSelect: false,
  50. canEndNotMax: false,
  51. isShowOpponent: true,
  52. selectCardCoroutine: null,
  53. afterSelectCardCoroutine: null,
  54. mode: SelectHandEffect.Mode.Discard,
  55. cardEffect: activateClass);
  56. yield return StartCoroutine(selectHandEffect.Activate());
  57. Permanent selectedPermanent = card.PermanentOfThisCard();
  58. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  59. }
  60. }
  61. return cardEffects;
  62. }
  63. }