RB1_035.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 RB1_035 : 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.OnStartTurn)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Start of Your Turn] If your opponent has 3 or more Tamers, gain 1 memory.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. if (CardEffectCommons.IsExistOnBattleArea(card))
  26. {
  27. if (CardEffectCommons.IsOwnerTurn(card))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (card.Owner.CanAddMemory(activateClass))
  39. {
  40. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(permanent => permanent.IsTamer) >= 3)
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  51. }
  52. }
  53. if (timing == EffectTiming.OnEnterFieldAnyone)
  54. {
  55. ActivateClass activateClass = new ActivateClass();
  56. activateClass.SetUpICardEffect("Memory +1 or draw 1", CanUseCondition, card);
  57. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  58. cardEffects.Add(activateClass);
  59. string EffectDiscription()
  60. {
  61. return "[All Turns] When an opponent plays a Digimon, by suspending this Tamer, gain 1 memory if that Digimon is level 4 or higher, and <Draw 1> if it is level 3.";
  62. }
  63. bool PermanentCondition(Permanent permanent)
  64. {
  65. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  66. }
  67. bool CanUseCondition(Hashtable hashtable)
  68. {
  69. if (CardEffectCommons.IsExistOnBattleArea(card))
  70. {
  71. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  72. {
  73. return true;
  74. }
  75. }
  76. return false;
  77. }
  78. bool CanActivateCondition(Hashtable hashtable)
  79. {
  80. if (CardEffectCommons.IsExistOnBattleArea(card))
  81. {
  82. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  83. {
  84. return true;
  85. }
  86. }
  87. return false;
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  92. List<Permanent> permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
  93. hashtable: _hashtable,
  94. rootCondition: null);
  95. if (permanents != null)
  96. {
  97. if (permanents.Some(permanent => permanent.TopCard.HasLevel && permanent.Level >= 4))
  98. {
  99. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  100. }
  101. if (permanents.Some(permanent => permanent.TopCard.HasLevel && permanent.Level == 3))
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  104. }
  105. }
  106. }
  107. }
  108. if (timing == EffectTiming.SecuritySkill)
  109. {
  110. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  111. }
  112. return cardEffects;
  113. }
  114. }