ST20_13.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //ST20 Tai & Izzy
  4. namespace DCGO.CardEffects.ST20
  5. {
  6. public class ST20_13 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Cost reduction
  12. if (timing == EffectTiming.BeforePayCost)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Reduce Play Cost", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Your Turn] When any Digimon cards with the [ADVENTURE] trait would be played from your hand, by suspending this Tamer, reduce the play cost by 1.";
  21. }
  22. bool PlayCardCondition(CardSource cardSource)
  23. {
  24. if (CardEffectCommons.IsExistOnHand(cardSource))
  25. {
  26. return cardSource.EqualsTraits("ADVENTURE");
  27. }
  28. return false;
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. if (CardEffectCommons.IsExistOnBattleArea(card))
  33. {
  34. return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, PlayCardCondition);
  35. }
  36. return false;
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsOwnerTurn(card))
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  59. new List<Permanent>() { card.PermanentOfThisCard() },
  60. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  61. if (card.PermanentOfThisCard().IsSuspended)
  62. {
  63. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  64. ChangeCostClass changeCostClass = new ChangeCostClass();
  65. changeCostClass.SetUpICardEffect("Cost -1", CanUseChangeCostCondition, card);
  66. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  67. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
  68. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
  69. bool CanUseChangeCostCondition(Hashtable hashtable)
  70. {
  71. return true;
  72. }
  73. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  74. {
  75. if (CardSourceCondition(cardSource))
  76. {
  77. if (RootCondition(root))
  78. {
  79. if (PermanentsCondition(targetPermanents))
  80. {
  81. Cost -= 1;
  82. }
  83. }
  84. }
  85. return Cost;
  86. }
  87. bool PermanentsCondition(List<Permanent> targetPermanents)
  88. {
  89. return targetPermanents != null;
  90. }
  91. bool CardSourceCondition(CardSource cardSource)
  92. {
  93. if (cardSource != null)
  94. {
  95. return cardSource.Owner == card.Owner;
  96. }
  97. return false;
  98. }
  99. bool RootCondition(SelectCardEffect.Root root)
  100. {
  101. return true;
  102. }
  103. bool isUpDown()
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. }
  110. }
  111. }
  112. #endregion
  113. #region Blocker gain
  114. if (timing == EffectTiming.None)
  115. {
  116. bool CanUseCondition()
  117. {
  118. return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOpponentTurn(card);
  119. }
  120. bool PermanentCondition(Permanent permanent)
  121. {
  122. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  123. {
  124. if (permanent.TopCard.EqualsTraits("ADVENTURE"))
  125. {
  126. return true;
  127. }
  128. }
  129. return false;
  130. }
  131. cardEffects.Add(CardEffectFactory.BlockerStaticEffect(
  132. permanentCondition: PermanentCondition,
  133. isInheritedEffect: false,
  134. card: card,
  135. condition: CanUseCondition));
  136. }
  137. #endregion
  138. if (timing == EffectTiming.SecuritySkill)
  139. {
  140. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  141. }
  142. return cardEffects;
  143. }
  144. }
  145. }