DataBase.cs 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024
  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 ReplaceToASCII(string text)
  451. {
  452. if (string.IsNullOrEmpty(text))
  453. {
  454. return "";
  455. }
  456. return text
  457. .Replace("<", "<")
  458. .Replace(">", ">")
  459. .Replace("、", ",")
  460. .Replace(",", ",")
  461. .Replace("“", "\"")
  462. .Replace("・", "")
  463. .Replace(" ", "")
  464. .Replace("!", "!");
  465. }
  466. public static string DigiburstRegex = "デジバースト[0-9]";
  467. public static string FirstPlayerKey = "FirstPlayerId";
  468. public static string FirstPlayerIndexIdKey = "FirstPlayerIndexId";
  469. #region use for sort
  470. public static CardKind[] cardKinds = new[] { CardKind.Digimon, CardKind.Tamer, CardKind.Option };
  471. public static CardColor[] cardColors = new[] { CardColor.Red, CardColor.Blue, CardColor.Yellow, CardColor.Green, CardColor.Black, CardColor.Purple, CardColor.White, CardColor.None };
  472. public static string[] SetIDs = new string[]
  473. {
  474. "BT28",
  475. "BT27",
  476. "BT26",
  477. "BT25",
  478. "BT24",
  479. "BT23",
  480. "BT22",
  481. "BT21",
  482. "BT20",
  483. "BT19",
  484. "BT18",
  485. "BT17",
  486. "BT16",
  487. "BT15",
  488. "BT14",
  489. "BT13",
  490. "BT12",
  491. "BT11",
  492. "BT10",
  493. "BT9",
  494. "BT8",
  495. "BT7",
  496. "BT6",
  497. "BT5",
  498. "BT4",
  499. "BT3",
  500. "BT2",
  501. "BT1",
  502. "EX28",
  503. "EX27",
  504. "EX26",
  505. "EX25",
  506. "EX24",
  507. "EX23",
  508. "EX22",
  509. "EX21",
  510. "EX20",
  511. "EX19",
  512. "EX18",
  513. "EX17",
  514. "EX16",
  515. "EX15",
  516. "EX14",
  517. "EX13",
  518. "EX12",
  519. "EX11",
  520. "EX10",
  521. "EX9",
  522. "EX8",
  523. "EX7",
  524. "EX6",
  525. "EX5",
  526. "EX4",
  527. "EX3",
  528. "EX2",
  529. "EX1",
  530. "RB11",
  531. "RB10",
  532. "RB9",
  533. "RB8",
  534. "RB7",
  535. "RB6",
  536. "RB5",
  537. "RB4",
  538. "RB3",
  539. "RB2",
  540. "RB1",
  541. "LM11",
  542. "LM10",
  543. "LM9",
  544. "LM8",
  545. "LM7",
  546. "LM6",
  547. "LM5",
  548. "LM4",
  549. "LM3",
  550. "LM2",
  551. "LM1",
  552. "ST28",
  553. "ST27",
  554. "ST26",
  555. "ST25",
  556. "ST24",
  557. "ST23",
  558. "ST22",
  559. "ST21",
  560. "ST20",
  561. "ST19",
  562. "ST18",
  563. "ST17",
  564. "ST16",
  565. "ST15",
  566. "ST14",
  567. "ST13",
  568. "ST12",
  569. "ST11",
  570. "ST10",
  571. "ST9",
  572. "ST8",
  573. "ST7",
  574. "ST6",
  575. "ST5",
  576. "ST4",
  577. "ST3",
  578. "ST2",
  579. "ST1",
  580. "P",
  581. };
  582. #endregion
  583. #region ENG ban list
  584. public static CardRestriction ENGBanList = new CardRestriction(new List<CardLimitCount>()
  585. {
  586. new CardLimitCount("BT11-064", 1),
  587. new CardLimitCount("BT10-009", 1),
  588. new CardLimitCount("BT7-107", 1),
  589. new CardLimitCount("BT7-072", 1),
  590. new CardLimitCount("BT7-064", 1),
  591. new CardLimitCount("BT7-038", 1),
  592. new CardLimitCount("BT6-100", 1),
  593. new CardLimitCount("BT5-109", 0),
  594. new CardLimitCount("BT3-103", 1),
  595. new CardLimitCount("BT3-054", 1),
  596. new CardLimitCount("BT2-047", 1),
  597. new CardLimitCount("EX2-039", 1),
  598. new CardLimitCount("EX1-068", 1),
  599. new CardLimitCount("P-008", 1),
  600. new CardLimitCount("P-025", 1),
  601. new CardLimitCount("BT2-069", 1),
  602. new CardLimitCount("BT13-012", 1),
  603. new CardLimitCount("BT7-069", 1),
  604. new CardLimitCount("BT14-002", 1),
  605. new CardLimitCount("BT15-102", 1),
  606. new CardLimitCount("EX5-015", 1),
  607. new CardLimitCount("EX5-018", 1),
  608. new CardLimitCount("EX5-062", 1),
  609. new CardLimitCount("P-123", 1),
  610. new CardLimitCount("P-130", 1),
  611. new CardLimitCount("ST2-13", 1),
  612. new CardLimitCount("BT9-098", 1),
  613. new CardLimitCount("BT15-057", 1),
  614. new CardLimitCount("BT14-084", 1),
  615. new CardLimitCount("BT2-090", 0),
  616. new CardLimitCount("BT4-104", 1),
  617. new CardLimitCount("BT4-111", 1),
  618. new CardLimitCount("BT11-033", 1),
  619. new CardLimitCount("BT17-069", 1),
  620. new CardLimitCount("EX4-030", 1),
  621. new CardLimitCount("P-029", 1),
  622. new CardLimitCount("P-030", 1),
  623. new CardLimitCount("ST9-09", 1),
  624. new CardLimitCount("EX5-065", 0),
  625. new CardLimitCount("BT1-090", 1),
  626. new CardLimitCount("BT16-011", 1),
  627. new CardLimitCount("EX3-057", 1),
  628. new CardLimitCount("BT6-104", 1),
  629. new CardLimitCount("BT13-110", 1),
  630. new CardLimitCount("EX4-006", 1),
  631. new CardLimitCount("BT19-040", 1),
  632. new CardLimitCount("EX2-070", 1),
  633. new CardLimitCount("EX1-021", 1),
  634. new CardLimitCount("BT23-032", 1),
  635. new CardLimitCount("BT3-092", 1),
  636. new CardLimitCount("BT10-080", 1),
  637. new CardLimitCount("EX5-059", 1),
  638. new CardLimitCount("EX5-061", 1),
  639. },
  640. new List<BannedPair>()
  641. {
  642. new BannedPair("BT20-037", new List<string>(){
  643. "BT17-035",
  644. "EX8-037",
  645. }),
  646. new BannedPair("EX2-007", new List<string>(){
  647. "EX7-064",
  648. })
  649. });
  650. #endregion
  651. #region JPN ban list
  652. public static CardRestriction JPNBanList = new CardRestriction(new List<CardLimitCount>()
  653. {
  654. new CardLimitCount("BT11-064", 1),
  655. new CardLimitCount("BT10-009", 1),
  656. new CardLimitCount("BT9-099", 1),
  657. new CardLimitCount("BT7-107", 1),
  658. new CardLimitCount("BT7-072", 1),
  659. new CardLimitCount("BT7-064", 1),
  660. new CardLimitCount("BT7-038", 1),
  661. new CardLimitCount("BT6-100", 1),
  662. new CardLimitCount("BT5-109", 0),
  663. new CardLimitCount("BT3-103", 1),
  664. new CardLimitCount("BT3-054", 1),
  665. new CardLimitCount("BT2-047", 1),
  666. new CardLimitCount("EX2-039", 1),
  667. new CardLimitCount("EX1-068", 1),
  668. new CardLimitCount("P-008", 1),
  669. new CardLimitCount("P-025", 1),
  670. new CardLimitCount("BT2-069", 1),
  671. new CardLimitCount("BT13-012", 1),
  672. new CardLimitCount("EX4-019", 1),
  673. new CardLimitCount("BT7-069", 1),
  674. new CardLimitCount("BT14-002", 1),
  675. new CardLimitCount("BT15-102", 1),
  676. new CardLimitCount("EX5-015", 1),
  677. new CardLimitCount("EX5-018", 1),
  678. new CardLimitCount("EX5-062", 1),
  679. new CardLimitCount("P-123", 1),
  680. new CardLimitCount("P-130", 1),
  681. new CardLimitCount("ST2-13", 1),
  682. new CardLimitCount("BT9-098", 1),
  683. new CardLimitCount("BT15-057", 1),
  684. new CardLimitCount("BT14-084", 1),
  685. },
  686. new List<BannedPair>()
  687. {
  688. new BannedPair("EX5-065", new List<string>(){
  689. "P-097",
  690. "BT13-102",
  691. "ST16-14",
  692. })
  693. });
  694. #endregion
  695. }
  696. [System.Serializable]
  697. public class ColorSpriteDic : TableBase<CardColor, Sprite, SamplePair>
  698. {
  699. }
  700. [System.Serializable]
  701. public class TableBase<TKey, TValue, Type> where Type : KeyAndValue<TKey, TValue>
  702. {
  703. [SerializeField]
  704. private List<Type> list;
  705. private Dictionary<TKey, TValue> table;
  706. public Dictionary<TKey, TValue> GetTable()
  707. {
  708. if (table == null)
  709. {
  710. table = ConvertListToDictionary(list);
  711. }
  712. return table;
  713. }
  714. /// <summary>
  715. /// Editor Only
  716. /// </summary>
  717. public List<Type> GetList()
  718. {
  719. return list;
  720. }
  721. static Dictionary<TKey, TValue> ConvertListToDictionary(List<Type> list)
  722. {
  723. Dictionary<TKey, TValue> dic = new Dictionary<TKey, TValue>();
  724. foreach (KeyAndValue<TKey, TValue> pair in list)
  725. {
  726. dic.Add(pair.Key, pair.Value);
  727. }
  728. return dic;
  729. }
  730. }
  731. /// <summary>
  732. /// Serializable KeyValuePair
  733. /// </summary>
  734. [System.Serializable]
  735. public class KeyAndValue<TKey, TValue>
  736. {
  737. public TKey Key;
  738. public TValue Value;
  739. public KeyAndValue(TKey key, TValue value)
  740. {
  741. Key = key;
  742. Value = value;
  743. }
  744. public KeyAndValue(KeyValuePair<TKey, TValue> pair)
  745. {
  746. Key = pair.Key;
  747. Value = pair.Value;
  748. }
  749. }
  750. [System.Serializable]
  751. public class SamplePair : KeyAndValue<CardColor, Sprite>
  752. {
  753. public SamplePair(CardColor key, Sprite value) : base(key, value)
  754. {
  755. }
  756. }
  757. public class DictionaryUtility
  758. {
  759. public static CardColor GetCardColor(string s, Dictionary<CardColor, string> PokemonTypeStringDictionary)
  760. {
  761. CardColor pokemonType = PokemonTypeStringDictionary.First(x => x.Value == s).Key;
  762. return pokemonType;
  763. }
  764. public static List<CardKind> GetCardKind(string CardKindName, Dictionary<CardKind, string> CardKindNameDictionary)
  765. {
  766. List<CardKind> Typing = new List<CardKind>();
  767. string[] Types = CardKindName.Split("/");
  768. foreach(string Type in Types)
  769. {
  770. CardKind cardKind = Type.IsNullOrEmpty() ? CardKind.Tamer : CardKindNameDictionary.First(x => x.Value == Type).Key;
  771. Typing.Add(cardKind);
  772. }
  773. return Typing;
  774. }
  775. public static Rarity GetEvoStage(string EvoStageName, Dictionary<Rarity, string> EvoStageNameDictionary)
  776. {
  777. Rarity evoStage = EvoStageNameDictionary.First(x => x.Value == EvoStageName).Key;
  778. return evoStage;
  779. }
  780. }
  781. public class ParmanentParameterComparer : ParameterComparer
  782. {
  783. public override bool Equals(object[] i_lhs, object[] i_rhs)
  784. {
  785. if (i_lhs.Length == i_rhs.Length)
  786. {
  787. bool same = true;
  788. List<Permanent> i_lhs_list = new List<Permanent>();
  789. List<Permanent> i_rhs_list = new List<Permanent>();
  790. for (int i = 0; i < i_lhs.Length; i++)
  791. {
  792. i_lhs_list.Add(((Permanent[])i_lhs)[i]);
  793. i_rhs_list.Add(((Permanent[])i_rhs)[i]);
  794. }
  795. i_lhs_list = i_lhs_list.OrderBy((value) => value.PermanentFrame.FrameID).ToList();
  796. i_rhs_list = i_rhs_list.OrderBy((value) => value.PermanentFrame.FrameID).ToList();
  797. for (int i = 0; i < i_lhs.Length; i++)
  798. {
  799. if (i_lhs[i] != i_rhs[i])
  800. {
  801. same = false;
  802. break;
  803. }
  804. }
  805. if (!same)
  806. {
  807. return false;
  808. }
  809. return true;
  810. }
  811. return false;
  812. }
  813. }
  814. public class ParameterComparer : IEqualityComparer<object[]>
  815. {
  816. public virtual bool Equals(object[] i_lhs, object[] i_rhs)
  817. {
  818. return false;
  819. }
  820. public virtual int GetHashCode(object[] i_obj)
  821. {
  822. return 0;
  823. }
  824. #region select k elements from n different elements
  825. public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k)
  826. {
  827. if (items.Count() < k)
  828. {
  829. k = items.Count();
  830. }
  831. if (k == 1)
  832. {
  833. foreach (var item in items)
  834. {
  835. yield return new T[] { item };
  836. }
  837. yield break;
  838. }
  839. foreach (var item in items)
  840. {
  841. var leftside = new T[] { item };
  842. var unused = items.Except(leftside);
  843. foreach (var rightside in Enumerate(unused, k - 1))
  844. {
  845. yield return leftside.Concat(rightside).ToArray();
  846. }
  847. }
  848. }
  849. #endregion
  850. }