DataBase.cs 29 KB

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