BT9_085.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 BT9_085 : 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.OnStartMainPhase)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Start of Your Main Phase] If you have 8 or more cards in hand, gain 1 memory. If your opponent has 8 or more cards in hand, 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.HandCards.Count >= 8)
  41. {
  42. return true;
  43. }
  44. if (card.Owner.Enemy.HandCards.Count >= 8)
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (card.Owner.HandCards.Count >= 8)
  55. {
  56. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  57. }
  58. if (card.Owner.Enemy.HandCards.Count >= 8)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  61. }
  62. }
  63. }
  64. if (timing == EffectTiming.OnUnTappedAnyone)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect("Return 1 level 3 Digimon to hand", CanUseCondition, card);
  68. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  69. cardEffects.Add(activateClass);
  70. string EffectDiscription()
  71. {
  72. return "[Your Turn] When one of your blue or red Digimon becomes unsuspended, you may suspend this Tamer to return 1 of your opponent's level 3 Digimon to its owner's hand.";
  73. }
  74. bool PermanentCondition(Permanent permanent)
  75. {
  76. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  77. {
  78. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  79. {
  80. return true;
  81. }
  82. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  83. {
  84. return true;
  85. }
  86. }
  87. return false;
  88. }
  89. bool CanSelectPermanentCondition(Permanent permanent)
  90. {
  91. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  92. {
  93. if (permanent.Level == 3)
  94. {
  95. if (permanent.TopCard.HasLevel)
  96. {
  97. return true;
  98. }
  99. }
  100. }
  101. return false;
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. if (CardEffectCommons.IsExistOnBattleArea(card))
  106. {
  107. if (CardEffectCommons.IsOwnerTurn(card))
  108. {
  109. if (CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, PermanentCondition))
  110. {
  111. return true;
  112. }
  113. }
  114. }
  115. return false;
  116. }
  117. bool CanActivateCondition(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.IsExistOnBattleArea(card))
  120. {
  121. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  122. {
  123. return true;
  124. }
  125. }
  126. return false;
  127. }
  128. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  129. {
  130. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  131. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  132. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectPermanentCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: maxCount,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: null,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.Bounce,
  144. cardEffect: activateClass);
  145. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  146. }
  147. }
  148. if (timing == EffectTiming.SecuritySkill)
  149. {
  150. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  151. }
  152. return cardEffects;
  153. }
  154. }