BT2_023.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 BT2_023 : 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.None)
  14. {
  15. int count()
  16. {
  17. return card.Owner.Enemy.GetBattleAreaDigimons().Count((permanent) => permanent.HasNoDigivolutionCards);
  18. }
  19. ChangeCostClass changeCostClass = new ChangeCostClass();
  20. changeCostClass.SetUpICardEffect($"Play Cost -", CanUseCondition, card);
  21. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  22. cardEffects.Add(changeCostClass);
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. if (card.Owner.HandCards.Contains(card))
  26. {
  27. if (count() >= 1)
  28. {
  29. changeCostClass.SetEffectName($"Play Cost -{count()}");
  30. return true;
  31. }
  32. }
  33. return false;
  34. }
  35. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  36. {
  37. if (CardSourceCondition(cardSource))
  38. {
  39. if (RootCondition(root))
  40. {
  41. if (PermanentsCondition(targetPermanents))
  42. {
  43. Cost -= count();
  44. }
  45. }
  46. }
  47. return Cost;
  48. }
  49. bool PermanentsCondition(List<Permanent> targetPermanents)
  50. {
  51. if (targetPermanents == null)
  52. {
  53. return true;
  54. }
  55. else
  56. {
  57. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. bool CardSourceCondition(CardSource cardSource)
  65. {
  66. return cardSource == card;
  67. }
  68. bool RootCondition(SelectCardEffect.Root root)
  69. {
  70. if (root == SelectCardEffect.Root.Hand)
  71. {
  72. return true;
  73. }
  74. return false;
  75. }
  76. bool isUpDown()
  77. {
  78. return true;
  79. }
  80. }
  81. return cardEffects;
  82. }
  83. }