BT2_032.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 BT2_032 : 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.OnTappedAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Your Turn] When one of your blue Tamers becomes suspended, unsuspend this Digimon.";
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  26. {
  27. if (permanent.IsTamer)
  28. {
  29. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (CardEffectCommons.IsOwnerTurn(card))
  42. {
  43. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. Permanent selectedPermanent = card.PermanentOfThisCard();
  65. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  66. }
  67. }
  68. if (timing == EffectTiming.OnUnTappedAnyone)
  69. {
  70. ActivateClass activateClass = new ActivateClass();
  71. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  72. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  73. activateClass.SetHashString("Memory+1_BT2_032");
  74. cardEffects.Add(activateClass);
  75. string EffectDiscription()
  76. {
  77. return "[Your Turn][Once Per Turn] When this Digimon becomes unsuspended during your main phase, gain 1 memory.";
  78. }
  79. bool CanUseCondition(Hashtable hashtable)
  80. {
  81. if (CardEffectCommons.IsExistOnBattleArea(card))
  82. {
  83. if (CardEffectCommons.IsOwnerTurn(card))
  84. {
  85. if (GManager.instance.turnStateMachine.gameContext.TurnPhase == GameContext.phase.Main)
  86. {
  87. if (CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, permanent => permanent == card.PermanentOfThisCard()))
  88. {
  89. return true;
  90. }
  91. }
  92. }
  93. }
  94. return false;
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. if (CardEffectCommons.IsExistOnBattleArea(card))
  99. {
  100. return true;
  101. }
  102. return false;
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  107. }
  108. }
  109. return cardEffects;
  110. }
  111. }