BT11_091.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_091 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool Condition()
  14. {
  15. if (CardEffectCommons.IsExistOnBattleArea(card))
  16. {
  17. if (CardEffectCommons.IsOwnerTurn(card))
  18. {
  19. return true;
  20. }
  21. }
  22. return false;
  23. }
  24. bool PermanentCondition(Permanent permanent)
  25. {
  26. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  27. {
  28. return true;
  29. }
  30. return false;
  31. }
  32. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  33. permanentCondition: PermanentCondition,
  34. changeValue: 1000,
  35. isInheritedEffect: false,
  36. card: card,
  37. condition: Condition,
  38. effectName: () => "Your Digimon gain DP +1000"));
  39. }
  40. if (timing == EffectTiming.BeforePayCost)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  45. activateClass.SetHashString("Digisorption-1_BT11_091");
  46. cardEffects.Add(activateClass);
  47. string EffectDiscription()
  48. {
  49. return "[Your Turn] When one of your green Digimon would digivolve into a level 5 or higher card, by suspending this Tamer, reduce the digivolution cost by 1.";
  50. }
  51. bool PermanentCondition(Permanent permanent)
  52. {
  53. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  54. {
  55. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. bool CardCondition(CardSource cardSource)
  63. {
  64. if (cardSource.Level >= 5)
  65. {
  66. if (cardSource.HasLevel)
  67. {
  68. return true;
  69. }
  70. }
  71. return false;
  72. }
  73. bool CanUseCondition(Hashtable hashtable)
  74. {
  75. if (CardEffectCommons.IsExistOnBattleArea(card))
  76. {
  77. if (CardEffectCommons.IsOwnerTurn(card))
  78. {
  79. if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentCondition, CardCondition))
  80. {
  81. return true;
  82. }
  83. }
  84. }
  85. return false;
  86. }
  87. bool CanActivateCondition(Hashtable hashtable)
  88. {
  89. if (CardEffectCommons.IsExistOnBattleArea(card))
  90. {
  91. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  92. {
  93. return true;
  94. }
  95. }
  96. return false;
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  101. new List<Permanent>() { card.PermanentOfThisCard() },
  102. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  103. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  104. ChangeCostClass changeCostClass = new ChangeCostClass();
  105. changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, card);
  106. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  107. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
  108. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
  109. bool CanUseCondition1(Hashtable hashtable)
  110. {
  111. return true;
  112. }
  113. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  114. {
  115. if (CardSourceCondition(cardSource))
  116. {
  117. if (RootCondition(root))
  118. {
  119. if (PermanentsCondition(targetPermanents))
  120. {
  121. Cost -= 1;
  122. }
  123. }
  124. }
  125. return Cost;
  126. }
  127. bool PermanentsCondition(List<Permanent> targetPermanents)
  128. {
  129. if (targetPermanents != null)
  130. {
  131. if (targetPermanents.Count(PermanentCondition) >= 1)
  132. {
  133. return true;
  134. }
  135. }
  136. return false;
  137. }
  138. bool PermanentCondition(Permanent targetPermanent)
  139. {
  140. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card);
  141. }
  142. bool CardSourceCondition(CardSource cardSource)
  143. {
  144. return true;
  145. }
  146. bool RootCondition(SelectCardEffect.Root root)
  147. {
  148. return true;
  149. }
  150. bool isUpDown()
  151. {
  152. return true;
  153. }
  154. }
  155. }
  156. if (timing == EffectTiming.SecuritySkill)
  157. {
  158. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  159. }
  160. return cardEffects;
  161. }
  162. }
  163. }