BT8_015.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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_015 : 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.Red))
  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.Yellow))
  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 red Digimon"),
  83. new JogressConditionElement(PermanentCondition2, "a level 4 yellow 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("DP -5000 and delete 1 Digimon with 5000 DP or less", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  96. cardEffects.Add(activateClass);
  97. string EffectDiscription()
  98. {
  99. return "[When Digivolving] 1 of your opponent's Digimon gets -5000 DP for the turn. Then, when DNA digivolving, delete 1 of your opponent's Digimon with 5000 DP or less.";
  100. }
  101. bool CanSelectPermanentCondition(Permanent permanent)
  102. {
  103. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  104. }
  105. bool CanSelectPermanentCondition1(Permanent permanent)
  106. {
  107. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  108. {
  109. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(5000, activateClass))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. bool CanUseCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. if (CardEffectCommons.IsExistOnBattleArea(card))
  123. {
  124. return true;
  125. }
  126. return false;
  127. }
  128. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  129. {
  130. if (isExistOnField(card))
  131. {
  132. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  133. {
  134. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  135. {
  136. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  137. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  138. selectPermanentEffect.SetUp(
  139. selectPlayer: card.Owner,
  140. canTargetCondition: CanSelectPermanentCondition,
  141. canTargetCondition_ByPreSelecetedList: null,
  142. canEndSelectCondition: null,
  143. maxCount: maxCount,
  144. canNoSelect: false,
  145. canEndNotMax: false,
  146. selectPermanentCoroutine: SelectPermanentCoroutine,
  147. afterSelectPermanentCoroutine: null,
  148. mode: SelectPermanentEffect.Mode.Custom,
  149. cardEffect: activateClass);
  150. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -5000.", "The opponent is selecting 1 Digimon that will get DP -5000.");
  151. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  152. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  153. {
  154. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -5000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  155. }
  156. }
  157. bool isJogress = false;
  158. if (_hashtable != null)
  159. {
  160. if (_hashtable.ContainsKey("isJogress"))
  161. {
  162. if (_hashtable["isJogress"] is bool)
  163. {
  164. isJogress = (bool)_hashtable["isJogress"];
  165. }
  166. }
  167. }
  168. if (isJogress)
  169. {
  170. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  171. {
  172. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  173. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  174. selectPermanentEffect.SetUp(
  175. selectPlayer: card.Owner,
  176. canTargetCondition: CanSelectPermanentCondition1,
  177. canTargetCondition_ByPreSelecetedList: null,
  178. canEndSelectCondition: null,
  179. maxCount: maxCount,
  180. canNoSelect: false,
  181. canEndNotMax: false,
  182. selectPermanentCoroutine: null,
  183. afterSelectPermanentCoroutine: null,
  184. mode: SelectPermanentEffect.Mode.Destroy,
  185. cardEffect: activateClass);
  186. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. if (timing == EffectTiming.OnAllyAttack)
  194. {
  195. ActivateClass activateClass = new ActivateClass();
  196. activateClass.SetUpICardEffect("Delete 1 Digimon with 5000 DP or less", CanUseCondition, card);
  197. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  198. activateClass.SetIsInheritedEffect(true);
  199. cardEffects.Add(activateClass);
  200. string EffectDiscription()
  201. {
  202. return "[When Attacking] Delete 1 of your opponent's Digimon with 5000 DP or less.";
  203. }
  204. bool CanSelectPermanentCondition(Permanent permanent)
  205. {
  206. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  207. {
  208. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(5000, activateClass))
  209. {
  210. return true;
  211. }
  212. }
  213. return false;
  214. }
  215. bool CanUseCondition(Hashtable hashtable)
  216. {
  217. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  218. }
  219. bool CanActivateCondition(Hashtable hashtable)
  220. {
  221. if (CardEffectCommons.IsExistOnBattleArea(card))
  222. {
  223. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  224. {
  225. return true;
  226. }
  227. }
  228. return false;
  229. }
  230. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  231. {
  232. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  233. {
  234. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  235. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  236. selectPermanentEffect.SetUp(
  237. selectPlayer: card.Owner,
  238. canTargetCondition: CanSelectPermanentCondition,
  239. canTargetCondition_ByPreSelecetedList: null,
  240. canEndSelectCondition: null,
  241. maxCount: maxCount,
  242. canNoSelect: false,
  243. canEndNotMax: false,
  244. selectPermanentCoroutine: null,
  245. afterSelectPermanentCoroutine: null,
  246. mode: SelectPermanentEffect.Mode.Destroy,
  247. cardEffect: activateClass);
  248. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  249. }
  250. }
  251. }
  252. return cardEffects;
  253. }
  254. }