RB1_034.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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_034 : 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.BeforePayCost)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. activateClass.SetHashString("DigivoltuionCost-1_RB1_034");
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Your Turn] When one of your Digimon digivolves into a green card with [Beast], [Animal] or [Sovereign], other than [Sea Animal], in one of its traits, by suspending this Tamer, reduce the digivolution cost by 1.";
  23. }
  24. bool PermanentCondition(Permanent permanent)
  25. {
  26. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card);
  27. }
  28. bool CardCondition(CardSource cardSource)
  29. {
  30. if (cardSource.HasBeastTraits)
  31. {
  32. if (cardSource.HasCardColor(CardColor.Green))
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (CardEffectCommons.IsOwnerTurn(card))
  44. {
  45. if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentCondition, CardCondition))
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleArea(card))
  56. {
  57. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  65. {
  66. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  67. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  68. ChangeCostClass changeCostClass = new ChangeCostClass();
  69. changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, card);
  70. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  71. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
  73. bool CanUseCondition1(Hashtable hashtable)
  74. {
  75. return true;
  76. }
  77. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  78. {
  79. if (CardSourceCondition(cardSource))
  80. {
  81. if (RootCondition(root))
  82. {
  83. if (PermanentsCondition(targetPermanents))
  84. {
  85. Cost -= 1;
  86. }
  87. }
  88. }
  89. return Cost;
  90. }
  91. bool PermanentsCondition(List<Permanent> targetPermanents)
  92. {
  93. if (targetPermanents != null)
  94. {
  95. if (targetPermanents.Count(PermanentCondition) >= 1)
  96. {
  97. return true;
  98. }
  99. }
  100. return false;
  101. }
  102. bool PermanentCondition(Permanent targetPermanent)
  103. {
  104. if (targetPermanent.TopCard != null)
  105. {
  106. if (targetPermanent.TopCard.Owner == card.Owner)
  107. {
  108. if (targetPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(targetPermanent))
  109. {
  110. return true;
  111. }
  112. }
  113. }
  114. return false;
  115. }
  116. bool CardSourceCondition(CardSource cardSource)
  117. {
  118. if (cardSource != null)
  119. {
  120. if (cardSource.Owner == card.Owner)
  121. {
  122. if (cardSource.HasBeastTraits && cardSource.HasCardColor(CardColor.Green))
  123. {
  124. return true;
  125. }
  126. }
  127. }
  128. return false;
  129. }
  130. bool RootCondition(SelectCardEffect.Root root)
  131. {
  132. return true;
  133. }
  134. bool isUpDown()
  135. {
  136. return true;
  137. }
  138. }
  139. }
  140. if (timing == EffectTiming.OnEndTurn)
  141. {
  142. ActivateClass activateClass = new ActivateClass();
  143. activateClass.SetUpICardEffect("Unsuspend 1 Digimon", CanUseCondition, card);
  144. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  145. activateClass.SetHashString("Unsuspend_RB1_034");
  146. cardEffects.Add(activateClass);
  147. string EffectDiscription()
  148. {
  149. return "[End of Your Turn][Once Per Turn] You may unsuspend 1 of your Digimon with [Angoramon] in its text.";
  150. }
  151. bool CanSelectPermanentCondition(Permanent permanent)
  152. {
  153. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  154. {
  155. if (permanent.TopCard.HasText("Angoramon"))
  156. {
  157. return true;
  158. }
  159. }
  160. return false;
  161. }
  162. bool CanUseCondition(Hashtable hashtable)
  163. {
  164. if (CardEffectCommons.IsExistOnBattleArea(card))
  165. {
  166. if (CardEffectCommons.IsOwnerTurn(card))
  167. {
  168. return true;
  169. }
  170. }
  171. return false;
  172. }
  173. bool CanActivateCondition(Hashtable hashtable)
  174. {
  175. if (CardEffectCommons.IsExistOnBattleArea(card))
  176. {
  177. return true;
  178. }
  179. return false;
  180. }
  181. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  182. {
  183. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  184. {
  185. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  186. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  187. selectPermanentEffect.SetUp(
  188. selectPlayer: card.Owner,
  189. canTargetCondition: CanSelectPermanentCondition,
  190. canTargetCondition_ByPreSelecetedList: null,
  191. canEndSelectCondition: null,
  192. maxCount: maxCount,
  193. canNoSelect: false,
  194. canEndNotMax: false,
  195. selectPermanentCoroutine: null,
  196. afterSelectPermanentCoroutine: null,
  197. mode: SelectPermanentEffect.Mode.UnTap,
  198. cardEffect: activateClass);
  199. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  200. }
  201. }
  202. }
  203. if (timing == EffectTiming.SecuritySkill)
  204. {
  205. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  206. }
  207. return cardEffects;
  208. }
  209. }