SlashAngemon_BT16_035.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class SlashAngemon_BT16_035 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Barrier and Reboot
  11. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  12. {
  13. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.None)
  16. {
  17. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)) ;
  18. }
  19. #endregion
  20. #region All Turns
  21. if (timing == EffectTiming.OnLoseSecurity)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  26. activateClass.SetHashString("Unsuspend_BT16-035");
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[All Turns][Once per turn] When a card is removed from your security stack, you may unsuspend this Digimon.";
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. if (CardEffectCommons.IsExistOnBattleArea(card))
  35. {
  36. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner))
  37. {
  38. return true;
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleArea(card))
  46. {
  47. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. Permanent selectedPermanent = card.PermanentOfThisCard();
  57. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  58. }
  59. }
  60. #endregion
  61. return cardEffects;
  62. }
  63. }
  64. }