BT7_037.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_037 : 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, -1, false, EffectDiscription());
  18. activateClass.SetIsInheritedEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Opponent's Turn] When an opponent's Digimon attacks a player, if you have 3 or more security cards, unsuspend this Digimon.";
  23. }
  24. bool PermanentCondition(Permanent permanent)
  25. {
  26. return CardEffectCommons.IsOpponentPermanent(permanent, card);
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnBattleArea(card))
  31. {
  32. if (CardEffectCommons.IsOpponentTurn(card))
  33. {
  34. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  35. {
  36. if (GManager.instance.attackProcess.DefendingPermanent == null)
  37. {
  38. return true;
  39. }
  40. }
  41. }
  42. }
  43. return false;
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  50. {
  51. if (card.Owner.SecurityCards.Count >= 3)
  52. {
  53. return true;
  54. }
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. Permanent selectedPermanent = card.PermanentOfThisCard();
  62. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  63. }
  64. }
  65. return cardEffects;
  66. }
  67. }