BT15_069.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT15
  4. {
  5. public class BT15_069 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnDestroyedAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Draw 1 and/or gain Memory +1", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Deletion] If your opponent has 1 or less memory, <Draw 1>. If your opponent has 1 or more memory, gain 1 memory.";
  19. }
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  23. }
  24. bool CanActivateCondition(Hashtable hashtable)
  25. {
  26. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  27. {
  28. if (card.Owner.Enemy.MemoryForPlayer <= 1)
  29. {
  30. if (card.Owner.LibraryCards.Count >= 1)
  31. {
  32. return true;
  33. }
  34. }
  35. if (card.Owner.Enemy.MemoryForPlayer >= 1)
  36. {
  37. if (card.Owner.CanAddMemory(activateClass))
  38. {
  39. return true;
  40. }
  41. }
  42. }
  43. return false;
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  46. {
  47. if (card.Owner.Enemy.MemoryForPlayer <= 1)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  50. }
  51. if (card.Owner.Enemy.MemoryForPlayer >= 1)
  52. {
  53. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  54. }
  55. }
  56. }
  57. return cardEffects;
  58. }
  59. }
  60. }