BT8_099.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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_099 : 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.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Suspend 1 of your opponent's Digimon. Then, place up to 10 of your opponent's suspended Digimon at the bottom of their owners' decks in any order.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanSelectPermanentCondition1(Permanent permanent)
  28. {
  29. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  30. {
  31. if (permanent.IsSuspended)
  32. {
  33. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  34. {
  35. if (!permanent.CannotReturnToLibrary(activateClass))
  36. {
  37. return true;
  38. }
  39. }
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  51. {
  52. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  53. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  54. selectPermanentEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: CanSelectPermanentCondition,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount,
  60. canNoSelect: false,
  61. canEndNotMax: false,
  62. selectPermanentCoroutine: null,
  63. afterSelectPermanentCoroutine: null,
  64. mode: SelectPermanentEffect.Mode.Tap,
  65. cardEffect: activateClass);
  66. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  67. }
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  69. {
  70. List<Permanent> selectedPermanents = new List<Permanent>();
  71. int maxCount = Math.Min(10, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectPermanentCondition1,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: CanEndSelectCondition,
  78. maxCount: maxCount,
  79. canNoSelect: false,
  80. canEndNotMax: true,
  81. selectPermanentCoroutine: SelectPermanentCoroutine,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Custom,
  84. cardEffect: activateClass);
  85. selectPermanentEffect.SetUpCustomMessage("Select Digimon to return to the bottom of deck.", "The opponent is selecting Digimon to return to the bottom of deck.");
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. bool CanEndSelectCondition(List<Permanent> permanents)
  88. {
  89. if (CardEffectCommons.HasNoElement(permanents))
  90. {
  91. return false;
  92. }
  93. return true;
  94. }
  95. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  96. {
  97. selectedPermanents.Add(permanent);
  98. yield return null;
  99. }
  100. if (selectedPermanents.Count >= 1)
  101. {
  102. Hashtable hashtable = new Hashtable();
  103. hashtable.Add("CardEffect", activateClass);
  104. if (selectedPermanents.Count == 1)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(new DeckBottomBounceClass(selectedPermanents, hashtable).DeckBounce());
  107. }
  108. else
  109. {
  110. List<CardSource> cardSources = new List<CardSource>();
  111. foreach (Permanent permanent in selectedPermanents)
  112. {
  113. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  114. {
  115. if (!permanent.CannotReturnToLibrary(activateClass))
  116. {
  117. cardSources.Add(permanent.TopCard);
  118. }
  119. }
  120. }
  121. List<SkillInfo> skillInfos = new List<SkillInfo>();
  122. foreach (CardSource cardSource in cardSources)
  123. {
  124. ICardEffect cardEffect = new ChangeBaseDPClass();
  125. cardEffect.SetUpICardEffect(" ", null, cardSource);
  126. skillInfos.Add(new SkillInfo(cardEffect, null, EffectTiming.None));
  127. }
  128. List<CardSource> selectedCards = new List<CardSource>();
  129. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  130. selectCardEffect.SetUp(
  131. canTargetCondition: (cardSource) => true,
  132. canTargetCondition_ByPreSelecetedList: null,
  133. canEndSelectCondition: null,
  134. canNoSelect: () => false,
  135. selectCardCoroutine: null,
  136. afterSelectCardCoroutine: AfterSelectCardCoroutine1,
  137. message: "Specify the order to place the card at the bottom of the deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  138. maxCount: cardSources.Count,
  139. canEndNotMax: false,
  140. isShowOpponent: false,
  141. mode: SelectCardEffect.Mode.Custom,
  142. root: SelectCardEffect.Root.Custom,
  143. customRootCardList: cardSources,
  144. canLookReverseCard: true,
  145. selectPlayer: card.Owner,
  146. cardEffect: activateClass);
  147. selectCardEffect.SetNotShowCard();
  148. selectCardEffect.SetNotAddLog();
  149. selectCardEffect.SetUpSkillInfos(skillInfos);
  150. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  151. IEnumerator AfterSelectCardCoroutine1(List<CardSource> cardSources)
  152. {
  153. if (cardSources.Count >= 1)
  154. {
  155. foreach (CardSource cardSource in cardSources)
  156. {
  157. selectedCards.Add(cardSource);
  158. }
  159. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Cards", true, true));
  160. }
  161. }
  162. if (selectedCards.Count >= 1)
  163. {
  164. List<Permanent> libraryPermanets = new List<Permanent>();
  165. foreach (CardSource cardSource in selectedCards)
  166. {
  167. libraryPermanets.Add(cardSource.PermanentOfThisCard());
  168. }
  169. if (libraryPermanets.Count >= 1)
  170. {
  171. DeckBottomBounceClass putLibraryBottomPermanent = new DeckBottomBounceClass(libraryPermanets, hashtable);
  172. putLibraryBottomPermanent.SetNotShowCards();
  173. yield return ContinuousController.instance.StartCoroutine(putLibraryBottomPermanent.DeckBounce());
  174. }
  175. }
  176. }
  177. }
  178. }
  179. }
  180. }
  181. if (timing == EffectTiming.SecuritySkill)
  182. {
  183. ActivateClass activateClass = new ActivateClass();
  184. activateClass.SetUpICardEffect($"Suspend 1 Digimon and return a suspended Digimon to the bottom of deck", CanUseCondition, card);
  185. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  186. activateClass.SetIsSecurityEffect(true);
  187. cardEffects.Add(activateClass);
  188. string EffectDiscription()
  189. {
  190. return "[Security] Suspend 1 of your opponent's Digimon. Then, return 1 of your opponent's suspended Digimon to the bottom of its owner's deck.";
  191. }
  192. bool CanSelectPermanentCondition(Permanent permanent)
  193. {
  194. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  195. }
  196. bool CanSelectPermanentCondition1(Permanent permanent)
  197. {
  198. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  199. {
  200. if (permanent.IsSuspended)
  201. {
  202. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  203. {
  204. if (!permanent.CannotReturnToLibrary(activateClass))
  205. {
  206. return true;
  207. }
  208. }
  209. }
  210. }
  211. return false;
  212. }
  213. bool CanUseCondition(Hashtable hashtable)
  214. {
  215. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  216. }
  217. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  218. {
  219. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  220. {
  221. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  222. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  223. selectPermanentEffect.SetUp(
  224. selectPlayer: card.Owner,
  225. canTargetCondition: CanSelectPermanentCondition,
  226. canTargetCondition_ByPreSelecetedList: null,
  227. canEndSelectCondition: null,
  228. maxCount: maxCount,
  229. canNoSelect: false,
  230. canEndNotMax: false,
  231. selectPermanentCoroutine: null,
  232. afterSelectPermanentCoroutine: null,
  233. mode: SelectPermanentEffect.Mode.Tap,
  234. cardEffect: activateClass);
  235. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  236. }
  237. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  238. {
  239. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  240. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  241. selectPermanentEffect.SetUp(
  242. selectPlayer: card.Owner,
  243. canTargetCondition: CanSelectPermanentCondition1,
  244. canTargetCondition_ByPreSelecetedList: null,
  245. canEndSelectCondition: null,
  246. maxCount: maxCount,
  247. canNoSelect: false,
  248. canEndNotMax: false,
  249. selectPermanentCoroutine: null,
  250. afterSelectPermanentCoroutine: null,
  251. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  252. cardEffect: activateClass);
  253. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  254. }
  255. }
  256. }
  257. return cardEffects;
  258. }
  259. }