DataBase.cs 29 KB

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