ST9_05.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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 ST9_05 : 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. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  16. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  17. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  18. addJogressConditionClass.SetNotShowUI(true);
  19. cardEffects.Add(addJogressConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return true;
  23. }
  24. JogressCondition GetJogress(CardSource cardSource)
  25. {
  26. if (cardSource == card)
  27. {
  28. bool PermanentCondition1(Permanent permanent)
  29. {
  30. if (permanent != null)
  31. {
  32. if (permanent.TopCard != null)
  33. {
  34. if (permanent.TopCard.Owner == card.Owner)
  35. {
  36. if (permanent.IsDigimon)
  37. {
  38. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  39. {
  40. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  41. {
  42. if (permanent.Levels_ForJogress(card).Contains(4))
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool PermanentCondition2(Permanent permanent)
  55. {
  56. if (permanent != null)
  57. {
  58. if (permanent.TopCard != null)
  59. {
  60. if (permanent.TopCard.Owner == card.Owner)
  61. {
  62. if (permanent.IsDigimon)
  63. {
  64. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  65. {
  66. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  67. {
  68. if (permanent.Levels_ForJogress(card).Contains(4))
  69. {
  70. return true;
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }
  77. }
  78. return false;
  79. }
  80. JogressConditionElement[] elements = new JogressConditionElement[]
  81. {
  82. new JogressConditionElement(PermanentCondition1, "a level 4 blue Digimon"),
  83. new JogressConditionElement(PermanentCondition2, "a level 4 green Digimon"),
  84. };
  85. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  86. return jogressCondition;
  87. }
  88. return null;
  89. }
  90. }
  91. if (timing == EffectTiming.OnEnterFieldAnyone)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("Return 1 Digimon with 6000 DP or less to the bottom of deck", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  96. cardEffects.Add(activateClass);
  97. string EffectDiscription()
  98. {
  99. return "[When Digivolving] When DNA digivolving, return 1 of your opponent's Digimon with 6000 DP or less to the bottom of its owner's deck.";
  100. }
  101. bool CanSelectPermanentCondition(Permanent permanent)
  102. {
  103. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  104. {
  105. if (permanent.DP <= 6000)
  106. {
  107. return true;
  108. }
  109. }
  110. return false;
  111. }
  112. bool CanUseCondition(Hashtable hashtable)
  113. {
  114. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  115. {
  116. if (CardEffectCommons.IsJogress(hashtable))
  117. {
  118. return true;
  119. }
  120. }
  121. return false;
  122. }
  123. bool CanActivateCondition(Hashtable hashtable)
  124. {
  125. if (CardEffectCommons.IsExistOnBattleArea(card))
  126. {
  127. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  128. {
  129. return true;
  130. }
  131. }
  132. return false;
  133. }
  134. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  135. {
  136. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  137. {
  138. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  139. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  140. selectPermanentEffect.SetUp(
  141. selectPlayer: card.Owner,
  142. canTargetCondition: CanSelectPermanentCondition,
  143. canTargetCondition_ByPreSelecetedList: null,
  144. canEndSelectCondition: null,
  145. maxCount: maxCount,
  146. canNoSelect: false,
  147. canEndNotMax: false,
  148. selectPermanentCoroutine: null,
  149. afterSelectPermanentCoroutine: null,
  150. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  151. cardEffect: activateClass);
  152. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  153. }
  154. }
  155. }
  156. if (timing == EffectTiming.OnAllyAttack)
  157. {
  158. ActivateClass activateClass = new ActivateClass();
  159. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  160. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  161. activateClass.SetHashString("Unsuspend_ST9_05");
  162. cardEffects.Add(activateClass);
  163. string EffectDiscription()
  164. {
  165. return "[When Attacking][Once Per Turn] Unsuspend this Digimon.";
  166. }
  167. bool CanUseCondition(Hashtable hashtable)
  168. {
  169. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  170. }
  171. bool CanActivateCondition(Hashtable hashtable)
  172. {
  173. if (CardEffectCommons.IsExistOnBattleArea(card))
  174. {
  175. return true;
  176. }
  177. return false;
  178. }
  179. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  180. {
  181. Permanent selectedPermanent = card.PermanentOfThisCard();
  182. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  183. }
  184. }
  185. return cardEffects;
  186. }
  187. }