BT2_088.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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_088 : 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.None)
  14. {
  15. AddSkillClass addSkillClass = new AddSkillClass();
  16. addSkillClass.SetUpICardEffect("Your Digimon with [Tyrannomon] in their name gain Pierce", CanUseCondition, card);
  17. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  18. cardEffects.Add(addSkillClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. if (CardEffectCommons.IsExistOnBattleArea(card))
  22. {
  23. if (CardEffectCommons.IsOwnerTurn(card))
  24. {
  25. return true;
  26. }
  27. }
  28. return false;
  29. }
  30. bool PermanentCondition(Permanent permanent)
  31. {
  32. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  33. {
  34. if (permanent.TopCard.ContainsCardName("Tyrannomon"))
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. bool CardSourceCondition(CardSource cardSource)
  42. {
  43. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  44. {
  45. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  53. {
  54. if (_timing == EffectTiming.OnDetermineDoSecurityCheck)
  55. {
  56. bool Condition()
  57. {
  58. return CardSourceCondition(cardSource);
  59. }
  60. cardEffects.Add(CardEffectFactory.PierceSelfEffect(
  61. isInheritedEffect: false,
  62. card: cardSource,
  63. condition: Condition));
  64. }
  65. return cardEffects;
  66. }
  67. }
  68. if (timing == EffectTiming.BeforePayCost)
  69. {
  70. ActivateClass activateClass = new ActivateClass();
  71. activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card);
  72. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  73. activateClass.SetHashString("Digisorption-1_BT2_088");
  74. cardEffects.Add(activateClass);
  75. string EffectDiscription()
  76. {
  77. return "[Your Turn] When digivolving one of your Digimon into a Digimon card in your hand with [Tyrannomon] in its name, you may suspend this Tamer to reduce the memory cost of the digivolution by 1.";
  78. }
  79. bool PermanentCondition(Permanent permanent)
  80. {
  81. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card);
  82. }
  83. bool CardCondition(CardSource cardSource)
  84. {
  85. if (cardSource.IsDigimon)
  86. {
  87. if (cardSource.ContainsCardName("Tyrannomon"))
  88. {
  89. if (CardEffectCommons.IsExistOnHand(cardSource))
  90. {
  91. return true;
  92. }
  93. }
  94. }
  95. return false;
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. if (CardEffectCommons.IsExistOnBattleArea(card))
  100. {
  101. if (CardEffectCommons.IsOwnerTurn(card))
  102. {
  103. if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentCondition, CardCondition))
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanActivateCondition(Hashtable hashtable)
  112. {
  113. if (CardEffectCommons.IsExistOnBattleArea(card))
  114. {
  115. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  116. {
  117. return true;
  118. }
  119. }
  120. return false;
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  123. {
  124. if (isExistOnField(card))
  125. {
  126. if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
  127. {
  128. Hashtable hashtable = new Hashtable();
  129. hashtable.Add("CardEffect", activateClass);
  130. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, hashtable).Tap());
  131. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  132. ChangeCostClass changeCostClass = new ChangeCostClass();
  133. changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, card);
  134. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  135. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
  136. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
  137. bool CanUseCondition1(Hashtable hashtable)
  138. {
  139. return true;
  140. }
  141. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  142. {
  143. if (CardSourceCondition(cardSource))
  144. {
  145. if (RootCondition(root))
  146. {
  147. if (PermanentsCondition(targetPermanents))
  148. {
  149. Cost -= 1;
  150. }
  151. }
  152. }
  153. return Cost;
  154. }
  155. bool PermanentsCondition(List<Permanent> targetPermanents)
  156. {
  157. if (targetPermanents != null)
  158. {
  159. if (targetPermanents.Count(PermanentCondition) >= 1)
  160. {
  161. return true;
  162. }
  163. }
  164. return false;
  165. }
  166. bool PermanentCondition(Permanent targetPermanent)
  167. {
  168. if (targetPermanent.TopCard != null)
  169. {
  170. if (targetPermanent.TopCard.Owner == card.Owner)
  171. {
  172. if (targetPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(targetPermanent))
  173. {
  174. return true;
  175. }
  176. }
  177. }
  178. return false;
  179. }
  180. bool CardSourceCondition(CardSource cardSource)
  181. {
  182. if (cardSource != null)
  183. {
  184. if (cardSource.Owner == card.Owner)
  185. {
  186. if (cardSource.ContainsCardName("Tyrannomon"))
  187. {
  188. return true;
  189. }
  190. }
  191. }
  192. return false;
  193. }
  194. bool RootCondition(SelectCardEffect.Root root)
  195. {
  196. return true;
  197. }
  198. bool isUpDown()
  199. {
  200. return true;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. if (timing == EffectTiming.SecuritySkill)
  207. {
  208. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  209. }
  210. return cardEffects;
  211. }
  212. }