BT9_090.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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_090 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] Reveal the top 3 cards of your deck. Add 1 [Tapirmon] and 1 2-color black card among them to your hand. Place the rest at the bottom of your deck in any order.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. return cardSource.CardNames.Contains("Tapirmon");
  26. }
  27. bool CanSelectCardCondition1(CardSource cardSource)
  28. {
  29. return (cardSource.CardColors.Count == 2 && cardSource.CardColors.Contains(CardColor.Black))
  30. || (cardSource.DualCardColors.Count == 2 && cardSource.DualCardColors.Contains(CardColor.Black));
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (card.Owner.LibraryCards.Count >= 1)
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  50. revealCount: 3,
  51. simplifiedSelectCardConditions:
  52. new SimplifiedSelectCardConditionClass[]
  53. {
  54. new SimplifiedSelectCardConditionClass(
  55. canTargetCondition:CanSelectCardCondition,
  56. message: "Select 1 [Tapirmon].",
  57. mode: SelectCardEffect.Mode.AddHand,
  58. maxCount: 1,
  59. selectCardCoroutine: null),
  60. new SimplifiedSelectCardConditionClass(
  61. canTargetCondition:CanSelectCardCondition1,
  62. message: "Select 1 2-color black card.",
  63. mode: SelectCardEffect.Mode.AddHand,
  64. maxCount: 1,
  65. selectCardCoroutine: null),
  66. },
  67. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  68. activateClass: activateClass,
  69. mutualConditions: true
  70. ));
  71. }
  72. }
  73. if (timing == EffectTiming.BeforePayCost)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  78. activateClass.SetHashString("Digisorption-1_BT9_090");
  79. cardEffects.Add(activateClass);
  80. string EffectDiscription()
  81. {
  82. return "[Your Turn] When one of your Digimon would digivolve into a 2-color black Digimon card, you may suspend this Tamer to reduce the digivolution cost by 1.";
  83. }
  84. bool PermanentCondition(Permanent permanent)
  85. {
  86. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card);
  87. }
  88. bool CardCondition(CardSource cardSource)
  89. {
  90. return (cardSource.CardColors.Count == 2 && cardSource.CardColors.Contains(CardColor.Black))
  91. || (cardSource.DualCardColors.Count == 2 && cardSource.DualCardColors.Contains(CardColor.Black));
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.IsExistOnBattleArea(card))
  96. {
  97. if (CardEffectCommons.IsOwnerTurn(card))
  98. {
  99. if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentCondition, CardCondition))
  100. {
  101. return true;
  102. }
  103. }
  104. }
  105. return false;
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. if (CardEffectCommons.IsExistOnBattleArea(card))
  110. {
  111. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  112. {
  113. return true;
  114. }
  115. }
  116. return false;
  117. }
  118. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  119. {
  120. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  121. new List<Permanent>() { card.PermanentOfThisCard() },
  122. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  123. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  124. ChangeCostClass changeCostClass = new ChangeCostClass();
  125. changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, card);
  126. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  127. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
  128. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
  129. bool CanUseCondition1(Hashtable hashtable)
  130. {
  131. return true;
  132. }
  133. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  134. {
  135. if (CardSourceCondition(cardSource))
  136. {
  137. if (RootCondition(root))
  138. {
  139. if (PermanentsCondition(targetPermanents))
  140. {
  141. Cost -= 1;
  142. }
  143. }
  144. }
  145. return Cost;
  146. }
  147. bool PermanentsCondition(List<Permanent> targetPermanents)
  148. {
  149. if (targetPermanents != null)
  150. {
  151. if (targetPermanents.Count(PermanentCondition) >= 1)
  152. {
  153. return true;
  154. }
  155. }
  156. return false;
  157. }
  158. bool PermanentCondition(Permanent targetPermanent)
  159. {
  160. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card);
  161. }
  162. bool CardSourceCondition(CardSource cardSource)
  163. {
  164. return true;
  165. }
  166. bool RootCondition(SelectCardEffect.Root root)
  167. {
  168. return true;
  169. }
  170. bool isUpDown()
  171. {
  172. return true;
  173. }
  174. }
  175. }
  176. if (timing == EffectTiming.SecuritySkill)
  177. {
  178. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  179. }
  180. return cardEffects;
  181. }
  182. }