BT8_042.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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 BT8_042 : 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.Yellow))
  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.Blue))
  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 yellow Digimon"),
  83. new JogressConditionElement(PermanentCondition2, "a level 4 blue 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("Recovery +1 (Deck) and return 1 Digimon to hand", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  96. cardEffects.Add(activateClass);
  97. string EffectDiscription()
  98. {
  99. return "[When Digivolving] If you have 5 or fewer security cards, <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.) Then, when DNA digivolving, return 1 of your opponent's Digimon whose level is less than or equal to the number of cards in your security stack to its owner's hand.";
  100. }
  101. bool CanSelectPermanentCondition1(Permanent permanent)
  102. {
  103. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  104. {
  105. if (permanent.Level <= card.Owner.SecurityCards.Count)
  106. {
  107. if (permanent.TopCard.HasLevel)
  108. {
  109. return true;
  110. }
  111. }
  112. }
  113. return false;
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  118. }
  119. bool CanActivateCondition(Hashtable hashtable)
  120. {
  121. if (CardEffectCommons.IsExistOnBattleArea(card))
  122. {
  123. return true;
  124. }
  125. return false;
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  128. {
  129. if (card.Owner.SecurityCards.Count <= 5)
  130. {
  131. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  132. }
  133. if (CardEffectCommons.IsJogress(_hashtable))
  134. {
  135. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  136. {
  137. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  138. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  139. selectPermanentEffect.SetUp(
  140. selectPlayer: card.Owner,
  141. canTargetCondition: CanSelectPermanentCondition1,
  142. canTargetCondition_ByPreSelecetedList: null,
  143. canEndSelectCondition: null,
  144. maxCount: maxCount,
  145. canNoSelect: false,
  146. canEndNotMax: false,
  147. selectPermanentCoroutine: null,
  148. afterSelectPermanentCoroutine: null,
  149. mode: SelectPermanentEffect.Mode.Bounce,
  150. cardEffect: activateClass);
  151. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  152. }
  153. }
  154. }
  155. }
  156. if (timing == EffectTiming.OnAllyAttack)
  157. {
  158. ActivateClass activateClass = new ActivateClass();
  159. activateClass.SetUpICardEffect("DP -3000", CanUseCondition, card);
  160. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  161. activateClass.SetIsInheritedEffect(true);
  162. cardEffects.Add(activateClass);
  163. string EffectDiscription()
  164. {
  165. return "[When Attacking] 1 of your opponent's Digimon gets -3000 DP for the turn.";
  166. }
  167. bool CanSelectPermanentCondition(Permanent permanent)
  168. {
  169. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  170. }
  171. bool CanUseCondition(Hashtable hashtable)
  172. {
  173. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  174. }
  175. bool CanActivateCondition(Hashtable hashtable)
  176. {
  177. if (CardEffectCommons.IsExistOnBattleArea(card))
  178. {
  179. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  180. {
  181. return true;
  182. }
  183. }
  184. return false;
  185. }
  186. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  187. {
  188. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  189. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  190. selectPermanentEffect.SetUp(
  191. selectPlayer: card.Owner,
  192. canTargetCondition: CanSelectPermanentCondition,
  193. canTargetCondition_ByPreSelecetedList: null,
  194. canEndSelectCondition: null,
  195. maxCount: maxCount,
  196. canNoSelect: false,
  197. canEndNotMax: false,
  198. selectPermanentCoroutine: SelectPermanentCoroutine,
  199. afterSelectPermanentCoroutine: null,
  200. mode: SelectPermanentEffect.Mode.Custom,
  201. cardEffect: activateClass);
  202. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000.", "The opponent is selecting 1 Digimon that will get DP -3000.");
  203. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  204. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  205. {
  206. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  207. }
  208. }
  209. }
  210. return cardEffects;
  211. }
  212. }