BT18_075.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class BT18_075 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Your Turn
  11. if (timing == EffectTiming.BeforePayCost)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  16. activateClass.SetHashString("ReduceDigivolutionCost-1_BT18_75");
  17. cardEffects.Add(activateClass);
  18. string EffectDescription()
  19. {
  20. return
  21. "[Your Turn] (Once Per Turn) When this Digimon or any of your Tamers would digivolve into a multicolored Digimon that is purple or yellow, reduce the digivolution cost by 1.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  26. CardEffectCommons.IsOwnerTurn(card) &&
  27. CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable,
  28. DigivolveFromPermanentCondition, DigivolveToCardCondition);
  29. }
  30. bool DigivolveFromPermanentCondition(Permanent permanent)
  31. {
  32. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  33. (permanent == card.PermanentOfThisCard() || permanent.IsTamer);
  34. }
  35. bool DigivolveToCardCondition(CardSource cardSource)
  36. {
  37. return cardSource.IsDigimon && cardSource.CardColors.Count > 1 &&
  38. (cardSource.CardColors.Contains(CardColor.Purple) || cardSource.CardColors.Contains(CardColor.Yellow));
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable hashtable)
  45. {
  46. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  47. ChangeCostClass changeCostClass = new ChangeCostClass();
  48. changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseReduceCondition, card);
  49. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition,
  50. rootCondition: RootCondition, isUpDown: IsUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  51. card.Owner.UntilCalculateFixedCostEffect.Add(_ => changeCostClass);
  52. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(hashtable));
  53. bool CanUseReduceCondition(Hashtable reduceHashtable)
  54. {
  55. return true;
  56. }
  57. int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  58. {
  59. if (CardSourceCondition(cardSource) && RootCondition(root) && PermanentsCondition(targetPermanents))
  60. {
  61. cost -= 1;
  62. }
  63. return cost;
  64. }
  65. bool PermanentsCondition(List<Permanent> targetPermanents)
  66. {
  67. return targetPermanents != null && targetPermanents.Some(PermanentCondition);
  68. }
  69. bool PermanentCondition(Permanent targetPermanent)
  70. {
  71. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card);
  72. }
  73. bool CardSourceCondition(CardSource cardSource)
  74. {
  75. return cardSource.Owner == card.Owner;
  76. }
  77. bool RootCondition(SelectCardEffect.Root root)
  78. {
  79. return true;
  80. }
  81. bool IsUpDown()
  82. {
  83. return true;
  84. }
  85. }
  86. }
  87. #endregion
  88. #region Retaliation - ESS
  89. if (timing == EffectTiming.OnDestroyedAnyone)
  90. {
  91. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  92. }
  93. #endregion
  94. return cardEffects;
  95. }
  96. }
  97. }