BT2_112.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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_112 : 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. ChangeCostClass changeCostClass = new ChangeCostClass();
  16. changeCostClass.SetUpICardEffect($"Play Cost -6", CanUseCondition, card);
  17. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  18. cardEffects.Add(changeCostClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. if (card.Owner.HandCards.Contains(card))
  22. {
  23. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && permanent.DP >= 10000))
  24. {
  25. return true;
  26. }
  27. }
  28. return false;
  29. }
  30. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  31. {
  32. if (CardSourceCondition(cardSource))
  33. {
  34. if (RootCondition(root))
  35. {
  36. if (PermanentsCondition(targetPermanents))
  37. {
  38. Cost -= 6;
  39. }
  40. }
  41. }
  42. return Cost;
  43. }
  44. bool PermanentsCondition(List<Permanent> targetPermanents)
  45. {
  46. if (targetPermanents == null)
  47. {
  48. return true;
  49. }
  50. else
  51. {
  52. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. bool CardSourceCondition(CardSource cardSource)
  60. {
  61. return cardSource == card;
  62. }
  63. bool RootCondition(SelectCardEffect.Root root)
  64. {
  65. if (root == SelectCardEffect.Root.Hand)
  66. {
  67. return true;
  68. }
  69. return false;
  70. }
  71. bool isUpDown()
  72. {
  73. return true;
  74. }
  75. }
  76. if (timing == EffectTiming.OnAllyAttack)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  80. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  81. cardEffects.Add(activateClass);
  82. string EffectDiscription()
  83. {
  84. return "[When Attacking] When you attack your opponent's Digimon with the highest DP, unsuspend this Digimon.";
  85. }
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. if (CardEffectCommons.CanTriggerOnAttack(hashtable, card))
  89. {
  90. if (CardEffectCommons.IsMaxDP(GManager.instance.attackProcess.DefendingPermanent, card.Owner.Enemy, null))
  91. {
  92. return true;
  93. }
  94. }
  95. return false;
  96. }
  97. bool CanActivateCondition(Hashtable hashtable)
  98. {
  99. if (CardEffectCommons.IsExistOnBattleArea(card))
  100. {
  101. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  102. {
  103. return true;
  104. }
  105. }
  106. return false;
  107. }
  108. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  109. {
  110. Permanent selectedPermanent = card.PermanentOfThisCard();
  111. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  112. }
  113. }
  114. return cardEffects;
  115. }
  116. }