FunBeemon_BT19_045.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class FunBeemon_BT19_045 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel2 &&
  17. targetPermanent.TopCard.EqualsTraits("Royal Base");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false,
  21. card: card, condition: null));
  22. }
  23. #endregion
  24. #region Your Turn
  25. if (timing == EffectTiming.BeforePayCost)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. activateClass.SetHashString("DigivoltuionCost-1_BT19_045");
  31. cardEffects.Add(activateClass);
  32. string EffectDiscription()
  33. {
  34. return "[Your Turn] When this Digimon would digivolve into a Digimon card with the [Royal Base] trait, reduce the digivolution cost by 1.";
  35. }
  36. bool PermanentCondition(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  39. {
  40. if (permanent == card.PermanentOfThisCard())
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. bool CardCondition(CardSource cardSource)
  48. {
  49. if (cardSource.IsDigimon)
  50. {
  51. return cardSource.EqualsTraits("Royal Base");
  52. }
  53. return false;
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleArea(card))
  58. {
  59. if (CardEffectCommons.IsOwnerTurn(card))
  60. {
  61. if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentCondition, CardCondition))
  62. {
  63. return true;
  64. }
  65. }
  66. }
  67. return false;
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. if (CardEffectCommons.IsExistOnBattleArea(card))
  72. {
  73. return true;
  74. }
  75. return false;
  76. }
  77. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  78. {
  79. if (isExistOnField(card))
  80. {
  81. Hashtable hashtable = new Hashtable();
  82. hashtable.Add("CardEffect", activateClass);
  83. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  84. ChangeCostClass changeCostClass = new ChangeCostClass();
  85. changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, card);
  86. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  87. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
  88. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
  89. bool CanUseCondition1(Hashtable hashtable)
  90. {
  91. return true;
  92. }
  93. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  94. {
  95. if (CardSourceCondition(cardSource))
  96. {
  97. if (RootCondition(root))
  98. {
  99. if (PermanentsCondition(targetPermanents))
  100. {
  101. Cost -= 1;
  102. }
  103. }
  104. }
  105. return Cost;
  106. }
  107. bool PermanentsCondition(List<Permanent> targetPermanents)
  108. {
  109. if (targetPermanents != null)
  110. {
  111. if (targetPermanents.Count(PermanentCondition) >= 1)
  112. {
  113. return true;
  114. }
  115. }
  116. return false;
  117. }
  118. bool PermanentCondition(Permanent targetPermanent)
  119. {
  120. if (targetPermanent.TopCard != null)
  121. {
  122. if (targetPermanent.TopCard.Owner == card.Owner)
  123. {
  124. if (targetPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(targetPermanent))
  125. {
  126. return true;
  127. }
  128. }
  129. }
  130. return false;
  131. }
  132. bool CardSourceCondition(CardSource cardSource)
  133. {
  134. if (cardSource != null)
  135. {
  136. if (cardSource.Owner == card.Owner)
  137. {
  138. return cardSource.EqualsTraits("Royal Base");
  139. }
  140. }
  141. return false;
  142. }
  143. bool RootCondition(SelectCardEffect.Root root)
  144. {
  145. return true;
  146. }
  147. bool isUpDown()
  148. {
  149. return true;
  150. }
  151. }
  152. }
  153. }
  154. #endregion
  155. #region All Turns - ESS
  156. if (timing == EffectTiming.None)
  157. {
  158. bool Condition()
  159. {
  160. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  161. }
  162. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  163. }
  164. #endregion
  165. #region All Turns - Security
  166. if (timing == EffectTiming.None)
  167. {
  168. string EffectDiscription()
  169. {
  170. return "(Security) [All Turns] All of your [Royal Base] trait Digimon get +1000 DP.";
  171. }
  172. bool Condition()
  173. {
  174. return CardEffectCommons.IsExistInSecurity(card, false);
  175. }
  176. bool PermanentCondition(Permanent permanent)
  177. {
  178. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  179. {
  180. if (permanent.TopCard.EqualsTraits("Royal Base"))
  181. {
  182. return true;
  183. }
  184. }
  185. return false;
  186. }
  187. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  188. permanentCondition: PermanentCondition,
  189. changeValue: 1000,
  190. isInheritedEffect: false,
  191. card: card,
  192. condition: Condition,
  193. effectName: EffectDiscription));
  194. }
  195. #endregion
  196. return cardEffects;
  197. }
  198. }
  199. }