BT3_008.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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 BT3_008 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal the top 5 cards of deck", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] Reveal the top 5 cards of your deck. Add 1 [RagnaLoardmon] and 1 Digimon card with [Legend-Arms] in its traits among them to your hand. Place the remaining cards at the bottom of your deck in any order.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource != null)
  26. {
  27. if (cardSource.Owner == card.Owner)
  28. {
  29. if (cardSource.CardNames.Contains("RagnaLoardmon"))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanSelectCardCondition1(CardSource cardSource)
  38. {
  39. if (cardSource != null)
  40. {
  41. if (cardSource.Owner == card.Owner)
  42. {
  43. if (cardSource.IsDigimon)
  44. {
  45. if (cardSource.CardTraits.Contains("Legend-Arms"))
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. if (card.Owner.LibraryCards.Count >= 1)
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  72. revealCount: 5,
  73. simplifiedSelectCardConditions:
  74. new SimplifiedSelectCardConditionClass[]
  75. {
  76. new SimplifiedSelectCardConditionClass(
  77. canTargetCondition:CanSelectCardCondition,
  78. message: "Select 1 [RagnaLoardmon].",
  79. mode: SelectCardEffect.Mode.AddHand,
  80. maxCount: 1,
  81. selectCardCoroutine: null),
  82. new SimplifiedSelectCardConditionClass(
  83. canTargetCondition:CanSelectCardCondition1,
  84. message: "Select 1 Digimon card with [Legend-Arms] in its traits.",
  85. mode: SelectCardEffect.Mode.AddHand,
  86. maxCount: 1,
  87. selectCardCoroutine: null),
  88. },
  89. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  90. activateClass: activateClass,
  91. mutualConditions: true
  92. ));
  93. #region old
  94. /*
  95. if (card.Owner.LibraryCards.Count >= 1)
  96. {
  97. IRevealLibrary revealLibrary = new IRevealLibrary(card.Owner, 5);
  98. yield return ContinuousController.instance.StartCoroutine(revealLibrary.RevealLibrary());
  99. List<CardSource> libraryCards = new List<CardSource>();
  100. int maxCount = 2;
  101. #region ???
  102. List<CardSource[]> cardsList = ParameterComparer.Enumerate(revealLibrary.revealedCards, maxCount).ToList();
  103. List<int> maxCounts = new List<int>() { 0 };
  104. foreach(CardSource[] cardSources in cardsList)
  105. {
  106. List<int> _maxCounts = new List<int>();
  107. if(cardSources.Length >= 2)
  108. {
  109. if(CanSelectCardCondition(cardSources[0]))
  110. {
  111. if (CanSelectCardCondition1(cardSources[1]))
  112. {
  113. _maxCounts.Add(2);
  114. }
  115. else
  116. {
  117. _maxCounts.Add(1);
  118. }
  119. }
  120. if (CanSelectCardCondition1(cardSources[0]))
  121. {
  122. if (CanSelectCardCondition(cardSources[1]))
  123. {
  124. _maxCounts.Add(2);
  125. }
  126. else
  127. {
  128. _maxCounts.Add(1);
  129. }
  130. }
  131. if (!CanSelectCardCondition(cardSources[0]) && !CanSelectCardCondition1(cardSources[0]))
  132. {
  133. if (CanSelectCardCondition(cardSources[1]))
  134. {
  135. _maxCounts.Add(1);
  136. }
  137. if (CanSelectCardCondition1(cardSources[1]))
  138. {
  139. _maxCounts.Add(1);
  140. }
  141. }
  142. }
  143. else if(cardSources.Length == 1)
  144. {
  145. if (CanSelectCardCondition(cardSources[0]))
  146. {
  147. _maxCounts.Add(1);
  148. }
  149. else if (CanSelectCardCondition1(cardSources[0]))
  150. {
  151. _maxCounts.Add(1);
  152. }
  153. }
  154. if(_maxCounts.Count >= 1)
  155. {
  156. maxCounts.Add(_maxCounts.Max());
  157. }
  158. }
  159. if(maxCounts.Count >= 1)
  160. {
  161. maxCount = maxCounts.Max();
  162. }
  163. #endregion
  164. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  165. selectCardEffect.SetUp(
  166. CanTargetCondition: (cardSource) => CanSelectCardCondition(cardSource) || CanSelectCardCondition1(cardSource),
  167. CanTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  168. CanEndSelectCondition: CanEndSelectCondition,
  169. CanNoSelect: () => false,
  170. SelectCardCoroutine: null,
  171. AfterSelectCardCoroutine: AfterSelectCardCoroutine,
  172. Message: "Select cards to add to your hand.",
  173. MaxCount: maxCount,
  174. CanEndNotMax: false,
  175. isShowOpponent: true,
  176. mode: SelectCardEffect.Mode.AddHand,
  177. root: SelectCardEffect.Root.Custom,
  178. CustomRootCardList: revealLibrary.revealedCards,
  179. CanLookReverseCard: true,
  180. SelectPlayer: card.Owner,
  181. cardEffect: activateClass);
  182. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  183. #region ???
  184. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  185. {
  186. List<CardSource> _cardSources = new List<CardSource>();
  187. foreach(CardSource cardSource1 in cardSources)
  188. {
  189. _cardSources.Add(cardSource1);
  190. }
  191. _cardSources.Add(cardSource);
  192. List<CardSource[]> cardsList = ParameterComparer.Enumerate(_cardSources, _cardSources.Count).ToList();
  193. bool match = false;
  194. if (cardsList.Count >= 2)
  195. {
  196. foreach (CardSource[] cardSources1 in cardsList)
  197. {
  198. if (CanSelectCardCondition(cardSources1[0]))
  199. {
  200. if (CanSelectCardCondition1(cardSources1[1]))
  201. {
  202. match = true;
  203. }
  204. }
  205. if (CanSelectCardCondition1(cardSources1[0]))
  206. {
  207. if (CanSelectCardCondition(cardSources1[1]))
  208. {
  209. match = true;
  210. }
  211. }
  212. }
  213. }
  214. else
  215. {
  216. match = true;
  217. }
  218. if (!match)
  219. {
  220. return false;
  221. }
  222. return true;
  223. }
  224. #endregion
  225. #region ???
  226. bool CanEndSelectCondition(List<CardSource> cardSources)
  227. {
  228. List<CardSource[]> cardsList = ParameterComparer.Enumerate(cardSources, cardSources.Count).ToList();
  229. bool match = false;
  230. if(cardsList.Count >= 2)
  231. {
  232. foreach (CardSource[] cardSources1 in cardsList)
  233. {
  234. if(CanSelectCardCondition(cardSources1[0]))
  235. {
  236. if(CanSelectCardCondition1(cardSources1[1]))
  237. {
  238. match = true;
  239. }
  240. }
  241. if (CanSelectCardCondition1(cardSources1[0]))
  242. {
  243. if (CanSelectCardCondition(cardSources1[1]))
  244. {
  245. match = true;
  246. }
  247. }
  248. }
  249. }
  250. else
  251. {
  252. match = true;
  253. }
  254. if(!match)
  255. {
  256. return false;
  257. }
  258. return true;
  259. }
  260. #endregion
  261. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  262. {
  263. foreach (CardSource cardSource in revealLibrary.revealedCards)
  264. {
  265. if (!cardSources.Contains(cardSource))
  266. {
  267. libraryCards.Add(cardSource);
  268. }
  269. }
  270. yield return null;
  271. }
  272. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ReturnRevealedCardsToLibraryBottom(libraryCards, activateClass));
  273. }
  274. */
  275. #endregion
  276. }
  277. }
  278. return cardEffects;
  279. }
  280. }