DataBase.cs 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. using System.Linq;
  6. using System.IO;
  7. using WebSocketSharp;
  8. public class DataBase : MonoBehaviour
  9. {
  10. public static DataBase instance = null;
  11. private void Awake()
  12. {
  13. instance = this;
  14. }
  15. public static Dictionary<CardKind, string> CardKindJPNameDictionary = new Dictionary<CardKind, string>()
  16. {
  17. {CardKind.Digimon,"デジモン" },
  18. {CardKind.Tamer,"テイマー" },
  19. {CardKind.Option,"オプション" },
  20. {CardKind.DigiEgg,"デジタマ" },
  21. };
  22. public static Dictionary<CardKind, string> CardKindENNameDictionary = new Dictionary<CardKind, string>()
  23. {
  24. {CardKind.Digimon,"Digimon" },
  25. {CardKind.Tamer,"Tamer" },
  26. {CardKind.Option,"Option" },
  27. {CardKind.DigiEgg,"DigiEgg" },
  28. };
  29. public static Dictionary<CardColor, string> CardColorNameDictionary = new Dictionary<CardColor, string>()
  30. {
  31. { CardColor.Green,"green"},
  32. { CardColor.Red,"red"},
  33. { CardColor.Blue,"blue"},
  34. { CardColor.Yellow,"yellow"},
  35. { CardColor.Purple,"purple"},
  36. { CardColor.Black,"black"},
  37. { CardColor.White,"white"},
  38. { CardColor.None,"-"},
  39. };
  40. public static Dictionary<CardColor, Color> CardColor_ColorLightDictionary = new Dictionary<CardColor, Color>()
  41. {
  42. { CardColor.Green,new Color32(55,255,49,255)},
  43. { CardColor.Red,new Color32(253,63,49,255)},
  44. { CardColor.Blue, new Color32(49,118,253,255) },
  45. { CardColor.Yellow, new Color32(255,231,64,255)},
  46. { CardColor.Purple,new Color32(234,64,176,255)},
  47. { CardColor.Black,new Color32(61,61,61,255)},
  48. { CardColor.White,new Color32(224,224,224,255)},
  49. { CardColor.None,new Color32(222,222,222,255)},
  50. };
  51. public static Dictionary<CardColor, Color> CardColor_ColorDarkDictionary = new Dictionary<CardColor, Color>()
  52. {
  53. { CardColor.Red,new Color32(171,12,0,255)},
  54. { CardColor.Blue, new Color32(0,103,171,255) },
  55. { CardColor.Green,new Color32(1,171,0,255)},
  56. { CardColor.Yellow, new Color32(255,242,64,255)},
  57. { CardColor.Purple,new Color32(155,0,171,255)},
  58. { CardColor.Black,new Color32(61,61,61,255)},
  59. { CardColor.White,new Color32(224,224,224,255)},
  60. { CardColor.None,new Color32(222,222,222,255)},
  61. };
  62. public static Dictionary<CardColor, String> CardColorInitialDictionary = new Dictionary<CardColor, String>()
  63. {
  64. { CardColor.Red,"R"},
  65. { CardColor.Blue, "U" },
  66. { CardColor.Green,"G"},
  67. { CardColor.Yellow, "Y"},
  68. { CardColor.Purple,"P"},
  69. { CardColor.Black,"B"},
  70. { CardColor.White,"W"},
  71. { CardColor.None,"N"},
  72. };
  73. public static List<string> CardListIDs(string SetID, bool isEnglish)
  74. {
  75. List<string> cardListID = new List<string>();
  76. if (isEnglish)
  77. {
  78. switch (SetID)
  79. {
  80. case "ST1":
  81. cardListID.Add("522101");
  82. break;
  83. case "ST2":
  84. cardListID.Add("522102");
  85. break;
  86. case "ST3":
  87. cardListID.Add("522103");
  88. break;
  89. case "ST4":
  90. cardListID.Add("522104");
  91. break;
  92. case "ST5":
  93. cardListID.Add("522105");
  94. break;
  95. case "ST6":
  96. cardListID.Add("522106");
  97. break;
  98. case "ST7":
  99. cardListID.Add("522107");
  100. break;
  101. case "ST8":
  102. cardListID.Add("522108");
  103. break;
  104. case "ST9":
  105. cardListID.Add("522109");
  106. break;
  107. case "ST10":
  108. cardListID.Add("522110");
  109. break;
  110. case "ST12":
  111. cardListID.Add("522112");
  112. break;
  113. case "ST13":
  114. cardListID.Add("522113");
  115. break;
  116. case "ST14":
  117. cardListID.Add("522114");
  118. break;
  119. case "ST15":
  120. cardListID.Add("522115");
  121. break;
  122. case "ST16":
  123. cardListID.Add("522116");
  124. break;
  125. case "ST17":
  126. cardListID.Add("522117");
  127. break;
  128. case "BT1":
  129. cardListID.Add("522001");
  130. cardListID.Add("522002");
  131. break;
  132. case "BT2":
  133. cardListID.Add("522001");
  134. cardListID.Add("522002");
  135. break;
  136. case "BT3":
  137. cardListID.Add("522001");
  138. cardListID.Add("522002");
  139. break;
  140. case "BT4":
  141. cardListID.Add("522003");
  142. break;
  143. case "BT5":
  144. cardListID.Add("522004");
  145. break;
  146. case "BT6":
  147. cardListID.Add("522005");
  148. break;
  149. case "EX1":
  150. cardListID.Add("522006");
  151. break;
  152. case "BT7":
  153. cardListID.Add("522007");
  154. break;
  155. case "BT8":
  156. cardListID.Add("522008");
  157. break;
  158. case "EX2":
  159. cardListID.Add("522009");
  160. break;
  161. case "BT9":
  162. cardListID.Add("522010");
  163. break;
  164. case "BT10":
  165. cardListID.Add("522011");
  166. break;
  167. case "EX3":
  168. cardListID.Add("522012");
  169. break;
  170. case "BT11":
  171. cardListID.Add("522013");
  172. break;
  173. case "BT12":
  174. cardListID.Add("522014");
  175. break;
  176. case "EX4":
  177. cardListID.Add("522015");
  178. break;
  179. case "BT13":
  180. cardListID.Add("522016");
  181. break;
  182. case "RB1":
  183. cardListID.Add("522017");
  184. break;
  185. case "BT14":
  186. cardListID.Add("522018");
  187. break;
  188. case "EX5":
  189. cardListID.Add("522019");
  190. break;
  191. case "BT15":
  192. cardListID.Add("522020");
  193. break;
  194. case "LM":
  195. cardListID.Add("522020");
  196. break;
  197. case "BT16":
  198. cardListID.Add("522021");
  199. break;
  200. case "P":
  201. cardListID.Add("522007");
  202. cardListID.Add("522901");
  203. break;
  204. }
  205. }
  206. else
  207. {
  208. switch (SetID)
  209. {
  210. case "ST1":
  211. cardListID.Add("503101");
  212. break;
  213. case "ST2":
  214. cardListID.Add("503102");
  215. break;
  216. case "ST3":
  217. cardListID.Add("503103");
  218. break;
  219. case "ST4":
  220. cardListID.Add("503104");
  221. break;
  222. case "ST5":
  223. cardListID.Add("503105");
  224. break;
  225. case "ST6":
  226. cardListID.Add("503106");
  227. break;
  228. case "ST7":
  229. cardListID.Add("503107");
  230. break;
  231. case "ST8":
  232. cardListID.Add("503108");
  233. break;
  234. case "ST9":
  235. cardListID.Add("503109");
  236. break;
  237. case "ST10":
  238. cardListID.Add("503110");
  239. break;
  240. case "ST11":
  241. cardListID.Add("503111");
  242. break;
  243. case "ST12":
  244. cardListID.Add("503112");
  245. break;
  246. case "ST13":
  247. cardListID.Add("503113");
  248. break;
  249. case "ST14":
  250. cardListID.Add("503114");
  251. break;
  252. case "ST15":
  253. cardListID.Add("503115");
  254. break;
  255. case "ST16":
  256. cardListID.Add("503116");
  257. break;
  258. case "ST17":
  259. cardListID.Add("503117");
  260. break;
  261. case "BT1":
  262. cardListID.Add("503001");
  263. break;
  264. case "BT2":
  265. cardListID.Add("503002");
  266. break;
  267. case "BT3":
  268. cardListID.Add("503003");
  269. break;
  270. case "BT4":
  271. cardListID.Add("503004");
  272. break;
  273. case "BT5":
  274. cardListID.Add("503005");
  275. break;
  276. case "BT6":
  277. cardListID.Add("503006");
  278. break;
  279. case "EX1":
  280. cardListID.Add("503007");
  281. break;
  282. case "BT7":
  283. cardListID.Add("503008");
  284. break;
  285. case "BT8":
  286. cardListID.Add("503009");
  287. break;
  288. case "EX2":
  289. cardListID.Add("503010");
  290. break;
  291. case "BT9":
  292. cardListID.Add("503011");
  293. break;
  294. case "BT10":
  295. cardListID.Add("503012");
  296. break;
  297. case "EX3":
  298. cardListID.Add("503013");
  299. break;
  300. case "BT11":
  301. cardListID.Add("503014");
  302. break;
  303. case "BT12":
  304. cardListID.Add("503015");
  305. break;
  306. case "EX4":
  307. cardListID.Add("503016");
  308. break;
  309. case "RB1":
  310. cardListID.Add("503017");
  311. break;
  312. case "BT13":
  313. cardListID.Add("503018");
  314. break;
  315. case "BT14":
  316. cardListID.Add("503019");
  317. break;
  318. case "EX5":
  319. cardListID.Add("503020");
  320. break;
  321. case "BT15":
  322. cardListID.Add("503021");
  323. break;
  324. case "LM":
  325. cardListID.Add("503201");
  326. break;
  327. case "BT16":
  328. cardListID.Add("503022");
  329. break;
  330. case "P":
  331. cardListID.Add("503008");
  332. cardListID.Add("503901");
  333. break;
  334. }
  335. }
  336. return cardListID;
  337. }
  338. public List<Sprite> ColorIcons_circle = new List<Sprite>();
  339. public List<Sprite> ColorIcons_bar = new List<Sprite>();
  340. public static Color SelectColor_Orange => new Color32(255, 98, 31, 255);
  341. public static Color SelectColor_Blue => new Color32(30, 246, 255, 255);
  342. public static Color SelectColor_Green => new Color32(57, 255, 30, 255);
  343. public static Color CommandColor_Attack => new Color32(255, 54, 54, 255);
  344. public static Color CommandColor_Move => new Color32(54, 111, 255, 255);
  345. public static Color CommandColor_Skill => new Color32(86, 255, 102, 255);
  346. public static bool IsXAntibodyString(string text) =>
  347. !string.IsNullOrEmpty(text) && text.Replace(" ", "").Replace("-", "").ToLower() == "xantibody";
  348. public static bool IsContainingXAntibodyString(string text) =>
  349. !string.IsNullOrEmpty(text) && text.Replace(" ", "").Replace("-", "").ToLower().Contains("xantibody");
  350. public static string BlockerEffectDiscription()
  351. {
  352. return "<Blocker> (When an opponent's Digimon attacks, you may suspend this Digimon to force the opponent to attack it instead.)";
  353. }
  354. public static string RebootEffectDiscription()
  355. {
  356. return "<Reboot> (Unsuspend this Digimon during your opponent's unsuspend phase.)";
  357. }
  358. public static string PierceEffectDiscription()
  359. {
  360. return "<Piercing> (When this Digimon deletes your opponent's Digimon in battle while attacking, it checks security before the attack ends.)";
  361. }
  362. public static string RetaliationEffectDiscription()
  363. {
  364. return "<Retaliation> (When this Digimon is deleted after losing a battle, delete the Digimon it was battling.)";
  365. }
  366. public static string BilitzEffectDiscription()
  367. {
  368. return "<Blitz> (This Digimon can attack when your opponent has 1 or more memory.)";
  369. }
  370. public static string ArmorPurgeEffectDiscription()
  371. {
  372. return "<Armor Purge> (When this Digimon would be deleted, you may trash the top card of this Digimon to prevent that deletion.)";
  373. }
  374. public static string SaveEffectDiscription()
  375. {
  376. return "[On Deletion] <Save> (You may place this card under one of your Tamers.)";
  377. }
  378. public static string EvadeEffectDiscription()
  379. {
  380. return "<Evade> (When this Digimon would be deleted, you may suspend it to prevent that deletion.)";
  381. }
  382. public static string RaidEffectDiscription()
  383. {
  384. return "<Raid> (When this Digimon attacks, you may switch the target of attack to 1 of your opponent's unsuspended Digimon with the highest DP.)";
  385. }
  386. public static string BarrierEffectDiscription()
  387. {
  388. return "<Barrier> (When this Digimon would be deleted in battle, by trashing the top card of your security stack, prevent that deletion.)";
  389. }
  390. public static string BlastDigivolveEffectDiscription()
  391. {
  392. return "[Hand] [Counter] <Blast Digivolve> (Your Digimon may digivolve into this card without paying the cost.)";
  393. }
  394. public static string BlastDNADigivolveEffectDiscription()
  395. {
  396. return "[Hand] [Counter] <Blast DNA Digivolve> (One of your specified Digimon and 1 of the specified card in the hand may DNA Digivolve into this card.)";
  397. }
  398. public static string FortitudeEffectDiscription()
  399. {
  400. return "<Fortitude> (When this Digimon with digivolution cards is deleted, play this card without paying the cost.)";
  401. }
  402. public static string AllianceEffectDiscription()
  403. {
  404. return "<Alliance> (When this Digimon attacks, by suspending 1 of your other Digimon, this Digimon adds the suspended Digimon's DP and gains <Security Attack +1> for the attack.)";
  405. }
  406. public static string AscensionEffectDescription()
  407. {
  408. return "<Ascension> (When this Digimon is deleted, you may place this card as the top security card.)";
  409. }
  410. public static string PartitionEffectDiscription()
  411. {
  412. return "<Partition> (When this Digimon with 1 of each specified card in its digivolution cards would leave the battle area other than by one of your effects or in battle, you may play 1 of each card without paying their costs.)";
  413. }
  414. public static string CollisionEffectDiscription()
  415. {
  416. return "<Collision> (During this Digimon's attack, all of your opponent's Digimon gain <Blocker>, and your opponent blocks if possible.)";
  417. }
  418. public static string VortexEffectDiscription()
  419. {
  420. return "<Vortex> (At the end of your turn, this Digimon may attack an opponent's Digimon. With this effect, it can attack the turn it was played.)";
  421. }
  422. public static string OverclockEffectDiscription(string trait)
  423. {
  424. return $"<Overclock [{trait}]> (At the end of your turn, by deleting 1 of your Tokens or other [{trait}] trait Digimon, this Digimon attacks a player without suspending.)";
  425. }
  426. public static string TrainingEffectDiscription()
  427. {
  428. return "<Training> (In the main phase, by suspending this Digimon, place your deck's top card face down as this Digimon's bottom digivolution card. This effect can also activate in the breeding area).";
  429. }
  430. public static string DecodeEffectDiscription(string[] decodeStrings)
  431. {
  432. return $"<Decode {decodeStrings[0]}> (When this Digimon would leave the battle area other than in battle, you may play 1 {decodeStrings[1]} Digimon card from its digivolution cards without paying the cost.)";
  433. }
  434. public static string ExecuteEffectDiscription()
  435. {
  436. return "<Execute> (At the end of your turn, this Digimon may attack. At the end of that attack, delete this Digimon. Your opponent's unsuspended Digimon can also be attacked with this effect.)";
  437. }
  438. public static string ProgressEffectDiscription()
  439. {
  440. return "<Progress> (While attacking, your opponent's effects don't affect this Digimon.)";
  441. }
  442. public static string LinkEffectDiscription()
  443. {
  444. return "[Link] (Plug this card from the hand or battle area sideways into the specified Digimon in the battle area.)";
  445. }
  446. public static string GuardEffectDescription()
  447. {
  448. return "<Guard> (When any of your other Digimon would leave the battle area by your opponent's effects, by deleting this Digimon, they don't leave.)";
  449. }
  450. public static string EngageEffectDescription()
  451. {
  452. return "<Engage> (At the end of your turn, this Digimon may attack.)";
  453. }
  454. public static string ReplaceToASCII(string text)
  455. {
  456. if (string.IsNullOrEmpty(text))
  457. {
  458. return "";
  459. }
  460. return text
  461. .Replace("<", "<")
  462. .Replace(">", ">")
  463. .Replace("、", ",")
  464. .Replace(",", ",")
  465. .Replace("“", "\"")
  466. .Replace("・", "")
  467. .Replace(" ", "")
  468. .Replace("!", "!");
  469. }
  470. public static string DigiburstRegex = "デジバースト[0-9]";
  471. public static string FirstPlayerKey = "FirstPlayerId";
  472. public static string FirstPlayerIndexIdKey = "FirstPlayerIndexId";
  473. #region use for sort
  474. public static CardKind[] cardKinds = new[] { CardKind.Digimon, CardKind.Tamer, CardKind.Option };
  475. public static CardColor[] cardColors = new[] { CardColor.Red, CardColor.Blue, CardColor.Yellow, CardColor.Green, CardColor.Black, CardColor.Purple, CardColor.White, CardColor.None };
  476. public static string[] SetIDs = new string[]
  477. {
  478. "BT28",
  479. "BT27",
  480. "BT26",
  481. "BT25",
  482. "BT24",
  483. "BT23",
  484. "BT22",
  485. "BT21",
  486. "BT20",
  487. "BT19",
  488. "BT18",
  489. "BT17",
  490. "BT16",
  491. "BT15",
  492. "BT14",
  493. "BT13",
  494. "BT12",
  495. "BT11",
  496. "BT10",
  497. "BT9",
  498. "BT8",
  499. "BT7",
  500. "BT6",
  501. "BT5",
  502. "BT4",
  503. "BT3",
  504. "BT2",
  505. "BT1",
  506. "EX28",
  507. "EX27",
  508. "EX26",
  509. "EX25",
  510. "EX24",
  511. "EX23",
  512. "EX22",
  513. "EX21",
  514. "EX20",
  515. "EX19",
  516. "EX18",
  517. "EX17",
  518. "EX16",
  519. "EX15",
  520. "EX14",
  521. "EX13",
  522. "EX12",
  523. "EX11",
  524. "EX10",
  525. "EX9",
  526. "EX8",
  527. "EX7",
  528. "EX6",
  529. "EX5",
  530. "EX4",
  531. "EX3",
  532. "EX2",
  533. "EX1",
  534. "RB11",
  535. "RB10",
  536. "RB9",
  537. "RB8",
  538. "RB7",
  539. "RB6",
  540. "RB5",
  541. "RB4",
  542. "RB3",
  543. "RB2",
  544. "RB1",
  545. "LM11",
  546. "LM10",
  547. "LM9",
  548. "LM8",
  549. "LM7",
  550. "LM6",
  551. "LM5",
  552. "LM4",
  553. "LM3",
  554. "LM2",
  555. "LM1",
  556. "ST28",
  557. "ST27",
  558. "ST26",
  559. "ST25",
  560. "ST24",
  561. "ST23",
  562. "ST22",
  563. "ST21",
  564. "ST20",
  565. "ST19",
  566. "ST18",
  567. "ST17",
  568. "ST16",
  569. "ST15",
  570. "ST14",
  571. "ST13",
  572. "ST12",
  573. "ST11",
  574. "ST10",
  575. "ST9",
  576. "ST8",
  577. "ST7",
  578. "ST6",
  579. "ST5",
  580. "ST4",
  581. "ST3",
  582. "ST2",
  583. "ST1",
  584. "P",
  585. };
  586. #endregion
  587. #region ENG ban list
  588. public static CardRestriction ENGBanList = new CardRestriction(new List<CardLimitCount>()
  589. {
  590. new CardLimitCount("BT11-064", 1),
  591. new CardLimitCount("BT10-009", 1),
  592. new CardLimitCount("BT7-107", 1),
  593. new CardLimitCount("BT7-072", 1),
  594. new CardLimitCount("BT7-064", 1),
  595. new CardLimitCount("BT7-038", 1),
  596. new CardLimitCount("BT6-100", 1),
  597. new CardLimitCount("BT5-109", 0),
  598. new CardLimitCount("BT3-103", 1),
  599. new CardLimitCount("BT3-054", 1),
  600. new CardLimitCount("BT2-047", 1),
  601. new CardLimitCount("EX2-039", 1),
  602. new CardLimitCount("EX1-068", 1),
  603. new CardLimitCount("P-008", 1),
  604. new CardLimitCount("P-025", 1),
  605. new CardLimitCount("BT2-069", 1),
  606. new CardLimitCount("BT13-012", 1),
  607. new CardLimitCount("BT7-069", 1),
  608. new CardLimitCount("BT14-002", 1),
  609. new CardLimitCount("BT15-102", 1),
  610. new CardLimitCount("EX5-015", 1),
  611. new CardLimitCount("EX5-018", 1),
  612. new CardLimitCount("EX5-062", 1),
  613. new CardLimitCount("P-123", 1),
  614. new CardLimitCount("P-130", 1),
  615. new CardLimitCount("ST2-13", 1),
  616. new CardLimitCount("BT9-098", 1),
  617. new CardLimitCount("BT15-057", 1),
  618. new CardLimitCount("BT14-084", 1),
  619. new CardLimitCount("BT2-090", 0),
  620. new CardLimitCount("BT4-104", 1),
  621. new CardLimitCount("BT4-111", 1),
  622. new CardLimitCount("BT11-033", 1),
  623. new CardLimitCount("BT17-069", 1),
  624. new CardLimitCount("EX4-030", 1),
  625. new CardLimitCount("P-029", 1),
  626. new CardLimitCount("P-030", 1),
  627. new CardLimitCount("ST9-09", 1),
  628. new CardLimitCount("EX5-065", 0),
  629. new CardLimitCount("BT1-090", 1),
  630. new CardLimitCount("BT16-011", 1),
  631. new CardLimitCount("EX3-057", 1),
  632. new CardLimitCount("BT6-104", 1),
  633. new CardLimitCount("BT13-110", 1),
  634. new CardLimitCount("EX4-006", 1),
  635. new CardLimitCount("BT19-040", 1),
  636. new CardLimitCount("EX2-070", 1),
  637. new CardLimitCount("EX1-021", 1),
  638. new CardLimitCount("BT23-032", 1),
  639. new CardLimitCount("BT3-092", 1),
  640. new CardLimitCount("BT10-080", 1),
  641. new CardLimitCount("EX5-059", 1),
  642. new CardLimitCount("EX5-061", 1),
  643. },
  644. new List<BannedPair>()
  645. {
  646. new BannedPair("BT20-037", new List<string>(){
  647. "BT17-035",
  648. "EX8-037",
  649. }),
  650. new BannedPair("EX2-007", new List<string>(){
  651. "EX7-064",
  652. })
  653. });
  654. #endregion
  655. #region JPN ban list
  656. public static CardRestriction JPNBanList = new CardRestriction(new List<CardLimitCount>()
  657. {
  658. new CardLimitCount("BT11-064", 1),
  659. new CardLimitCount("BT10-009", 1),
  660. new CardLimitCount("BT9-099", 1),
  661. new CardLimitCount("BT7-107", 1),
  662. new CardLimitCount("BT7-072", 1),
  663. new CardLimitCount("BT7-064", 1),
  664. new CardLimitCount("BT7-038", 1),
  665. new CardLimitCount("BT6-100", 1),
  666. new CardLimitCount("BT5-109", 0),
  667. new CardLimitCount("BT3-103", 1),
  668. new CardLimitCount("BT3-054", 1),
  669. new CardLimitCount("BT2-047", 1),
  670. new CardLimitCount("EX2-039", 1),
  671. new CardLimitCount("EX1-068", 1),
  672. new CardLimitCount("P-008", 1),
  673. new CardLimitCount("P-025", 1),
  674. new CardLimitCount("BT2-069", 1),
  675. new CardLimitCount("BT13-012", 1),
  676. new CardLimitCount("EX4-019", 1),
  677. new CardLimitCount("BT7-069", 1),
  678. new CardLimitCount("BT14-002", 1),
  679. new CardLimitCount("BT15-102", 1),
  680. new CardLimitCount("EX5-015", 1),
  681. new CardLimitCount("EX5-018", 1),
  682. new CardLimitCount("EX5-062", 1),
  683. new CardLimitCount("P-123", 1),
  684. new CardLimitCount("P-130", 1),
  685. new CardLimitCount("ST2-13", 1),
  686. new CardLimitCount("BT9-098", 1),
  687. new CardLimitCount("BT15-057", 1),
  688. new CardLimitCount("BT14-084", 1),
  689. },
  690. new List<BannedPair>()
  691. {
  692. new BannedPair("EX5-065", new List<string>(){
  693. "P-097",
  694. "BT13-102",
  695. "ST16-14",
  696. })
  697. });
  698. #endregion
  699. }
  700. [System.Serializable]
  701. public class ColorSpriteDic : TableBase<CardColor, Sprite, SamplePair>
  702. {
  703. }
  704. [System.Serializable]
  705. public class TableBase<TKey, TValue, Type> where Type : KeyAndValue<TKey, TValue>
  706. {
  707. [SerializeField]
  708. private List<Type> list;
  709. private Dictionary<TKey, TValue> table;
  710. public Dictionary<TKey, TValue> GetTable()
  711. {
  712. if (table == null)
  713. {
  714. table = ConvertListToDictionary(list);
  715. }
  716. return table;
  717. }
  718. /// <summary>
  719. /// Editor Only
  720. /// </summary>
  721. public List<Type> GetList()
  722. {
  723. return list;
  724. }
  725. static Dictionary<TKey, TValue> ConvertListToDictionary(List<Type> list)
  726. {
  727. Dictionary<TKey, TValue> dic = new Dictionary<TKey, TValue>();
  728. foreach (KeyAndValue<TKey, TValue> pair in list)
  729. {
  730. dic.Add(pair.Key, pair.Value);
  731. }
  732. return dic;
  733. }
  734. }
  735. /// <summary>
  736. /// Serializable KeyValuePair
  737. /// </summary>
  738. [System.Serializable]
  739. public class KeyAndValue<TKey, TValue>
  740. {
  741. public TKey Key;
  742. public TValue Value;
  743. public KeyAndValue(TKey key, TValue value)
  744. {
  745. Key = key;
  746. Value = value;
  747. }
  748. public KeyAndValue(KeyValuePair<TKey, TValue> pair)
  749. {
  750. Key = pair.Key;
  751. Value = pair.Value;
  752. }
  753. }
  754. [System.Serializable]
  755. public class SamplePair : KeyAndValue<CardColor, Sprite>
  756. {
  757. public SamplePair(CardColor key, Sprite value) : base(key, value)
  758. {
  759. }
  760. }
  761. public class DictionaryUtility
  762. {
  763. public static CardColor GetCardColor(string s, Dictionary<CardColor, string> PokemonTypeStringDictionary)
  764. {
  765. CardColor pokemonType = PokemonTypeStringDictionary.First(x => x.Value == s).Key;
  766. return pokemonType;
  767. }
  768. public static List<CardKind> GetCardKind(string CardKindName, Dictionary<CardKind, string> CardKindNameDictionary)
  769. {
  770. List<CardKind> Typing = new List<CardKind>();
  771. string[] Types = CardKindName.Split("/");
  772. foreach(string Type in Types)
  773. {
  774. CardKind cardKind = Type.IsNullOrEmpty() ? CardKind.Tamer : CardKindNameDictionary.First(x => x.Value == Type).Key;
  775. Typing.Add(cardKind);
  776. }
  777. return Typing;
  778. }
  779. public static Rarity GetEvoStage(string EvoStageName, Dictionary<Rarity, string> EvoStageNameDictionary)
  780. {
  781. Rarity evoStage = EvoStageNameDictionary.First(x => x.Value == EvoStageName).Key;
  782. return evoStage;
  783. }
  784. }
  785. public class ParmanentParameterComparer : ParameterComparer
  786. {
  787. public override bool Equals(object[] i_lhs, object[] i_rhs)
  788. {
  789. if (i_lhs.Length == i_rhs.Length)
  790. {
  791. bool same = true;
  792. List<Permanent> i_lhs_list = new List<Permanent>();
  793. List<Permanent> i_rhs_list = new List<Permanent>();
  794. for (int i = 0; i < i_lhs.Length; i++)
  795. {
  796. i_lhs_list.Add(((Permanent[])i_lhs)[i]);
  797. i_rhs_list.Add(((Permanent[])i_rhs)[i]);
  798. }
  799. i_lhs_list = i_lhs_list.OrderBy((value) => value.PermanentFrame.FrameID).ToList();
  800. i_rhs_list = i_rhs_list.OrderBy((value) => value.PermanentFrame.FrameID).ToList();
  801. for (int i = 0; i < i_lhs.Length; i++)
  802. {
  803. if (i_lhs[i] != i_rhs[i])
  804. {
  805. same = false;
  806. break;
  807. }
  808. }
  809. if (!same)
  810. {
  811. return false;
  812. }
  813. return true;
  814. }
  815. return false;
  816. }
  817. }
  818. public class ParameterComparer : IEqualityComparer<object[]>
  819. {
  820. public virtual bool Equals(object[] i_lhs, object[] i_rhs)
  821. {
  822. return false;
  823. }
  824. public virtual int GetHashCode(object[] i_obj)
  825. {
  826. return 0;
  827. }
  828. #region select k elements from n different elements
  829. public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k)
  830. {
  831. if (items.Count() < k)
  832. {
  833. k = items.Count();
  834. }
  835. if (k == 1)
  836. {
  837. foreach (var item in items)
  838. {
  839. yield return new T[] { item };
  840. }
  841. yield break;
  842. }
  843. foreach (var item in items)
  844. {
  845. var leftside = new T[] { item };
  846. var unused = items.Except(leftside);
  847. foreach (var rightside in Enumerate(unused, k - 1))
  848. {
  849. yield return leftside.Concat(rightside).ToArray();
  850. }
  851. }
  852. }
  853. #endregion
  854. }