P_093.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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 P_093 : 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.OnTappedAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[All Turns] When this Digimon becomes suspended, suspend 1 of your opponent's Digimon.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleArea(card))
  30. {
  31. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => permanent == card.PermanentOfThisCard()))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  43. {
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  50. {
  51. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  52. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  53. selectPermanentEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: CanSelectPermanentCondition,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: maxCount,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. selectPermanentCoroutine: null,
  62. afterSelectPermanentCoroutine: null,
  63. mode: SelectPermanentEffect.Mode.Tap,
  64. cardEffect: activateClass);
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  66. }
  67. }
  68. ActivateClass activateClass2 = new ActivateClass();
  69. activateClass2.SetUpICardEffect("Digivolution Cost -1", CanUseCondition2, card);
  70. activateClass2.SetUpActivateClass(CanActivateCondition2, ActivateCoroutine2, 1, false, EffectDiscription2());
  71. activateClass2.SetIsInheritedEffect(true);
  72. activateClass2.SetNotShowUI(true);
  73. activateClass2.SetIsBackgroundProcess(true);
  74. activateClass2.SetHashString("DigivolutionCost-1_P-093");
  75. string EffectDiscription2()
  76. {
  77. return "";
  78. }
  79. bool CanUseCondition2(Hashtable hashtable)
  80. {
  81. if (CardEffectCommons.IsExistOnBattleArea(card))
  82. {
  83. if (CardEffectCommons.IsOwnerTurn(card))
  84. {
  85. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  86. {
  87. List<CardSource> evoRootTops = CardEffectCommons.GetEvoRootTopsFromEnterFieldHashtable(
  88. hashtable,
  89. permanent => permanent.cardSources.Contains(card));
  90. if (evoRootTops != null)
  91. {
  92. if (!evoRootTops.Contains(card))
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. }
  99. }
  100. return false;
  101. }
  102. bool CanActivateCondition2(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.IsExistOnBattleArea(card);
  105. }
  106. IEnumerator ActivateCoroutine2(Hashtable _hashtable)
  107. {
  108. yield return null;
  109. }
  110. if (timing == EffectTiming.OnEnterFieldAnyone)
  111. {
  112. cardEffects.Add(activateClass2);
  113. }
  114. if (timing == EffectTiming.None)
  115. {
  116. ChangeCostClass changeCostClass = new ChangeCostClass();
  117. changeCostClass.SetUpICardEffect($"Digivolution Cost -1", CanUseCondition, card);
  118. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  119. changeCostClass.SetIsInheritedEffect(true);
  120. cardEffects.Add(changeCostClass);
  121. bool CanUseCondition(Hashtable hashtable)
  122. {
  123. if (CardEffectCommons.IsExistOnBattleArea(card))
  124. {
  125. if (CardEffectCommons.IsOwnerTurn(card))
  126. {
  127. if (!card.cEntity_EffectController.isOverMaxCountPerTurn(activateClass2, activateClass2.MaxCountPerTurn))
  128. {
  129. return true;
  130. }
  131. }
  132. }
  133. return false;
  134. }
  135. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  136. {
  137. if (CardSourceCondition(cardSource))
  138. {
  139. if (RootCondition(root))
  140. {
  141. if (PermanentsCondition(targetPermanents))
  142. {
  143. Cost -= 1;
  144. }
  145. }
  146. }
  147. return Cost;
  148. }
  149. bool PermanentsCondition(List<Permanent> targetPermanents)
  150. {
  151. if (targetPermanents != null)
  152. {
  153. if (targetPermanents.Count(PermanentCondition) >= 1)
  154. {
  155. return true;
  156. }
  157. }
  158. return false;
  159. }
  160. bool PermanentCondition(Permanent targetPermanent)
  161. {
  162. return targetPermanent == card.PermanentOfThisCard();
  163. }
  164. bool CardSourceCondition(CardSource cardSource)
  165. {
  166. return cardSource.Owner == card.Owner;
  167. }
  168. bool RootCondition(SelectCardEffect.Root root)
  169. {
  170. return true;
  171. }
  172. bool isUpDown()
  173. {
  174. return true;
  175. }
  176. }
  177. return cardEffects;
  178. }
  179. }