Kimeramon_BT8_084.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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 Kimeramon_BT8_084 : 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.Levels_ForJogress(card).Contains(4))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool PermanentCondition2(Permanent permanent)
  52. {
  53. if (permanent != null)
  54. {
  55. if (permanent.TopCard != null)
  56. {
  57. if (permanent.TopCard.Owner == card.Owner)
  58. {
  59. if (permanent.IsDigimon)
  60. {
  61. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  62. {
  63. if (permanent.Levels_ForJogress(card).Contains(4))
  64. {
  65. return true;
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. return false;
  73. }
  74. JogressConditionElement[] elements = new JogressConditionElement[]
  75. {
  76. new JogressConditionElement(PermanentCondition1, "a level 4 Digimon"),
  77. new JogressConditionElement(PermanentCondition2, "a level 4 Digimon"),
  78. };
  79. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  80. return jogressCondition;
  81. }
  82. return null;
  83. }
  84. }
  85. if (timing == EffectTiming.OnEnterFieldAnyone)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("Place a Card to digivolution cards from trash and DP -", CanUseCondition, card);
  89. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. return "[When Digivolving] You may place 1 level 5 or lower Digimon card from your trash under this Digimon as its bottom digivolution card. Then, up to 4 of your opponent's Digimon get -1000 DP for each of this Digimon's colors until the end of your opponent's next turn.";
  94. }
  95. bool CanSelectCardCondition(CardSource cardSource)
  96. {
  97. if (cardSource != null)
  98. {
  99. if (cardSource.Owner == card.Owner)
  100. {
  101. if (cardSource.IsDigimon)
  102. {
  103. if (cardSource.Level <= 5)
  104. {
  105. if (cardSource.HasLevel)
  106. {
  107. return true;
  108. }
  109. }
  110. }
  111. }
  112. }
  113. return false;
  114. }
  115. bool CanSelectPermanentCondition(Permanent permanent)
  116. {
  117. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  118. }
  119. bool CanUseCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  122. }
  123. bool CanActivateCondition(Hashtable hashtable)
  124. {
  125. if (CardEffectCommons.IsExistOnBattleArea(card))
  126. {
  127. return true;
  128. }
  129. return false;
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  132. {
  133. if (isExistOnField(card))
  134. {
  135. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  136. {
  137. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  138. {
  139. List<CardSource> selectedCards = new List<CardSource>();
  140. int maxCount = 1;
  141. if (card.Owner.TrashCards.Count(CanSelectCardCondition) <= maxCount)
  142. {
  143. maxCount = card.Owner.TrashCards.Count(CanSelectCardCondition);
  144. }
  145. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  146. selectCardEffect.SetUp(
  147. canTargetCondition: CanSelectCardCondition,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: CanEndSelectCondition,
  150. canNoSelect: () => true,
  151. selectCardCoroutine: SelectCardCoroutine,
  152. afterSelectCardCoroutine: null,
  153. message: "Select 1 card to place in Digivolution cards.",
  154. maxCount: maxCount,
  155. canEndNotMax: false,
  156. isShowOpponent: true,
  157. mode: SelectCardEffect.Mode.Custom,
  158. root: SelectCardEffect.Root.Trash,
  159. customRootCardList: null,
  160. canLookReverseCard: true,
  161. selectPlayer: card.Owner,
  162. cardEffect: activateClass);
  163. selectCardEffect.SetUpCustomMessage("Select 1 card to place in Digivolution cards.", "The opponent is selecting 1 card to place in Digivolution cards.");
  164. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  165. yield return StartCoroutine(selectCardEffect.Activate());
  166. bool CanEndSelectCondition(List<CardSource> cardSources)
  167. {
  168. if (maxCount >= 1)
  169. {
  170. if (cardSources.Count <= 0)
  171. {
  172. return false;
  173. }
  174. }
  175. return true;
  176. }
  177. IEnumerator SelectCardCoroutine(CardSource cardSource)
  178. {
  179. selectedCards.Add(cardSource);
  180. yield return null;
  181. }
  182. List<CardSource> digivolutionCards = new List<CardSource>();
  183. foreach (CardSource cardSource in selectedCards)
  184. {
  185. digivolutionCards.Add(cardSource);
  186. }
  187. if (digivolutionCards.Count >= 1)
  188. {
  189. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(digivolutionCards, activateClass));
  190. }
  191. }
  192. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  193. {
  194. int minusDP = 1000 * card.PermanentOfThisCard().TopCard.CardColors.Count;
  195. int maxCount = Math.Min(4, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  196. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  197. selectPermanentEffect.SetUp(
  198. selectPlayer: card.Owner,
  199. canTargetCondition: CanSelectPermanentCondition,
  200. canTargetCondition_ByPreSelecetedList: null,
  201. canEndSelectCondition: CanEndSelectCondition,
  202. maxCount: maxCount,
  203. canNoSelect: false,
  204. canEndNotMax: true,
  205. selectPermanentCoroutine: SelectPermanentCoroutine,
  206. afterSelectPermanentCoroutine: null,
  207. mode: SelectPermanentEffect.Mode.Custom,
  208. cardEffect: activateClass);
  209. selectPermanentEffect.SetUpCustomMessage($"Select up to 4 Digimon to DP -{minusDP}.", $"The opponent is selecting up to 4 Digimon to DP -{minusDP}.");
  210. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  211. bool CanEndSelectCondition(List<Permanent> permanents)
  212. {
  213. if (CardEffectCommons.HasNoElement(permanents))
  214. {
  215. return false;
  216. }
  217. return true;
  218. }
  219. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  220. {
  221. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -minusDP, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  222. }
  223. }
  224. }
  225. }
  226. }
  227. }
  228. if (timing == EffectTiming.None)
  229. {
  230. ChangeCardColorClass changeCardColorClass = new ChangeCardColorClass();
  231. changeCardColorClass.SetUpICardEffect($"Also treated as Diogivolution cards' colors", CanUseCondition, card);
  232. changeCardColorClass.SetUpChangeCardColorClass(ChangeCardColors: ChangeCardColors);
  233. cardEffects.Add(changeCardColorClass);
  234. bool CanUseCondition(Hashtable hashtable)
  235. {
  236. if (CardEffectCommons.IsExistOnBattleArea(card))
  237. {
  238. if (CardEffectCommons.IsOwnerTurn(card))
  239. {
  240. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  241. {
  242. return true;
  243. }
  244. }
  245. }
  246. return false;
  247. }
  248. List<CardColor> ChangeCardColors(CardSource cardSource, List<CardColor> CardColors)
  249. {
  250. if (cardSource == card)
  251. {
  252. if (isExistOnField(card))
  253. {
  254. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  255. {
  256. foreach (CardSource cardSource1 in card.PermanentOfThisCard().DigivolutionCards)
  257. {
  258. foreach (CardColor cardColor in cardSource1.CardColors)
  259. {
  260. if (!CardColors.Contains(cardColor))
  261. {
  262. CardColors.Add(cardColor);
  263. }
  264. }
  265. }
  266. }
  267. }
  268. }
  269. return CardColors;
  270. }
  271. }
  272. if (timing == EffectTiming.None)
  273. {
  274. bool Condition()
  275. {
  276. if (CardEffectCommons.IsExistOnBattleArea(card))
  277. {
  278. if (CardEffectCommons.IsOwnerTurn(card))
  279. {
  280. if (card.PermanentOfThisCard().TopCard.CardColors.Count >= 4)
  281. {
  282. return true;
  283. }
  284. }
  285. }
  286. return false;
  287. }
  288. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 4000, isInheritedEffect: false, card: card, condition: Condition));
  289. }
  290. return cardEffects;
  291. }
  292. }