BT4_115.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 BT4_115 : 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 -8", CanUseCondition, card);
  17. changeCostClass.SetUpChangeCostClass(
  18. changeCostFunc: ChangeCost,
  19. cardSourceCondition: CardSourceCondition,
  20. rootCondition: RootCondition,
  21. isUpDown: isUpDown,
  22. isCheckAvailability: () => false,
  23. isChangePayingCost: () => true);
  24. cardEffects.Add(changeCostClass);
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. if (card.Owner.HandCards.Contains(card))
  28. {
  29. if (card.Owner.TrashCards.Count >= 10)
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  37. {
  38. if (CardSourceCondition(cardSource))
  39. {
  40. if (RootCondition(root))
  41. {
  42. if (PermanentsCondition(targetPermanents))
  43. {
  44. Cost -= 8;
  45. }
  46. }
  47. }
  48. return Cost;
  49. }
  50. bool PermanentsCondition(List<Permanent> targetPermanents)
  51. {
  52. if (targetPermanents == null)
  53. {
  54. return true;
  55. }
  56. else
  57. {
  58. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. bool CardSourceCondition(CardSource cardSource)
  66. {
  67. return cardSource == card;
  68. }
  69. bool RootCondition(SelectCardEffect.Root root)
  70. {
  71. return root == SelectCardEffect.Root.Hand;
  72. }
  73. bool isUpDown()
  74. {
  75. return true;
  76. }
  77. }
  78. if (timing == EffectTiming.OnEnterFieldAnyone)
  79. {
  80. ActivateClass activateClass = new ActivateClass();
  81. activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card);
  82. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  83. cardEffects.Add(activateClass);
  84. string EffectDiscription()
  85. {
  86. return "[On Play] Trigger <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.)";
  87. }
  88. bool CanUseCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  91. }
  92. bool CanActivateCondition(Hashtable hashtable)
  93. {
  94. if (CardEffectCommons.IsExistOnBattleArea(card))
  95. {
  96. if (card.Owner.LibraryCards.Count >= 1)
  97. {
  98. if (card.Owner.CanAddSecurity(activateClass))
  99. {
  100. return true;
  101. }
  102. }
  103. }
  104. return false;
  105. }
  106. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  109. }
  110. }
  111. if (timing == EffectTiming.None)
  112. {
  113. bool Condition()
  114. {
  115. if (CardEffectCommons.IsExistOnBattleArea(card))
  116. {
  117. if (CardEffectCommons.IsOwnerTurn(card))
  118. {
  119. return true;
  120. }
  121. }
  122. return false;
  123. }
  124. bool CardCondition(CardSource cardSource)
  125. {
  126. return !cardSource.ContainsCardName("Lucemon");
  127. }
  128. cardEffects.Add(CardEffectFactory.CanNotDigivolveStaticSelfEffect(
  129. cardCondition: CardCondition,
  130. isInheritedEffect: false,
  131. card: card,
  132. condition: Condition,
  133. effectName: "This Digimon can digivolve only to Digimon card with [Lucemon] in its name")
  134. );
  135. }
  136. return cardEffects;
  137. }
  138. }