P_087.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 P_087 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Draw 1 and Memory +1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Your Turn] When you would play a [Pulsemon], by suspending this tamer, if you have 3 or more security cards, <Draw 1> (Draw 1 card from your deck). If you have 3 or fewer security cards, gain 1 memory.";
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.TopCard.CardNames.Contains("Pulsemon"))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (CardEffectCommons.IsOwnerTurn(card))
  39. {
  40. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  62. if (card.Owner.SecurityCards.Count >= 3)
  63. {
  64. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  65. }
  66. if (card.Owner.SecurityCards.Count <= 3)
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  69. }
  70. }
  71. }
  72. if (timing == EffectTiming.SecuritySkill)
  73. {
  74. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  75. }
  76. return cardEffects;
  77. }
  78. }