You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

script-skill-parser.js 106 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973
  1. let merge_skill = false;
  2. const Attributes = {
  3. /*0: "Fire",
  4. 1: "Water",
  5. 2: "Wood",
  6. 3: "Light",
  7. 4: "Dark",
  8. 5: "Heart",
  9. 6: "Jammer",
  10. 7: "Poison",
  11. 8: "MPoison",
  12. 9: "Bomb",*/
  13. Fire: 0,
  14. Water: 1,
  15. Wood: 2,
  16. Light: 3,
  17. Dark: 4,
  18. Heart: 5,
  19. Jammer: 6,
  20. Poison: 7,
  21. MPoison: 8,
  22. Bomb: 9,
  23. }
  24. for (let name in Attributes)
  25. {
  26. Attributes[Attributes[name]] = name;
  27. }
  28. Attributes.all = function () {
  29. return [
  30. this.Fire,
  31. this.Water,
  32. this.Wood,
  33. this.Light,
  34. this.Dark
  35. ];
  36. }
  37. Attributes._6color = function () {
  38. return [
  39. this.Fire,
  40. this.Water,
  41. this.Wood,
  42. this.Light,
  43. this.Dark,
  44. this.Heart
  45. ];
  46. }
  47. Attributes.orbs = function () {
  48. return [
  49. this.Fire,
  50. this.Water,
  51. this.Wood,
  52. this.Light,
  53. this.Dark,
  54. this.Heart,
  55. this.Jammer,
  56. this.Poison,
  57. this.MPoison,
  58. this.Bomb,
  59. ];
  60. }
  61. //代码来自于 https://www.jianshu.com/p/3644833bca33
  62. function isEqual(obj1,obj2) {
  63. //判断是否是对象或数组
  64. function isObject(obj) {
  65. return typeof obj === 'object' && obj !== null;
  66. }
  67. // 两个数据有任何一个不是对象或数组
  68. if (!isObject(obj1) || !isObject(obj2)) {
  69. // 值类型(注意:参与equal的一般不会是函数)
  70. return obj1 === obj2;
  71. }
  72. // 如果传的两个参数都是同一个对象或数组
  73. if (obj1 === obj2) {
  74. return true;
  75. }
  76. // 两个都是对象或数组,而且不相等
  77. // 1.先比较obj1和obj2的key的个数,是否一样
  78. const obj1Keys = Object.keys(obj1);
  79. const obj2Keys = Object.keys(obj2);
  80. if (obj1Keys.length !== obj2Keys.length) {
  81. return false;
  82. }
  83. // 如果key的个数相等,就是第二步
  84. // 2.以obj1为基准,和obj2依次递归比较
  85. for (let key in obj1) {
  86. // 比较当前key的value --- 递归
  87. const res = isEqual(obj1[key], obj2[key]);
  88. if (!res) {
  89. return false;
  90. }
  91. }
  92. // 3.全相等
  93. return true
  94. }
  95. class Orb
  96. {
  97. color = null;
  98. states = [];
  99. enhanced = false; //锁定
  100. locked = false; //锁定
  101. bound = false;
  102. variation = false; //随机变换
  103. constructor(color)
  104. {
  105. this.color = color;
  106. }
  107. valueOf() {
  108. return this.color;
  109. }
  110. }
  111. class Board
  112. {
  113. rowCount = 6;
  114. columnCount = 7;
  115. data = [];
  116. constructor(def = null)
  117. {
  118. for (let ri=0;ri<this.rowCount;ri++)
  119. {
  120. const col = [];
  121. for (let ci=0;ci<this.columnCount;ci++)
  122. {
  123. col.push(new Orb(Array.isArray(def) ? null : def));
  124. }
  125. this.data.push(col);
  126. }
  127. //如果传入的是数组,直接随机分布
  128. if (Array.isArray(def))
  129. {
  130. this.randomFill(def);
  131. }
  132. }
  133. //填充序列
  134. sequenceFill(sequence, exclude)
  135. {
  136. if (!Array.isArray(exclude) && exclude != null)
  137. exclude = [exclude];
  138. const o = sequence.entries();
  139. //65版部分
  140. for (let ri=0;ri<this.data.length;ri++)
  141. {
  142. if (ri == 2) ri++;
  143. const row = this.data[ri];
  144. for (let ci=0;ci<row.length;ci++)
  145. {
  146. if (ci == 3) ci++;
  147. //从数组中随机取出一个
  148. if (exclude && exclude.includes(row[ci].color)) continue;
  149. const c = o.next().value?.[1] ?? row[ci].color;
  150. if (c == "variation")
  151. row[ci].states.push(c);
  152. else
  153. row[ci].color = c;
  154. }
  155. }
  156. //填充剩下的部分
  157. for (let ri=0;ri<this.data.length;ri++)
  158. {
  159. if (ri == 2) ri++;
  160. const row = this.data[ri];
  161. if (exclude && exclude.includes(row[3].color)) continue;
  162. const c = o.next().value?.[1] ?? row[3].color;
  163. if (c == "variation")
  164. row[3].states.push(c);
  165. else
  166. row[3].color = c;
  167. }
  168. const row = this.data[2];
  169. for (let ci=0;ci<row.length;ci++)
  170. {
  171. if (exclude && exclude.includes(row[ci].color)) continue;
  172. const c = o.next().value?.[1] ?? row[3].color;
  173. if (c == "variation")
  174. row[ci].states.push(c);
  175. else
  176. row[ci].color = c;
  177. }
  178. }
  179. //将有序数组转为随机的数组
  180. sequenceToRandom(valueArray)
  181. {
  182. const randomData = [];
  183. //将65版之后的的提出来
  184. const maxCount = this.rowCount * this.columnCount
  185. let secondaryData = valueArray.splice((this.rowCount - 1) * (this.columnCount - 1) - (maxCount - valueArray.length));
  186. while(valueArray.length > 0)
  187. {
  188. randomData.push(valueArray.randomShift());
  189. }
  190. while(secondaryData.length > 0)
  191. {
  192. randomData.push(secondaryData.randomShift());
  193. }
  194. return randomData;
  195. }
  196. //洗版的填充
  197. randomFill(attrs)
  198. {
  199. let valueArray = new Uint8Array(this.rowCount * this.columnCount);
  200. crypto.getRandomValues(valueArray); //获取符合密码学要求的安全的随机值
  201. valueArray = Array.from(valueArray.map(x => attrs[x % attrs.length])); //用所有宝珠随机填充
  202. //之后用每种颜色填充前3个
  203. attrs.forEach((attr,idx)=>{
  204. valueArray.fill(attr, idx * 3, (idx + 1) * 3);
  205. });
  206. //将上方数据重新乱序排列
  207. const randomData = this.sequenceToRandom(valueArray);
  208. this.sequenceFill(randomData);
  209. }
  210. //生成珠子的填充
  211. generateOrbs(attrs, count, exclude)
  212. {
  213. let space = this.rowCount * this.columnCount;
  214. if (exclude?.length > 0)
  215. {
  216. space -= this.data.flat().filter(o=>exclude.includes(o)).length;
  217. }
  218. let valueArray = new Array(space);
  219. attrs.forEach((attr,idx)=>{
  220. valueArray.fill(attr, idx * count, (idx + 1) * count);
  221. });
  222. //将上方数据重新乱序排列
  223. const randomData = this.sequenceToRandom(valueArray);
  224. this.sequenceFill(randomData, exclude);
  225. }
  226. //设定横行
  227. setRow(rowsNumber, attr = 0)
  228. {
  229. for (let row of rowsNumber)
  230. {
  231. if (row >= 2) row++;
  232. const rowData = this.data[row];
  233. for (let ri=0;ri<rowData.length;ri++)
  234. {
  235. rowData[ri].color = attr;
  236. }
  237. }
  238. }
  239. //设定竖列
  240. setColumn(colsNumber, attr = 0)
  241. {
  242. for (let col of colsNumber)
  243. {
  244. if (col >= 3) col++;
  245. for (let row of this.data)
  246. {
  247. row[col].color = attr;
  248. }
  249. }
  250. }
  251. //设定形状
  252. setShape(matrix, attr = 0)
  253. {
  254. function fillRow(rowData, inputRow, attr)
  255. {
  256. for (let col of inputRow)
  257. {
  258. if (col == 3) {
  259. if (attr == "variation")
  260. rowData[col].states.push(attr);
  261. else
  262. rowData[col].color = attr;
  263. }
  264. if (col >= 3) col++;
  265. if (attr == "variation")
  266. rowData[col].states.push(attr);
  267. else
  268. rowData[col].color = attr;
  269. }
  270. }
  271. for (let ri=0; ri<matrix.length; ri++)
  272. {
  273. if (ri == 2)
  274. {
  275. fillRow(this.data[ri], matrix[ri], attr);
  276. }
  277. fillRow(this.data[ri >= 2 ? ri+1 : ri], matrix[ri], attr);
  278. }
  279. }
  280. //面板叠加
  281. overlayBoard(board)
  282. {
  283. for (let ri=0; ri<board.length; ri++)
  284. {
  285. const rowNew = board[ri];
  286. const rowOld = this.data[ri];
  287. for (let ci=0; ci < rowNew.length; ci++)
  288. {
  289. rowOld[ci] = Object.assign(rowOld[ci], rowNew[ci]);
  290. }
  291. }
  292. }
  293. //导出数组
  294. valueOf()
  295. {
  296. return this.data;
  297. }
  298. //输出表格
  299. toTable()
  300. {
  301. const table = document.createElement("table");
  302. table.boardData = this.data;
  303. table.className = "board";
  304. this.data.forEach((rowData, ri, rArr) => {
  305. const row = table.insertRow();
  306. if (ri == 2 && rArr.length > 5) row.classList.add("board-row4");
  307. rowData.forEach((orbType, ci, cArr) => {
  308. const cell = row.insertCell();
  309. const orb = cell.appendChild(document.createElement('icon'));
  310. orb.className = "orb";
  311. if (orbType.color != null) orb.setAttribute("data-orb-icon", orbType.color);
  312. orbType.states.forEach(state=>orb.classList.add(state));
  313. if (ci == 3 && cArr.length > 6) cell.classList.add("board-cell5");
  314. });
  315. });
  316. if (this.data.length > 5) {
  317. table.onclick = toggle76;
  318. }
  319. function toggle76() {
  320. this.classList.toggle("board-76");
  321. }
  322. return table;
  323. }
  324. }
  325. const SkillValue = {
  326. isLess: function (value) {
  327. if (value.kind === SkillValueKind.Percent) return value.value < 1;
  328. if (value.kind === SkillValueKind.Constant) return value.value < 0;
  329. return false;
  330. }
  331. };
  332. const SkillValueKind = {
  333. Percent: 'mul',
  334. Constant: 'const',
  335. ConstantTo: 'const-to',
  336. xMaxHP: 'mul-maxhp',
  337. xHP: 'mul-hp',
  338. xCHP: 'mul-chp',
  339. xATK: 'mul-atk',
  340. xRCV: 'mul-rcv',
  341. RandomATK: 'random-atk',
  342. HPScale: 'hp-scale',
  343. xTeamHP: 'mul-team-hp',
  344. xTeamATK: 'mul-team-atk',
  345. xTeamRCV: 'mul-team-rcv',
  346. xAwakenings: 'mul-awakenings',
  347. };
  348. const SkillPowerUpKind = {
  349. Multiplier: 'mul',
  350. ScaleAttributes: 'scale-attrs',
  351. ScaleCombos: 'scale-combos',
  352. ScaleMatchLength: 'scale-match-len',
  353. ScaleMatchAttrs: 'scale-match-attrs',
  354. ScaleCross: 'scale-cross',
  355. ScaleRemainOrbs: 'scale-remain-orbs',
  356. ScaleStateKindCount: 'scale-state-kind-count',
  357. };
  358. const SkillKinds = {
  359. Unknown: "unknown",
  360. ActiveTurns: "active-turns",
  361. DamageEnemy: "damage-enemy",
  362. Vampire: "vampire",
  363. ReduceDamage: "reduce-damage",
  364. SelfHarm: "self-harm",
  365. Heal: "heal",
  366. AutoHealBuff: "auto-heal-buff",
  367. ChangeOrbs: "change-orbs",
  368. GenerateOrbs: "generate-orbs",
  369. FixedOrbs: "fixed-orbs",
  370. PowerUp: "power-up",
  371. CounterAttack: "counter-attack",
  372. SetOrbState: "set-orb-state",
  373. RateMultiply: "rate-mul",
  374. OrbDropIncrease: "orb-drop-incr",
  375. Resolve: "resolve",
  376. Delay: "delay",
  377. DefenseBreak: "def-break",
  378. MassAttack: "mass-attack",
  379. BoardChange: "board-change",
  380. Unbind: "unbind",
  381. BindSkill: "bind-skill",
  382. RandomSkills: "random-skills",
  383. EvolvedSkills: "evolved-skills",
  384. SkillProviso: "skill-proviso",
  385. ChangeAttribute: "change-attr",
  386. SkillBoost: "skill-boost",
  387. AddCombo: "add-combo",
  388. VoidEnemyBuff: "void-enemy-buff",
  389. Poison: "poison",
  390. CTW: "ctw",
  391. Gravity: "gravity",
  392. FollowAttack: "follow-attack",
  393. FollowAttackFixed: "follow-attack-fixed",
  394. AutoHeal: "auto-heal",
  395. TimeExtend: "time-extend",
  396. DropRefresh: "drop-refresh",
  397. LeaderChange: "leader-change",
  398. MinMatchLength: "min-match-len",
  399. FixedTime: "fixed-time",
  400. Drum: "drum",
  401. AutoPath: "auto-path",
  402. Board7x6: "7x6-board",
  403. NoSkyfall: "no-skyfall",
  404. Henshin: "henshin",
  405. VoidPoison: "void-poison",
  406. SkillProviso: "skill-proviso",
  407. ImpartAwakenings: "impart-awakenings",
  408. ObstructOpponent: "obstruct-opponent",
  409. }
  410. function skillParser(skillId)
  411. {
  412. function merge(skills)
  413. {
  414. //解封部分的合并
  415. let unbinds = skills.filter(skill=>skill.kind == SkillKinds.Unbind);
  416. if (unbinds.length>1)
  417. { //把后面的全都合并到第一个
  418. unbinds.reduce((pre,cur)=>{
  419. pre.normal = pre.normal || cur.normal;
  420. pre.awakenings = pre.awakenings || cur.awakenings;
  421. pre.matches = pre.matches || cur.matches;
  422. return pre
  423. });
  424. unbinds.shift(); //从筛选中去除第一个
  425. unbinds.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
  426. }
  427. //破吸部分的合并
  428. let voidBuff = skills.filter(skill=>skill.kind == SkillKinds.ActiveTurns &&
  429. skill.skill.kind == SkillKinds.VoidEnemyBuff);
  430. if (voidBuff.length>1 && voidBuff.every((s,i,a)=>s.turns == a[0].turns))
  431. { //把后面的全都合并到第一个
  432. voidBuff[0].skill.buffs = voidBuff.flatMap(s=>s.skill.buffs);
  433. voidBuff.shift(); //从筛选中去除第一个
  434. voidBuff.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
  435. }
  436. let fixedDamages = skills.filter(skill=>skill.kind == SkillKinds.DamageEnemy && skill.attr === 'fixed').filter((skill,idx,arr)=>skill.id==arr[0].id);
  437. if (fixedDamages.length>1)
  438. { //把后面的全都合并到第一个
  439. fixedDamages[0].times = fixedDamages.length;
  440. fixedDamages.shift(); //从筛选中去除第一个
  441. fixedDamages.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
  442. }
  443. let skillPowerUp = skills.filter(skill=>skill.kind == SkillKinds.PowerUp);
  444. if (skillPowerUp.length>1)
  445. {
  446. //合并技能效果
  447. function combinePowerUp(target, source) {
  448. if (source?.additional.length)
  449. {
  450. if (!Array.isArray(target.additional)) target.additional = [];
  451. for (let additional of source.additional)
  452. {
  453. target.additional.push(additional);
  454. }
  455. }
  456. if (source.reduceDamage != undefined)
  457. {
  458. if (!target.reduceDamage)
  459. target.reduceDamage = source.reduceDamage;
  460. else if (target.reduceDamage.kind === source.reduceDamage.kind)
  461. target.reduceDamage.value *= source.reduceDamage.value;
  462. }
  463. if (target?.value.baseAtk != undefined && source?.value.baseAtk) target.value.baseAtk *= source.value.baseAtk;
  464. if (target?.value.baseRcv != undefined && source?.value.baseRcv != undefined) target.value.baseRcv *= source.value.baseRcv;
  465. if (target?.value.bonusAtk != undefined && source?.value.bonusAtk != undefined) target.value.bonusAtk += source.value.bonusAtk;
  466. if (target?.value.bonusRcv != undefined && source?.value.bonusRcv != undefined) target.value.bonusRcv += source.value.bonusRcv;
  467. if (target?.value.atk != undefined && source?.value.atk != undefined) target.value.atk *= source.value.atk;
  468. if (target?.value.hp != undefined && source?.value.hp != undefined) target.value.hp *= source.value.hp;
  469. if (target?.value.rcv != undefined && source?.value.rcv != undefined) target.value.rcv *= source.value.rcv;
  470. }
  471. //十字
  472. let scaleCross = skillPowerUp.filter(skill=>skill.value.kind === SkillPowerUpKind.ScaleCross);
  473. function mergeScaleCrossAttr(skill)
  474. {
  475. let crosses = skill.value.crosses;
  476. let atk = crosses[0].atk;
  477. let rcv = crosses[0].rcv;
  478. if (crosses.length >= 2 &&
  479. crosses.every(cross=>cross.atk === atk && cross.rcv === rcv)
  480. ) {
  481. crosses[0].attr = Array.from(new Set(crosses.reduce((pre,cur)=>{
  482. pre.push(...cur.attr);
  483. return pre;
  484. }, [])));
  485. skill.value.crosses.splice(1);
  486. }
  487. }
  488. //每个十字技能,先把所有属性合并
  489. scaleCross.forEach(mergeScaleCrossAttr);
  490. //筛选出所有倍率一样的子技能
  491. scaleCross = scaleCross.filter((skill,idx,arr)=>{
  492. let atk = arr[0].value.crosses[0].atk;
  493. let rcv = arr[0].value.crosses[0].rcv;
  494. let crosses = skill.value.crosses;
  495. return crosses.every(cross=>cross.atk === atk && cross.rcv === rcv);
  496. });
  497. //先合并属性倍率
  498. if (scaleCross.length >= 1)
  499. { //把后面的全都合并到第一个
  500. scaleCross.reduce((pre,cur)=>{
  501. combinePowerUp(pre,cur);
  502. pre.value.crosses = pre.value.crosses.concat(cur.value.crosses);
  503. return pre
  504. });
  505. let _skill = scaleCross.shift(); //从筛选中去除第一个
  506. scaleCross.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
  507. mergeScaleCrossAttr(_skill);
  508. }
  509. //重新找出来十字,合并附加内容
  510. scaleCross = skills.filter(skill=>skill.kind == SkillKinds.PowerUp && skill.value.kind === SkillPowerUpKind.ScaleCross);
  511. scaleCross = scaleCross.filter((skill,idx,arr)=>{
  512. let s0 = arr[0];
  513. let attr0 = s0.value.crosses[0].attr.concat().sort();
  514. let attr1 = skill.value.crosses[0].attr.concat().sort();
  515. return isEqual(skill.condition, s0.condition) &&
  516. isEqual(skill.attrs, s0.attrs) &&
  517. isEqual(skill.types, s0.types) &&
  518. isEqual(attr0, attr1)
  519. ;
  520. });
  521. if (scaleCross.length > 1)
  522. { //把后面的全都合并到第一个
  523. scaleCross.reduce((pre,cur)=>{
  524. combinePowerUp(pre, cur);
  525. return pre
  526. });
  527. scaleCross.shift(); //从筛选中去除第一个
  528. scaleCross.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
  529. }
  530. //长串匹配
  531. let scaleMatchLength = skillPowerUp.filter(skill=>skill.value.kind === SkillPowerUpKind.ScaleMatchLength);
  532. scaleMatchLength = scaleMatchLength.groupBy((a,b)=>{
  533. let av = a.value;
  534. let bv = b.value;
  535. return isEqual(a.condition, b.condition) &&
  536. isEqual(a.attrs, b.attrs) &&
  537. isEqual(a.types, b.types) &&
  538. av.min === bv.min &&
  539. av.max === bv.max &&
  540. (av.matchAll === bv.matchAll || av.attrs.length <= 1) && isEqual(av.attrs, bv.attrs)
  541. ;
  542. });
  543. for (let group of scaleMatchLength)
  544. {
  545. if (group.length > 1)
  546. { //把后面的全都合并到第一个
  547. group.reduce((pre,cur)=>{
  548. combinePowerUp(pre, cur);
  549. return pre
  550. });
  551. group.shift(); //从筛选中去除第一个
  552. group.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
  553. }
  554. }
  555. //多串匹配
  556. let scaleMatchAttrs = skillPowerUp.filter(skill=>skill.value.kind === SkillPowerUpKind.ScaleMatchAttrs);
  557. scaleMatchAttrs = scaleMatchAttrs.filter((skill,idx,arr)=>{
  558. let s0 = arr[0];
  559. let v0 = s0.value;
  560. let v1 = skill.value;
  561. return isEqual(skill.condition, s0.condition) &&
  562. isEqual(skill.attrs, s0.attrs) &&
  563. isEqual(skill.types, s0.types) &&
  564. v0.min === v1.min &&
  565. v0.max === v1.max &&
  566. isEqual(v0.matches, v1.matches)
  567. ;
  568. });
  569. if (scaleMatchAttrs.length > 1)
  570. { //把后面的全都合并到第一个
  571. scaleMatchAttrs.reduce((pre,cur)=>{
  572. combinePowerUp(pre, cur);
  573. return pre
  574. });
  575. scaleMatchAttrs.shift(); //从筛选中去除第一个
  576. scaleMatchAttrs.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
  577. }
  578. //多色匹配
  579. let scaleAttributes = skillPowerUp.filter(skill=>skill.value.kind === SkillPowerUpKind.ScaleAttributes);
  580. scaleAttributes = scaleAttributes.filter((skill,idx,arr)=>{
  581. let s0 = arr[0];
  582. let v0 = s0.value;
  583. let v1 = skill.value;
  584. return isEqual(skill.condition, s0.condition) &&
  585. isEqual(skill.attrs, s0.attrs) &&
  586. isEqual(skill.types, s0.types) &&
  587. v0.min === v1.min &&
  588. v0.max === v1.max &&
  589. isEqual(v0.attrs, v1.attrs)
  590. ;
  591. });
  592. if (scaleAttributes.length > 1)
  593. { //把后面的全都合并到第一个
  594. scaleAttributes.reduce((pre,cur)=>{
  595. combinePowerUp(pre, cur);
  596. return pre
  597. });
  598. scaleAttributes.shift(); //从筛选中去除第一个
  599. scaleAttributes.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
  600. }
  601. //连击数
  602. let scaleCombos = skillPowerUp.filter(skill=>skill.value.kind === SkillPowerUpKind.ScaleCombos);
  603. scaleCombos = scaleCombos.filter((skill,idx,arr)=>{
  604. let s0 = arr[0];
  605. let v0 = s0.value;
  606. let v1 = skill.value;
  607. return isEqual(skill.condition, s0.condition) &&
  608. isEqual(skill.attrs, s0.attrs) &&
  609. isEqual(skill.types, s0.types) &&
  610. v0.min === v1.min &&
  611. v0.max === v1.max
  612. ;
  613. });
  614. if (scaleCombos.length > 1)
  615. { //把后面的全都合并到第一个
  616. scaleCombos.reduce((pre,cur)=>{
  617. combinePowerUp(pre, cur);
  618. return pre
  619. });
  620. scaleCombos.shift(); //从筛选中去除第一个
  621. scaleCombos.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
  622. }
  623. //普通倍率
  624. let multiplier = skillPowerUp.filter(skill=>skill.value.kind === SkillPowerUpKind.Multiplier
  625. && skill.condition?.LShape);
  626. multiplier = multiplier.filter((skill,idx,arr)=>{
  627. let s0 = arr[0];
  628. return !!skill.condition && isEqual(skill.condition, s0.condition) &&
  629. isEqual(skill.attrs, s0.attrs) &&
  630. isEqual(skill.types, s0.types)
  631. ;
  632. });
  633. if (multiplier.length)
  634. { //把后面的全都合并到第一个
  635. multiplier.reduce((pre,cur)=>{
  636. combinePowerUp(pre, cur);
  637. return pre
  638. });
  639. multiplier.shift(); //从筛选中去除第一个
  640. multiplier.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
  641. }
  642. }
  643. return skills;
  644. }
  645. const skill = Skills[skillId];
  646. if (!skill) return [];
  647. //此处用apply将这个parser传递到后面解析函数的this里,用于递归解析
  648. const result = parsers?.[skill.type]?.apply({ parser: skillParser }, skill.params)
  649. ?? { kind: SkillKinds.Unknown };
  650. let skills = (Array.isArray(result) ? result : [result])
  651. .filter(Boolean)
  652. .map(s => ({ id: skillId, type: skill.type, params: skill.params, ...s }));
  653. function splitProvisoSkill(skills)
  654. {
  655. let idx = skills.findIndex(skill=>skill.kind == SkillKinds.SkillProviso);
  656. if (idx>=0)
  657. {
  658. return [
  659. skills.slice(0,idx),
  660. skills.slice(idx, idx+1),
  661. skills.slice(idx+1),
  662. ];
  663. }else
  664. {
  665. return [skills];
  666. }
  667. }
  668. if (merge_skill)
  669. {
  670. let skillsSplit = splitProvisoSkill(skills).map(_skills=>merge(_skills));
  671. skills = skillsSplit.flat(1);
  672. }
  673. return skills;
  674. }
  675. //返回flag里值为true的数组,如[1,4,7]
  676. function flags(num){
  677. /*
  678. return Array.from(new Array(32),(i,n)=>n).filter(n => num & (1 << n)); //性能太差
  679. return new Array(32).fill(null).map((i,n)=>n).filter(n => num & (1 << n)); //性能比上者好,但还是不够快
  680. */
  681. const arr = [];
  682. for (let i = 0; i<32;i++)
  683. {
  684. if (num & (1<<i))
  685. {
  686. arr.push(i);
  687. }
  688. }
  689. return arr;
  690. }
  691. const v = {
  692. percent: function(value) {
  693. return { kind: SkillValueKind.Percent, value: (value / 100) ?? 1 };
  694. },
  695. constant: function(value) {
  696. return { kind: SkillValueKind.Constant, value: value ?? 0 };
  697. },
  698. constantTo: function(value) {
  699. return { kind: SkillValueKind.ConstantTo, value: value ?? 1 };
  700. },
  701. xMaxHP: function(value) {
  702. return { kind: SkillValueKind.xMaxHP, value: (value / 100) ?? 1 };
  703. },
  704. xHP: function(value) {
  705. return { kind: SkillValueKind.xHP, value: (value / 100) ?? 1 };
  706. },
  707. xCHP: function(value) {
  708. return { kind: SkillValueKind.xCHP, value: (value / 100) ?? 1 };
  709. },
  710. xATK: function(value) {
  711. return { kind: SkillValueKind.xATK, value: (value / 100) ?? 1 };
  712. },
  713. xRCV: function(value) {
  714. return { kind: SkillValueKind.xRCV, value: (value / 100) ?? 1 };
  715. },
  716. randomATK: function(min, max) {
  717. return { kind: SkillValueKind.RandomATK, min: (min / 100) ?? 1, max: (max / 100) ?? 1, scale: 1 };
  718. },
  719. hpScale: function(min, max, scale) {
  720. return { kind: SkillValueKind.HPScale, min: (min / 100) ?? 1, max: (max / 100) ?? 1, scale: (scale / 100) ?? 1 };
  721. },
  722. xTeamHP: function(value) {
  723. return { kind: SkillValueKind.xTeamHP, value: (value / 100) ?? 1 };
  724. },
  725. xTeamATK: function(attrs, value) {
  726. return { kind: SkillValueKind.xTeamATK, attrs: attrs, value: (value / 100) ?? 1 };
  727. },
  728. xTeamRCV: function(value) {
  729. return { kind: SkillValueKind.xTeamRCV, value: (value / 100) ?? 1 };
  730. },
  731. percentAwakenings: function(awakenings, value) {
  732. return { kind: SkillValueKind.xAwakenings, awakenings: awakenings, value: value };
  733. },
  734. };
  735. const c = {
  736. hp: function (min, max) {
  737. return { hp: { min: min / 100, max: max / 100 } };
  738. },
  739. exact: function (type, value, attrs, multiple = false) {
  740. if (attrs === void 0) { attrs = Attributes.all(); }
  741. return { exact: { type: type, value: value, attrs: attrs, multiple: multiple} };
  742. },
  743. compo: function (type, ids) {
  744. return { compo: { type: type, ids: ids } };
  745. },
  746. remainOrbs: function (count) { return { remainOrbs: { count: count } }; },
  747. useSkill: function () { return { useSkill: true }; },
  748. multiplayer: function () { return { multiplayer: true }; },
  749. prob: function (percent) { return { prob: percent }; },
  750. LShape: function (attrs) { return { LShape: { attrs: attrs } }; },
  751. heal: function (min) { return { heal: { min: min } }; },
  752. stage: function (min, max) {
  753. return { stage: { min: min ?? 0, max: max ?? 0 } };
  754. },
  755. }
  756. const p = {
  757. mul: function (values) {
  758. if (Array.isArray(values)) {
  759. return {
  760. kind: SkillPowerUpKind.Multiplier,
  761. hp: 1,
  762. atk: values[0] / 100,
  763. rcv: values[1] / 100
  764. };
  765. }
  766. else {
  767. return {
  768. kind: SkillPowerUpKind.Multiplier,
  769. hp: (values.hp ?? 100) / 100,
  770. atk: (values.atk ?? 100) / 100,
  771. rcv: (values.rcv ?? 100) / 100
  772. };
  773. }
  774. },
  775. stats: function (value) {
  776. let statTypes = Array.from(arguments).slice(1);
  777. return [
  778. statTypes.indexOf(1) >= 0 ? value : 100,
  779. statTypes.indexOf(2) >= 0 ? value : 100
  780. ];
  781. },
  782. scale: function (min, max, baseMul, bonusMul) {
  783. return {
  784. min: min,
  785. max: max ?? min,
  786. baseAtk: (baseMul[0] / 100) ?? 1,
  787. baseRcv: (baseMul[1] / 100) ?? 1,
  788. bonusAtk: (bonusMul[0] / 100) ?? 0,
  789. bonusRcv: (bonusMul[1] / 100) ?? 0
  790. };
  791. },
  792. scaleAttrs: function (attrs, min, max, baseMul, bonusMul) {
  793. return { kind: SkillPowerUpKind.ScaleAttributes, attrs: attrs ,...this.scale(min, max, baseMul, bonusMul) };
  794. },
  795. scaleCombos: function (min, max, baseMul, bonusMul) {
  796. return { kind: SkillPowerUpKind.ScaleCombos ,...this.scale(min, max, baseMul, bonusMul) };
  797. },
  798. scaleMatchLength: function (attrs, min, max, baseMul, bonusMul, matchAll = false) {
  799. /*if (min <= 3 && min === max)
  800. return this.scaleAttrs(attrs, matchAll ? attrs.length : 1, matchAll ? attrs.length : 1, baseMul, bonusMul);
  801. else*/
  802. return { kind: SkillPowerUpKind.ScaleMatchLength, attrs: attrs, matchAll: matchAll ,...this.scale(min, max, baseMul, bonusMul) };
  803. },
  804. scaleMatchAttrs: function (matches, min, max, baseMul, bonusMul) {
  805. const flatMatches = matches.flat(); //当匹配的全是不同颜色时,切换成匹配颜色的技能
  806. if (new Set(flatMatches).size === flatMatches.length)
  807. return this.scaleAttrs(matches, min, max, baseMul, bonusMul);
  808. else
  809. return { kind: SkillPowerUpKind.ScaleMatchAttrs, matches: matches ,...this.scale(min, max, baseMul, bonusMul) };
  810. },
  811. scaleCross: function (crosses) {
  812. return { kind: SkillPowerUpKind.ScaleCross, crosses: crosses.map(cross => ({ ...cross, atk: ((cross.atk ?? 100) / 100), rcv: ((cross.rcv ?? 100) / 100)})) };
  813. },
  814. scaleRemainOrbs: function (max, baseMul, bonusMul) {
  815. return { kind: SkillPowerUpKind.ScaleRemainOrbs ,...this.scale(bonusMul ? 0 : max, max, baseMul, bonusMul) };
  816. },
  817. scaleStateKindCount: function (awakenings, attrs, types, value) {
  818. return { kind: SkillPowerUpKind.ScaleStateKindCount, awakenings: awakenings, attrs: attrs, types: types, value: value };
  819. },
  820. }
  821. function activeTurns(turns, skill) {
  822. return skill ? { kind: SkillKinds.ActiveTurns, turns: turns, skill: skill } : null;
  823. }
  824. function damageEnemy(target, attr, damage) {
  825. return { kind: SkillKinds.DamageEnemy, target: target, attr: attr, damage: damage };
  826. }
  827. function vampire(attr, damageValue, healValue) {
  828. return { kind: SkillKinds.Vampire, attr: attr, damage: damageValue, heal: healValue };
  829. }
  830. function reduceDamage(attrs, percent, condition, prob) {
  831. return { kind: SkillKinds.ReduceDamage, attrs: attrs, percent: percent, condition: condition, prob: prob || 1 };
  832. }
  833. function selfHarm(value) {
  834. return { kind: SkillKinds.SelfHarm, value: value };
  835. }
  836. function heal(value) {
  837. return { kind: SkillKinds.Heal, value: value };
  838. }
  839. function autoHealBuff(value) {
  840. return { kind: SkillKinds.AutoHealBuff, value: value };
  841. }
  842. function fromTo(from, to) {
  843. return { from: from, to: to };
  844. }
  845. function changeOrbs() {
  846. return { kind: SkillKinds.ChangeOrbs, changes: Array.from(arguments) };
  847. }
  848. function generateOrbs(orbs, exclude, count, time) {
  849. return { kind: SkillKinds.GenerateOrbs, orbs: orbs, exclude: exclude, count: count, time: time};
  850. }
  851. function fixedOrbs() {
  852. return { kind: SkillKinds.FixedOrbs, generates: Array.from(arguments) };
  853. }
  854. function powerUp(attrs, types, value, condition = null, reduceDamageValue = null, additional = []) {
  855. if (value.kind === SkillPowerUpKind.Multiplier) {
  856. let hp = value.hp, atk = value.atk, rcv = value.rcv;
  857. if (hp === 1 && atk === 1 && rcv === 1 && !reduceDamage)
  858. return null;
  859. }
  860. if (attrs?.targets != undefined) {
  861. return { kind: SkillKinds.PowerUp, targets: attrs.targets, attrs: null, types: null, condition: condition, value: value, reduceDamage: reduceDamageValue, additional: additional};
  862. }
  863. return { kind: SkillKinds.PowerUp, attrs: attrs, types: types, condition: condition, value: value, reduceDamage: reduceDamageValue, additional: additional};
  864. }
  865. function counterAttack(attr, prob, value) {
  866. return { kind: SkillKinds.CounterAttack, attr: attr, prob: prob, value: value };
  867. }
  868. function setOrbState(orbs, state, arg) {
  869. return { kind: SkillKinds.SetOrbState, orbs: orbs, state: state, arg: arg};
  870. }
  871. function rateMultiply(value, rate) {
  872. return { kind: SkillKinds.RateMultiply, value: value, rate: rate };
  873. }
  874. function orbDropIncrease(value, attrs, flag) {
  875. return { kind: SkillKinds.OrbDropIncrease, value: value, attrs: attrs, flag: flag };
  876. }
  877. function resolve(min, max) {
  878. return { kind: SkillKinds.Resolve, min: min, max: max };
  879. }
  880. function unbind(normal, awakenings, matches) {
  881. return { kind: SkillKinds.Unbind, normal: normal, awakenings: awakenings , matches: matches};
  882. }
  883. function bindSkill() { return { kind: SkillKinds.BindSkill}; }
  884. function boardChange(attrs) {
  885. return { kind: SkillKinds.BoardChange, attrs: attrs };
  886. }
  887. function randomSkills(skills) {
  888. return { kind: SkillKinds.RandomSkills, skills: skills };
  889. }
  890. function evolvedSkills(loop, skills) {
  891. return { kind: SkillKinds.EvolvedSkills, loop: loop, skills: skills };
  892. }
  893. function changeAttr(target, attr) {
  894. return { kind: SkillKinds.ChangeAttribute, target: target, attr: attr ?? 0 };
  895. }
  896. function gravity(value) {
  897. return { kind: SkillKinds.Gravity, value: value };
  898. }
  899. function voidEnemyBuff(buffs) {
  900. return { kind: SkillKinds.VoidEnemyBuff, buffs: buffs };
  901. }
  902. function skillBoost(value1, value2) { return { kind: SkillKinds.SkillBoost, min: value1, max: value2 ?? value1 }; }
  903. function minMatch(value) { return { kind: SkillKinds.MinMatchLength, value: value }; }
  904. function fixedTime(value) { return { kind: SkillKinds.FixedTime, value: v.constant(value) }; }
  905. function addCombo(value) { return { kind: SkillKinds.AddCombo, value: value }; }
  906. function defBreak(value) { return { kind: SkillKinds.DefenseBreak, value: value }; }
  907. function poison(value) { return { kind: SkillKinds.Poison, value: value }; }
  908. function CTW(value) { return { kind: SkillKinds.CTW, value: value }; }
  909. function followAttack(value) { return { kind: SkillKinds.FollowAttack, value: value }; }
  910. function followAttackFixed(value) { return { kind: SkillKinds.FollowAttackFixed, value: v.constant(value) }; }
  911. function autoHeal(value) { return { kind: SkillKinds.AutoHeal, value: value }; }
  912. function timeExtend(value) { return { kind: SkillKinds.TimeExtend, value: value }; }
  913. function delay() { return { kind: SkillKinds.Delay }; }
  914. function massAttack() { return { kind: SkillKinds.MassAttack }; }
  915. function dropRefresh() { return { kind: SkillKinds.DropRefresh }; }
  916. function drum() { return { kind: SkillKinds.Drum }; }
  917. function autoPath() { return { kind: SkillKinds.AutoPath }; }
  918. function leaderChange(type = 0) { return { kind: SkillKinds.LeaderChange, type: type }; }
  919. function board7x6() { return { kind: SkillKinds.Board7x6 }; }
  920. function noSkyfall() { return { kind: SkillKinds.NoSkyfall }; }
  921. function henshin(id, random = false) {
  922. return {
  923. kind: SkillKinds.Henshin,
  924. id: Array.isArray(id) ? id[0] : id, //兼容旧程序
  925. ids: Array.isArray(id) ? id : [id],
  926. random: random
  927. };
  928. }
  929. function voidPoison() { return { kind: SkillKinds.VoidPoison }; }
  930. function skillProviso(cond) { return { kind: SkillKinds.SkillProviso, cond: cond }; }
  931. function impartAwakenings(attrs, types, awakenings) {
  932. return { kind: SkillKinds.ImpartAwakenings, attrs: attrs, types: types, awakenings: awakenings };
  933. }
  934. function obstructOpponent(type, pos, ids) {
  935. return { kind: SkillKinds.ObstructOpponent, type: type, pos: pos, enemy_skills: ids };
  936. }
  937. const parsers = {
  938. parser: (() => []), //这个用来解决代码提示的报错问题,不起实际作用
  939. [0](attr, mul) { return damageEnemy('all', attr, v.xATK(mul)); },
  940. [1](attr, value) { return damageEnemy('all', attr, v.constant(value)); },
  941. [2](mul, _) { return damageEnemy('single', 'self', v.xATK(mul)); },
  942. [3](turns, percent) { return activeTurns(turns, reduceDamage('all', v.percent(percent))); },
  943. [4](mul) { return poison(v.xATK(mul)); },
  944. [5](time) { return CTW(v.constant(time)); },
  945. [6](percent) { return gravity(v.xCHP(percent)); },
  946. [7](mul) { return heal(v.xRCV(mul)); },
  947. [8](value) { return heal(v.constant(value)); },
  948. [9](from, to) { return changeOrbs(fromTo([from ?? 0], [to ?? 0])); },
  949. [10]() { return dropRefresh(); },
  950. [11](attr, mul) { return powerUp([attr], null, p.mul({ atk: mul })); },
  951. [12](mul) { return followAttack(v.xATK(mul)); },
  952. [13](mul) { return autoHeal(v.xRCV(mul)); },
  953. [14](min, max) { return resolve(v.percent(min), v.percent(max ?? 100)); },
  954. [15](time) { return timeExtend(v.constant(time / 100)); },
  955. [16](percent) { return reduceDamage('all', v.percent(percent)); },
  956. [17](attr, percent) { return reduceDamage([attr], v.percent(percent)); },
  957. [18](turns) { return activeTurns(turns, delay()); },
  958. [19](turns, percent) { return activeTurns(turns, defBreak(v.percent(percent))); },
  959. [20](from1, to1, from2, to2) {
  960. if ((to1 ?? 0) == (to2 ?? 0))
  961. return changeOrbs(fromTo([from1 ?? 0, from2 ?? 0], [to1 ?? 0]));
  962. else
  963. return changeOrbs(
  964. fromTo([from1 ?? 0], [to1 ?? 0]),
  965. fromTo([from2 ?? 0], [to2 ?? 0])
  966. );
  967. },
  968. [21](turns, attr, percent) { return activeTurns(turns, reduceDamage([attr], v.percent(percent))); },
  969. [22](type, mul) { return powerUp(null, [type], p.mul({ atk: mul })); },
  970. [23](type, mul) { return powerUp(null, [type], p.mul({ hp: mul })); },
  971. [24](type, mul) { return powerUp(null, [type], p.mul({ rcv: mul })); },
  972. [26](mul) { return powerUp(null, null, p.mul({ atk: mul })); },
  973. [28](attr, mul) { return powerUp([attr], null, p.mul({ atk: mul, rcv: mul })); },
  974. [29](attr, mul) { return powerUp([attr], null, p.mul({ hp: mul, atk: mul, rcv: mul })); },
  975. [30](type1, type2, mul) { return powerUp(null, [type1, type2], p.mul({ hp: mul })); },
  976. [31](type1, type2, mul) { return powerUp(null, [type1, type2], p.mul({ atk: mul })); },
  977. [33]() { return drum(); },
  978. [35](mul, percent) { return vampire('self', v.xATK(mul), v.percent(percent)); },
  979. [36](attr1, attr2, percent) { return reduceDamage([attr1, attr2], v.percent(percent)); },
  980. [37](attr, mul) { return damageEnemy('single', attr, v.xATK(mul)); },
  981. [38](max, prob, percent) { return reduceDamage('all', v.percent(percent), max === 100 ? c.hp(max, max) : c.hp(0, max), v.percent(prob)); },
  982. [39](percent, stats1, stats2, mul) { return powerUp(null, null, p.mul(p.stats(mul, stats1, stats2)), c.hp(0, percent)); },
  983. [40](attr1, attr2, mul) { return powerUp([attr1, attr2], null, p.mul({ atk: mul })); },
  984. [41](prob, mul, attr) { return counterAttack(attr ?? 0, v.percent(prob), v.percent(mul)); },
  985. [42](targetAttr, dmgAttr, value) { return damageEnemy(targetAttr, dmgAttr, v.constant(value)); },
  986. [43](min, prob, percent) { return reduceDamage('all', v.percent(percent), c.hp(min, 100), v.percent(prob)); },
  987. [44](percent, stats1, stats2, mul) { return powerUp(null, null, p.mul(p.stats(mul, stats1, stats2)), c.hp(percent, 100)); },
  988. [45](attr, mul) { return powerUp([attr], null, p.mul({ hp: mul, atk: mul })); },
  989. [46](attr1, attr2, mul) { return powerUp([attr1, attr2], null, p.mul({ hp: mul })); },
  990. [48](attr, mul) { return powerUp([attr], null, p.mul({ hp: mul })); },
  991. [49](attr, mul) { return powerUp([attr], null, p.mul({ rcv: mul })); },
  992. [50](turns, attr, mul) { return activeTurns(turns, powerUp([attr], null, p.mul({ atk: mul ?? 0 }))); },
  993. [51](turns) { return activeTurns(turns, massAttack()); },
  994. [52](attr, mul) { return setOrbState([attr], 'enhanced', {enhance: v.percent(mul)}); },
  995. [53](mul) { return rateMultiply(v.percent(mul), 'drop'); },
  996. [54](mul) { return rateMultiply(v.percent(mul), 'coin'); },
  997. [55](value) { return damageEnemy('single', 'fixed', v.constant(value)); },
  998. [56](value) { return damageEnemy('all', 'fixed', v.constant(value)); },
  999. [58](attr, min, max) { return damageEnemy('all', attr, v.randomATK(min, max)); },
  1000. [59](attr, min, max) { return damageEnemy('single', attr, v.randomATK(min, max)); },
  1001. [60](turns, mul, attr) { return activeTurns(turns, counterAttack(attr, v.percent(100), v.percent(mul))); },
  1002. [61](attrs, min, base, bonus, max) { return powerUp(null, null, p.scaleAttrs(flags(attrs), min, max ?? min, [base, 100], [bonus, 0])); },
  1003. [62](type, mul) { return powerUp(null, [type], p.mul({ hp: mul, atk: mul })); },
  1004. [63](type, mul) { return powerUp(null, [type], p.mul({ hp: mul, rcv: mul })); },
  1005. [64](type, mul) { return powerUp(null, [type], p.mul({ atk: mul, rcv: mul })); },
  1006. [65](type, mul) { return powerUp(null, [type], p.mul({ hp: mul, atk: mul, rcv: mul })); },
  1007. [66](combo, mul) { return powerUp(null, null, p.scaleCombos(combo, combo, [mul, 100], [0, 0])); },
  1008. [67](attr, mul) { return powerUp([attr], null, p.mul({ hp: mul, rcv: mul })); },
  1009. [69](attr, type, mul) { return powerUp([attr], [type], p.mul({ atk: mul })); },
  1010. [71](...attrs) { return boardChange(attrs.filter(attr => attr >= 0)); },
  1011. //据说是破除敌人的守护盾,但是因为重来没有实装过,所以不知道实际效果
  1012. [72](turns) { return activeTurns(turns, voidEnemyBuff(['guard'])); },
  1013. [73](attr, type, mul) { return powerUp([attr], [type], p.mul({ hp: mul, atk: mul })); },
  1014. [75](attr, type, mul) { return powerUp([attr], [type], p.mul({ atk: mul, rcv: mul })); },
  1015. [76](attr, type, mul) { return powerUp([attr], [type], p.mul({ hp: mul, atk: mul, rcv: mul })); },
  1016. [77](type1, type2, mul) { return powerUp(null, [type1, type2], p.mul({ hp: mul, atk: mul })); },
  1017. [79](type1, type2, mul) { return powerUp(null, [type1, type2], p.mul({ atk: mul, rcv: mul })); },
  1018. [84](attr, min, max, percent) {
  1019. return [
  1020. selfHarm(percent ? v.xCHP(100 - percent) : v.constantTo(1)),
  1021. damageEnemy('single', attr, v.randomATK(min, max))
  1022. ];
  1023. },
  1024. [85](attr, min, max, percent) {
  1025. return [
  1026. selfHarm(percent ? v.xCHP(100 - percent) : v.constantTo(1)),
  1027. damageEnemy('all', attr, v.randomATK(min, max))
  1028. ];
  1029. },
  1030. [86](attr, value, _, percent) {
  1031. return [
  1032. selfHarm(percent ? v.xCHP(100 - percent) : v.constantTo(1)),
  1033. damageEnemy('single', attr, v.constant(value))
  1034. ];
  1035. },
  1036. [87](attr, value, _, percent) {
  1037. return [
  1038. selfHarm(percent ? v.xCHP(100 - percent) : v.constantTo(1)),
  1039. damageEnemy('all', attr, v.constant(value))
  1040. ];
  1041. },
  1042. [88](turns, type, mul) { return activeTurns(turns, powerUp(null, [type], p.mul({ atk: mul }))); },
  1043. [90](turns, attr1, attr2, mul) { return activeTurns(turns, powerUp([attr1, attr2], null, p.mul({ atk: mul }))); },
  1044. [91](attr1, attr2, mul) { return setOrbState([attr1, attr2], 'enhanced', {enhance: v.percent(mul)}); },
  1045. [92](turns, type1, type2, mul) { return activeTurns(turns, powerUp(null, [type1, type2], p.mul({ atk: mul }))); },
  1046. [93]() { return leaderChange(); },
  1047. [94](percent, attr, stats1, stats2, mul) { return powerUp([attr], null, p.mul(p.stats(mul, stats1, stats2)), c.hp(0, percent)); },
  1048. [95](percent, type, stats1, stats2, mul) { return powerUp(null, [type], p.mul(p.stats(mul, stats1, stats2)), c.hp(0, percent)); },
  1049. [96](percent, attr, stats1, stats2, mul) { return powerUp([attr], null, p.mul(p.stats(mul, stats1, stats2)), c.hp(percent, 100)); },
  1050. [97](percent, type, stats1, stats2, mul) { return powerUp(null, [type], p.mul(p.stats(mul, stats1, stats2)), c.hp(percent, 100)); },
  1051. [98](min, base, bonus, max) { return powerUp(null, null, p.scaleCombos(min, max, [base, 100], [bonus, 0])); },
  1052. [100](stats1, stats2, mul) { return powerUp(null, null, p.mul(p.stats(mul, stats1, stats2)), c.useSkill()); },
  1053. [101](combo, mul) { return powerUp(null, null, p.mul({ atk: mul }), c.exact('combo', combo)); },
  1054. [103](combo, stats1, stats2, mul) { return powerUp(null, null, p.scaleCombos(combo, combo, p.stats(mul, stats1, stats2), [0, 0])); },
  1055. [104](combo, attrs, stats1, stats2, mul) { return powerUp(flags(attrs), null, p.scaleCombos(combo, combo, p.stats(mul, stats1, stats2), [0, 0])); },
  1056. [105](rcv, atk) { return powerUp(null, null, p.mul({ rcv, atk })); },
  1057. [106](hp, atk) { return powerUp(null, null, p.mul({ hp, atk })); },
  1058. [107](hp, attrs, atk) {
  1059. return [
  1060. powerUp(null, null, p.mul({ hp })),
  1061. attrs && powerUp(flags(attrs), null, p.mul({ atk: atk ?? 100 })) || null,
  1062. ].filter(Boolean);
  1063. },
  1064. [108](hp, type, atk) { return [powerUp(null, null, p.mul({ hp })), powerUp(null, [type], p.mul({ atk }))]; },
  1065. [109](attrs, len, mul) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [mul, 100], [0, 0])); },
  1066. [110](single, attr, min, max, scale) { return damageEnemy(single ? 'single' : 'all', attr, v.hpScale(min, max, scale)); },
  1067. [111](attr1, attr2, mul) { return powerUp([attr1, attr2], null, p.mul({ hp: mul, atk: mul })); },
  1068. [114](attr1, attr2, mul) { return powerUp([attr1, attr2], null, p.mul({ hp: mul, atk: mul, rcv: mul })); },
  1069. [115](attr, mul, percent) { return vampire(attr, v.xATK(mul), v.percent(percent)); },
  1070. [116](...ids) { return ids.flatMap(id => this.parser(id)); },
  1071. [117](bind, rcv, constant, hp, awokenBind) {
  1072. return [
  1073. rcv ? heal(v.xRCV(rcv)) : hp ? heal(v.xMaxHP(hp)) : constant ? heal(v.constant(constant)) : null,
  1074. (bind || awokenBind) ? unbind(bind ?? 0, awokenBind ?? 0) : null,
  1075. ].filter(Boolean);
  1076. },
  1077. [118](...ids) { return randomSkills(ids.map(id => this.parser(id))); },
  1078. [119](attrs, min, base, bonus, max) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), min, max, [base || 100, 100], [bonus, 0])); },
  1079. [121](attrs, types, hp, atk, rcv) { return powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })); },
  1080. [122](percent, attrs, types, atk, rcv) { return powerUp(flags(attrs), flags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(0, percent)); },
  1081. [123](percent, attrs, types, atk, rcv) { return powerUp(flags(attrs), flags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(percent, 100)); },
  1082. [124](attrs1, attrs2, attrs3, attrs4, attrs5, min, mul, bonus) {
  1083. const attrs = [attrs1, attrs2, attrs3, attrs4, attrs5].filter(Boolean);
  1084. return powerUp(null, null, p.scaleMatchAttrs(attrs.flatMap(flags), min, bonus ? attrs.length : min, [mul, 100], [bonus, 0]));
  1085. },
  1086. [125](mon1, mon2, mon3, mon4, mon5, hp, atk, rcv) { return powerUp(null, null, p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.compo('card', [mon1, mon2, mon3, mon4, mon5].filter(Boolean))); },
  1087. [126](attrs, turns, turns2, percent) { return activeTurns(turns === turns2 ? turns : [turns, turns2], orbDropIncrease(v.percent(percent), flags(attrs))); },
  1088. [127](cols1, attrs1, cols2, attrs2) {
  1089. return fixedOrbs(
  1090. { orbs: flags(attrs1), type: 'col', positions: flags(cols1) },
  1091. { orbs: flags(attrs2), type: 'col', positions: flags(cols2) }
  1092. );
  1093. },
  1094. [128](rows1, attrs1, rows2, attrs2) {
  1095. return fixedOrbs(
  1096. { orbs: flags(attrs1), type: 'row', positions: flags(rows1) },
  1097. { orbs: flags(attrs2), type: 'row', positions: flags(rows2) }
  1098. );
  1099. },
  1100. [129](attrs, types, hp, atk, rcv, rAttrs, rPercent) {
  1101. return [
  1102. (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null,
  1103. rPercent && reduceDamage(flags(rAttrs), v.percent(rPercent)) || null
  1104. ].filter(Boolean);
  1105. },
  1106. [130](percent, attrs, types, atk, rcv, rAttrs, rPercent) {
  1107. return [
  1108. (atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(0, percent)) || null,
  1109. rPercent && reduceDamage(flags(rAttrs), v.percent(rPercent), c.hp(0, percent)) || null
  1110. ].filter(Boolean);
  1111. },
  1112. [131](percent, attrs, types, atk, rcv, rAttrs, rPercent) {
  1113. return [
  1114. (atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(percent, 100)) || null,
  1115. rPercent && reduceDamage(flags(rAttrs), v.percent(rPercent), c.hp(percent, 100)) || null
  1116. ].filter(Boolean);
  1117. },
  1118. [132](turns, time, percent) { return activeTurns(turns, timeExtend(time ? v.constant(time / 10) : v.percent(percent))); },
  1119. [133](attrs, types, atk, rcv) { return powerUp(flags(attrs), flags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.useSkill()); },
  1120. [136](attrs1, hp1, atk1, rcv1, attrs2, hp2, atk2, rcv2) {
  1121. return [
  1122. powerUp(flags(attrs1), null, p.mul({ hp: hp1 || 100, atk: atk1 || 100, rcv: rcv1 || 100 })),
  1123. powerUp(flags(attrs2), null, p.mul({ hp: hp2 || 100, atk: atk2 || 100, rcv: rcv2 || 100 })),
  1124. ];
  1125. },
  1126. [137](types1, hp1, atk1, rcv1, types2, hp2, atk2, rcv2) {
  1127. return [
  1128. powerUp(null, flags(types1), p.mul({ hp: hp1 || 100, atk: atk1 || 100, rcv: rcv1 || 100 })),
  1129. powerUp(null, flags(types2), p.mul({ hp: hp2 || 100, atk: atk2 || 100, rcv: rcv2 || 100 })),
  1130. ];
  1131. },
  1132. [138](...ids) { return ids.flatMap(id => this.parser(id)); },
  1133. [139](attrs, types, percent1, less1, mul1, percent2, less2, mul2) {
  1134. return [
  1135. powerUp(flags(attrs), flags(types), p.mul({ atk: mul1 || 100 }), less1 ? c.hp(0, percent1) : c.hp(percent1, 100)),
  1136. powerUp(flags(attrs), flags(types), p.mul({ atk: mul2 || 100 }), less1 ?
  1137. (less2 ? c.hp(percent1, percent2) : c.hp(percent2, 100)) :
  1138. (less2 ? c.hp(0, percent2) : c.hp(percent2, percent1 - 1))
  1139. ),
  1140. ];
  1141. },
  1142. [140](attrs, mul) { return setOrbState(flags(attrs), 'enhanced', {enhance: v.percent(mul)}); },
  1143. [141](count, to, exclude) { return generateOrbs(flags(to), flags(exclude), count); },
  1144. [142](turns, attr) { return activeTurns(turns, changeAttr('self', attr)); },
  1145. [143](mul, dmgAttr) { return damageEnemy('all', dmgAttr ?? 0, v.xTeamHP(mul)); },
  1146. [144](teamAttrs, mul, single, dmgAttr) { return damageEnemy(single ? 'single' : 'all', dmgAttr ?? 0, v.xTeamATK(flags(teamAttrs), mul)); },
  1147. [145](mul) { return heal(v.xTeamRCV(mul)); },
  1148. [146](turns1, turns2) { return skillBoost(v.constant(turns1), turns2 ? v.constant(turns2) : undefined); },
  1149. [148](percent) { return rateMultiply(v.percent(percent), 'exp'); },
  1150. [149](mul) { return powerUp(null, null, p.mul({ rcv: mul }), c.exact('match-length', 4, [Attributes.Heart])); },
  1151. [150](_, mul) { return powerUp({targets: ['the-attr']}, null, p.mul({ atk: mul }), c.exact('match-length', 5, 'enhanced')); },
  1152. [151](mul1, mul2, percent) {
  1153. return powerUp(null, null, p.scaleCross([{ single: true, attr: [Attributes.Heart], atk: mul1 || 100, rcv: mul2 || 100 }]), null, v.percent(percent));
  1154. },
  1155. [152](attrs, count) { return setOrbState(flags(attrs), 'locked', {count: v.constant(count)}); },
  1156. [153](attr, _) { return changeAttr('opponent', attr); },
  1157. [154](from, to) { return changeOrbs(fromTo(flags(from), flags(to))); },
  1158. [155](attrs, types, hp, atk, rcv) { return powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.multiplayer()); },
  1159. [156](turns, awoken1, awoken2, awoken3, type, mul) {
  1160. if (type == 1)
  1161. {
  1162. return heal(v.percentAwakenings([awoken1, awoken2, awoken3].filter(Boolean), v.xRCV(mul)));
  1163. }else
  1164. {
  1165. return activeTurns(turns, type === 2 ?
  1166. powerUp(null, null, p.scaleStateKindCount([awoken1, awoken2, awoken3].filter(Boolean), null, null, p.mul({atk: mul - 100, hp:0, rcv:0}))) :
  1167. reduceDamage('all', v.percentAwakenings([awoken1, awoken2, awoken3].filter(Boolean), v.percent(mul)))
  1168. );
  1169. }
  1170. },
  1171. [157](attr1, mul1, attr2, mul2, attr3, mul3) {
  1172. let crosses = [
  1173. { single: false, attr: [attr1], atk: mul1 },
  1174. { single: false, attr: [attr2], atk: mul2 },
  1175. { single: false, attr: [attr3], atk: mul3 }
  1176. ].filter(cross => cross.atk);
  1177. return powerUp(null, null, p.scaleCross(crosses));
  1178. },
  1179. [158](len, attrs, types, atk, hp, rcv) {
  1180. return [
  1181. minMatch(len),
  1182. powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }))
  1183. ];
  1184. },
  1185. [159](attrs, min, base, bonus, max) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), min, max, [base, 100], [bonus, 0])); },
  1186. [160](turns, combo) { return activeTurns(turns, addCombo(combo)); },
  1187. [161](percent) { return gravity(v.xMaxHP(percent)); },
  1188. [162]() { return board7x6(); },
  1189. [163](attrs, types, hp, atk, rcv, rAttrs, rPercent) {
  1190. return [
  1191. noSkyfall(),
  1192. (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null,
  1193. rPercent && reduceDamage(flags(rAttrs), v.percent(rPercent)) || null,
  1194. ].filter(Boolean);
  1195. },
  1196. [164](attrs1, attrs2, attrs3, attrs4, min, atk, rcv, bonus) {
  1197. const attrs = [attrs1, attrs2, attrs3, attrs4].filter(Boolean);
  1198. return powerUp(null, null, p.scaleMatchAttrs(attrs.flatMap(flags), min, attrs.length, [atk, rcv], [bonus, bonus]));
  1199. },
  1200. [165](attrs, min, baseAtk, baseRcv, bonusAtk, bonusRcv, incr) {
  1201. const attrsArr = flags(attrs);
  1202. return powerUp(null, null, p.scaleAttrs(attrsArr, min, min + (min < attrsArr.length ? (incr ?? 0) : 0), [baseAtk || 100, baseRcv || 100], [bonusAtk, bonusRcv]));
  1203. },
  1204. [166](min, baseAtk, baseRcv, bonusAtk, bonusRcv, max) { return powerUp(null, null, p.scaleCombos(min, max, [baseAtk, baseRcv], [bonusAtk, bonusRcv])); },
  1205. [167](attrs, min, baseAtk, baseRcv, bonusAtk, bonusRcv, max) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), min, max, [baseAtk, baseRcv], [bonusAtk, bonusRcv])); },
  1206. [168](turns, awoken1, awoken2, awoken3, awoken4, awoken5, awoken6, mul) {
  1207. return activeTurns(turns,
  1208. powerUp(null, null, p.scaleStateKindCount([awoken1, awoken2, awoken3, awoken4, awoken5, awoken6].filter(Boolean), null, null, p.mul({atk: mul, hp:0, rcv:0})))
  1209. );
  1210. },
  1211. [169](min, base, percent, bonus, max) { return powerUp(null, null, p.scaleCombos(min, max ?? min, [base || 100, 100], [bonus, 0]), null, v.percent(percent)); },
  1212. //stage的真实用法目前不知道,缺少样本来判断,不知道到底是直接算数(stage-1)还是算二进制个数(flags(stage).length)。 2022年5月23日
  1213. //按 瘦鹅 的说法,也可能是因为暗牛头限制了5色, 所以就算是3级到了6色,也只算5色。
  1214. [170](attrs, min, base, percent, bonus, stage) {
  1215. let attrsArr = flags(attrs);
  1216. return powerUp(null, null, p.scaleAttrs(attrsArr, min, Math.min(min + (stage || 0), attrsArr.length), [base, 100], [bonus ?? 0, 0]), null, v.percent(percent));
  1217. },
  1218. [171](attrs1, attrs2, attrs3, attrs4, min, mul, percent, bonus) {
  1219. const attrs = [attrs1, attrs2, attrs3, attrs4].filter(Boolean);
  1220. return powerUp(null, null, p.scaleMatchAttrs(attrs.flatMap(flags), min, bonus ? attrs.length : min, [mul, 100], [bonus ?? 0, 0]), null, v.percent(percent));
  1221. },
  1222. [172]() { return setOrbState(Attributes.orbs(), 'unlocked'); },
  1223. [173](turns, attrAbsorb, comboAbsorb, damageAbsorb) {
  1224. return activeTurns(turns, voidEnemyBuff(
  1225. [
  1226. attrAbsorb && 'attr-absorb',
  1227. comboAbsorb && 'combo-absorb',
  1228. damageAbsorb && 'damage-absorb'
  1229. ].filter((buff) => typeof buff === 'string')
  1230. ));
  1231. },
  1232. [175](series1, series2, series3, hp, atk, rcv) { return powerUp(null, null, p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.compo('series', [series1, series2, series3].filter(Boolean))); },
  1233. [176](row1, row2, row3, row4, row5, attrs) {
  1234. return fixedOrbs(
  1235. { orbs: [attrs ?? 0], type: 'shape', positions: [row1, row2, row3, row4, row5].map(row=>flags(row)) }
  1236. );
  1237. },
  1238. [177](attrs, types, hp, atk, rcv, remains, baseAtk, bonusAtk) {
  1239. return [
  1240. noSkyfall(),
  1241. (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null,
  1242. baseAtk && powerUp(null, null, p.scaleRemainOrbs(remains, [baseAtk ?? 100, 100], [bonusAtk ?? 0, 0])) || null
  1243. ].filter(Boolean);
  1244. },
  1245. [178](time, attrs, types, hp, atk, rcv, attrs2, percent) {
  1246. return [
  1247. fixedTime(time),
  1248. (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })),
  1249. percent && reduceDamage(flags(attrs2), v.percent(percent)) || null,
  1250. ].filter(Boolean);
  1251. /*const reduceAttrs = flags(attrs2);
  1252. const isAllAttr = isEqual(reduceAttrs, Attributes.attr);
  1253. return [
  1254. fixedTime(time),
  1255. (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), null, isAllAttr ? v.percent(percent) : null),
  1256. percent && !isAllAttr && reduceDamage(reduceAttrs, v.percent(percent)) || null,
  1257. ].filter(Boolean);*/
  1258. },
  1259. [179](turns, value, percent, bind, awokenBind) {
  1260. return [
  1261. (bind || awokenBind) ? unbind(bind ?? 0, awokenBind ?? 0) : null,
  1262. activeTurns(turns, autoHealBuff(value ? v.constant(value) : v.xMaxHP(percent)))
  1263. ].filter(Boolean);
  1264. },
  1265. [180](turns, percent) { return activeTurns(turns, orbDropIncrease(v.percent(percent), [], 'enhanced')); },
  1266. [182](attrs, len, mul, percent) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [mul || 100, 100], [0, 0]), null, v.percent(percent)); },
  1267. [183](attrs, types, percent1, atk1, reduce, percent2, atk2, rcv2) {
  1268. return [
  1269. (percent1 > 0) && powerUp(flags(attrs), flags(types), p.mul({ atk: atk1 || 100 }), c.hp(percent1, 100), v.percent(reduce)) || null,
  1270. (atk2 || rcv2) && powerUp(flags(attrs), flags(types), p.mul({ atk: atk2 || 100, rcv: rcv2 || 100 }), c.hp(0, percent2 || percent1)) || null
  1271. ].filter(Boolean);
  1272. },
  1273. [184](turns) { return activeTurns(turns, noSkyfall()); },
  1274. [185](time, attrs, types, hp, atk, rcv) {
  1275. return [
  1276. timeExtend(v.constant(time / 100)),
  1277. powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })),
  1278. ];
  1279. },
  1280. [186](attrs, types, hp, atk, rcv) {
  1281. return [
  1282. board7x6(),
  1283. (hp || atk ||rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null,
  1284. ].filter(Boolean);
  1285. },
  1286. [188](value) {
  1287. return damageEnemy('single', 'fixed', v.constant(value));
  1288. },
  1289. [189]() {
  1290. return [
  1291. setOrbState(Attributes.orbs(), 'unlocked'),
  1292. boardChange([0,1,2,3]),
  1293. autoPath(),
  1294. ];
  1295. },
  1296. [191](turns) {
  1297. return activeTurns(turns, voidEnemyBuff(['damage-void']));
  1298. },
  1299. [192](attrs, len, mul, combo) {
  1300. return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [mul || 100, 100], [0, 0], true), null, null, combo ? [addCombo(combo)] : null);
  1301. },
  1302. [193](attrs, atk, rcv, percent) {
  1303. return powerUp(null, null, p.mul([atk || 100, rcv || 100]), c.LShape(flags(attrs)), v.percent(percent));
  1304. },
  1305. [194](attrs, min, mul, combo) {
  1306. return powerUp(null, null, p.scaleAttrs(flags(attrs), min, min, [mul || 100, 100], [0, 0]), null, null, combo ? [addCombo(combo)] : null);
  1307. },
  1308. [195](percent) {
  1309. return selfHarm(percent ? v.xCHP(100 - percent) : v.constantTo(1));
  1310. },
  1311. [196](matches) {
  1312. return unbind(0,0,matches);
  1313. },
  1314. [197]() {
  1315. return voidPoison();
  1316. },
  1317. [198](heal, atk, percent, awokenBind) {
  1318. return powerUp(null, null, p.mul([atk || 100, 100]), c.heal(heal), percent && v.percent(percent), awokenBind && [unbind(0, awokenBind ?? 0)]);
  1319. },
  1320. [199](attrs, min, damage) {
  1321. return powerUp(null, null, p.scaleAttrs(flags(attrs), min, min, [100, 100], [0, 0]), null, null, [followAttackFixed(damage)]);
  1322. },
  1323. [200](attrs, len, damage) {
  1324. return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [100, 100], [0, 0]), null, null, [followAttackFixed(damage)]);
  1325. },
  1326. [201](attrs1, attrs2, attrs3, attrs4, min, damage) {
  1327. const attrs = [attrs1, attrs2, attrs3, attrs4].filter(Boolean);
  1328. return powerUp(null, null, p.scaleMatchAttrs(attrs.flatMap(flags), min, min, [100, 100], [0, 0]), null, null, [followAttackFixed(damage)]);
  1329. },
  1330. [202](id) {
  1331. return henshin(id);
  1332. },
  1333. [203](evotypeid, hp, atk, rcv) {
  1334. let evotype = (type=>{
  1335. switch (type) {
  1336. case 0: return "pixel-evo";
  1337. case 2: return "reincarnation-evo";
  1338. default: return type;
  1339. }
  1340. })(evotypeid);
  1341. return powerUp(null, null, p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }),
  1342. c.compo('evolution', [evotype]));
  1343. },
  1344. [205](attrs, turns) { return activeTurns(turns, orbDropIncrease(null, flags(attrs == -1 ? 0b1111111111: attrs), 'locked')); },
  1345. [206](attrs1, attrs2, attrs3, attrs4, attrs5, min, combo) {
  1346. const attrs = [attrs1, attrs2, attrs3, attrs4, attrs5].filter(Boolean);
  1347. return powerUp(null, null, p.scaleMatchAttrs(attrs.flatMap(flags), min, min, [100, 100], [0, 0]), null, null, combo ? [addCombo(combo)] : null);
  1348. },
  1349. [207](turns, time, row1, row2, row3, row4, row5, count) {
  1350. return activeTurns(turns, count ?
  1351. generateOrbs( ['variation'], null, count, time/100):
  1352. fixedOrbs( { orbs: ['variation'], time: time/100, type: 'shape', positions: [row1, row2, row3, row4, row5].map(row=>flags(row)) })
  1353. );
  1354. },
  1355. [208](count1, to1, exclude1, count2, to2, exclude2) {
  1356. return [
  1357. generateOrbs(flags(to1), flags(exclude1), count1),
  1358. generateOrbs(flags(to2), flags(exclude2), count2),
  1359. ];
  1360. },
  1361. [209](combo) {
  1362. return powerUp(null, null, p.scaleCross([{ single: true, attr: [Attributes.Heart], atk: 100, rcv: 100}]), null, null, combo ? [addCombo(combo)] : null);
  1363. },
  1364. [210](attrs, reduce, combo) {
  1365. return powerUp(null, null, p.scaleCross([{ single: false, attr: flags(attrs), atk: 100, rcv: 100}]), null, v.percent(reduce), combo ? [addCombo(combo)] : null);
  1366. },
  1367. [213](attrs, types, ...awakenings) { //赋予觉醒的队长技
  1368. return impartAwakenings(flags(attrs), flags(types), awakenings);
  1369. },
  1370. [214](turns) { return activeTurns(turns, bindSkill()); },
  1371. [215](turns, attrs) { return activeTurns(turns, setOrbState(flags(attrs), 'bound')); },
  1372. [217](rarity, hp, atk, rcv) {
  1373. return powerUp(null, null, p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }),
  1374. c.compo('rarity', rarity));
  1375. },
  1376. [218](turns) { return skillBoost(v.constant(-turns)); },
  1377. [219](attrs, len, combo) {
  1378. return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [100, 100], [0, 0]), null, null, combo ? [addCombo(combo)] : null);
  1379. },
  1380. [220](attrs, combo) {
  1381. return powerUp(null, null, p.mul([100,100]), c.LShape(flags(attrs)), null, combo ? [addCombo(combo)] : null);
  1382. },
  1383. [221](attrs, damage) {
  1384. return powerUp(null, null, p.mul([100,100]), c.LShape(flags(attrs)), null, damage ? [followAttackFixed(damage)] : null);
  1385. },
  1386. [223](combo, damage) {
  1387. return powerUp(null, null, p.scaleCombos(combo, combo, [100, 100], [0, 0]), null, null, damage ? [followAttackFixed(damage)] : null);
  1388. },
  1389. [224](turns, attr) { return activeTurns(turns, changeAttr('opponent', attr)); },
  1390. [225](min, max) { return skillProviso(c.hp(min ?? 0, max ?? 100)); },
  1391. [226](turns, percent) { return activeTurns(turns, orbDropIncrease(v.percent(percent), [], 'nail')); },
  1392. [227]() { return leaderChange(1); },
  1393. [228](turns, attrs, types, atk, rcv) {
  1394. return activeTurns(turns,
  1395. powerUp(null, null, p.scaleStateKindCount(null, flags(attrs), flags(types), p.mul({atk: atk, rcv: rcv ?? 0, hp:0})))
  1396. );
  1397. },
  1398. [229](attrs, types, hp, atk, rcv) {
  1399. return powerUp(null, null, p.scaleStateKindCount(null, flags(attrs), flags(types), p.mul({hp: hp || 0, atk: atk || 0, rcv: rcv || 0})));
  1400. },
  1401. [230](turns, target, mul) {
  1402. const targetTypes = ["self","leader-self","leader-helper","sub-members"];
  1403. const typeArr = flags(target).map(n => targetTypes[n]);
  1404. return activeTurns(turns, powerUp({targets: typeArr}, null, p.mul({ atk: mul })));
  1405. },
  1406. [231](turns, awoken1, awoken2, awoken3, awoken4, awoken5, atk, rcv) {
  1407. return activeTurns(turns, powerUp(null, null, p.scaleStateKindCount([awoken1, awoken2, awoken3, awoken4, awoken5].filter(Boolean), null, null, p.mul({atk: atk, hp:0, rcv: rcv}))));
  1408. },
  1409. [232](...ids) { return evolvedSkills(false, ids.map(id => this.parser(id))); },
  1410. [233](...ids) { return evolvedSkills(true, ids.map(id => this.parser(id))); },
  1411. [234](min, max) { return skillProviso(c.stage(min ?? 0, max ?? 0)); },
  1412. [235](attr, _, len, atk, percent, combo, damage) {
  1413. return powerUp(null, null, p.mul({ atk: atk || 100}), c.exact('match-length', len, flags(attr), true), v.percent(percent), [combo ? addCombo(combo) : null, damage ? followAttackFixed(damage) : null].filter(Boolean));
  1414. },
  1415. [236](...ids) { //随机变身
  1416. return henshin(ids.distinct(), true);
  1417. },
  1418. [1000](type, pos, ...ids) {
  1419. const posType = (type=>{
  1420. switch (type) {
  1421. case 1: return "after-me";
  1422. case 2: return "designated-position";
  1423. case 3: return "before-me";
  1424. default: return type;
  1425. }
  1426. })(type);
  1427. return obstructOpponent(posType, flags(pos), ids);
  1428. },
  1429. };
  1430. //将内容添加到代码片段
  1431. DocumentFragment.prototype.ap = function(arg)
  1432. {
  1433. if (Array.isArray(arg)) //数组,递归自身
  1434. {
  1435. arg.forEach(element=>this.ap(element));
  1436. }
  1437. else if (arg instanceof Node) //属于Node的直接添加
  1438. {
  1439. this.appendChild(arg);
  1440. }
  1441. else //其他内容的转换为文字添加
  1442. {
  1443. this.appendChild(document.createTextNode(arg));
  1444. }
  1445. return this;
  1446. }
  1447. //将数组和分隔符添加到一个代码片段,类似join
  1448. Array.prototype.nodeJoin = function(separator)
  1449. {
  1450. const frg = document.createDocumentFragment();
  1451. this.forEach((item, idx, arr)=>{
  1452. frg.ap(item);
  1453. if (idx < (arr.length - 1) && separator !== undefined)
  1454. frg.ap(separator instanceof Node ? separator.cloneNode(true) : separator);
  1455. });
  1456. return frg;
  1457. }
  1458. //按住Ctrl点击技能在控制台输出技能的对象
  1459. function showParsedSkill(event) {
  1460. if (event.ctrlKey) {
  1461. //const skillId = parseInt(this.getAttribute("data-skill-id"));
  1462. console.log(this.skill);
  1463. }
  1464. }
  1465. function renderSkillTitle(skillId) {
  1466. const skill = Skills[skillId];
  1467. const div = document.createElement("div");
  1468. div.className = "evolved-skill-title";
  1469. const name = div.appendChild(document.createElement("span"));
  1470. name.className = "skill-name";
  1471. name.textContent = skill.name;
  1472. name.setAttribute("data-skillid", skillId);
  1473. name.onclick = fastShowSkill;
  1474. const cd = div.appendChild(document.createElement("span"));
  1475. cd.className = "skill-cd";
  1476. cd.textContent = skill.initialCooldown - skill.maxLevel + 1;
  1477. if (skill.maxLevel > 1) {
  1478. const level = div.appendChild(document.createElement("span"));
  1479. level.className = "skill-level-label";
  1480. level.textContent = skill.maxLevel;
  1481. }
  1482. return div;
  1483. }
  1484. function renderSkillEntry(skills)
  1485. {
  1486. const ul = document.createElement("ul");
  1487. ul.className = "card-skill-list";
  1488. skills.forEach(skill=>{
  1489. const li = ul.appendChild(document.createElement("li"));
  1490. li.className = skill.kind;
  1491. li.appendChild(renderSkill(skill));
  1492. //li.setAttribute("data-skill-id", skill.id);
  1493. li.skill = skill;
  1494. li.addEventListener("click", showParsedSkill);
  1495. });
  1496. if (merge_skill)
  1497. {
  1498. let boardChange = skills.filter(skill=>
  1499. skill.kind == SkillKinds.BoardChange ||
  1500. skill.kind == SkillKinds.GenerateOrbs ||
  1501. skill.kind == SkillKinds.FixedOrbs ||
  1502. skill.kind == SkillKinds.ActiveTurns && (skill.skill.kind == SkillKinds.FixedOrbs || skill.skill.kind == SkillKinds.GenerateOrbs)
  1503. ).map(skill=>skill.kind == SkillKinds.ActiveTurns ? skill.skill : skill);
  1504. if (boardChange.length > 0)
  1505. {
  1506. const board = new Board();
  1507. for (let skill of boardChange)
  1508. {
  1509. switch (skill.kind)
  1510. {
  1511. case SkillKinds.BoardChange: { //洗版
  1512. const attrs = skill.attrs;
  1513. board.randomFill(attrs);
  1514. break;
  1515. }
  1516. case SkillKinds.GenerateOrbs: { //产生珠子
  1517. let orbs = skill.orbs, exclude = skill.exclude, count = skill.count;
  1518. board.generateOrbs(orbs, count, exclude);
  1519. break;
  1520. }
  1521. case SkillKinds.FixedOrbs: { //固定位置产生珠子
  1522. let generates = skill.generates;
  1523. for (const generate of generates)
  1524. {
  1525. let orb = generate.orbs?.[0];
  1526. if (generate.type == 'shape') {
  1527. board.setShape(generate.positions, orb);
  1528. } else {
  1529. if (generate.type == 'row')
  1530. board.setRow(generate.positions, orb);
  1531. else
  1532. board.setColumn(generate.positions, orb);
  1533. }
  1534. }
  1535. break;
  1536. }
  1537. }
  1538. }
  1539. const setOrbState = skills.filter(skill=>skill.kind == SkillKinds.SetOrbState ||
  1540. skill.kind == SkillKinds.ActiveTurns && (skill.skill.kind == SkillKinds.SetOrbState)
  1541. ).map(skill=>skill.kind == SkillKinds.ActiveTurns ? skill.skill : skill);
  1542. const boardData = board.data.flat();
  1543. for (let skill of setOrbState) {
  1544. if (["enhanced", "locked", "bound"].includes(skill.state)) {
  1545. //技能内的数量,可能会大于版面内有的数据数量
  1546. const orbCount = Math.min(skill.arg?.count?.value ?? boardData.length, boardData.length);
  1547. for (let oi = 0; oi < orbCount; oi++) {
  1548. const orb = boardData[oi];
  1549. if (orb && skill.orbs.includes(orb.color)) {
  1550. orb.states.push(skill.state);
  1551. }
  1552. }
  1553. }
  1554. }
  1555. const li = ul.appendChild(document.createElement("li"));
  1556. li.appendChild(board.toTable());
  1557. li.className = "merge-board";
  1558. }
  1559. }
  1560. return ul;
  1561. }
  1562. function renderSkill(skill, option = {})
  1563. {
  1564. const frg = document.createDocumentFragment();
  1565. if (typeof localTranslating == "undefined") return frg;
  1566. const tsp = localTranslating.skill_parse;
  1567. function createIcon(iconType, className){
  1568. const idoc = document.createElement("icon");
  1569. idoc.className = `icon-skill${className ? ` ${className}` : ''}`;
  1570. idoc.setAttribute("data-icon-type", iconType);
  1571. return idoc;
  1572. }
  1573. if (Array.isArray(skill))
  1574. {
  1575. frg.ap(skill.map(_skill=>renderSkill(_skill)));
  1576. return frg;
  1577. }
  1578. switch (skill.kind) {
  1579. case SkillKinds.Unknown: {
  1580. let dict = {
  1581. type: skill.kind
  1582. };
  1583. frg.ap(tsp.skill.unknown(dict));
  1584. break;
  1585. }
  1586. case SkillKinds.ActiveTurns: { //有回合的行动
  1587. let turns = skill.turns, actionSkill = skill.skill;
  1588. let dict = {
  1589. turns: Array.isArray(turns) ? turns.join(tsp.word.range_hyphen().textContent) : turns,
  1590. actionSkill: renderSkill(actionSkill),
  1591. };
  1592. frg.ap(tsp.skill.active_turns(dict));
  1593. break;
  1594. }
  1595. case SkillKinds.RandomSkills: { //随机技能
  1596. let skills = skill.skills;
  1597. const ul = document.createElement("ul");
  1598. ul.className = "random-active-skill";
  1599. skills.forEach(subSkill=>{
  1600. const li = ul.appendChild(document.createElement("li"));
  1601. li.appendChild(renderSkillEntry(subSkill));
  1602. });
  1603. let dict = {
  1604. skills: ul,
  1605. };
  1606. frg.ap(tsp.skill.random_skills(dict));
  1607. break;
  1608. }
  1609. case SkillKinds.EvolvedSkills: { //技能进化
  1610. let skills = skill.skills, loop = skill.loop;
  1611. const ul = document.createElement("ul");
  1612. ul.className = "evolved-active-skill";
  1613. skills.forEach((subSkill, idx)=>{
  1614. const li = ul.appendChild(document.createElement("li"));
  1615. li.appendChild(renderSkillTitle(skill.params[idx]));
  1616. li.appendChild(renderSkillEntry(subSkill));
  1617. });
  1618. let dict = {
  1619. skills: ul,
  1620. };
  1621. frg.ap(tsp.skill.evolved_skills(dict));
  1622. if (loop) {
  1623. let dict2 = {
  1624. icon: createIcon("evolved-skill-loop"),
  1625. }
  1626. frg.ap(tsp.skill.evolved_skills_loop(dict2));
  1627. }
  1628. break;
  1629. }
  1630. case SkillKinds.Delay: { //威吓
  1631. let dict = {
  1632. icon: createIcon(skill.kind),
  1633. };
  1634. frg.ap(tsp.skill.delay(dict));
  1635. break;
  1636. }
  1637. case SkillKinds.MassAttack: { //全体攻击
  1638. let dict = {
  1639. icon: createIcon(skill.kind),
  1640. };
  1641. frg.ap(tsp.skill.mass_attack(dict));
  1642. break;
  1643. }
  1644. case SkillKinds.LeaderChange: { //切换队长
  1645. let type = skill.type;
  1646. let dict = {
  1647. icon: createIcon(skill.kind),
  1648. target: type ? tsp.target.team_last() : tsp.target.self(),
  1649. };
  1650. frg.ap(tsp.skill.leader_change(dict));
  1651. break;
  1652. }
  1653. case SkillKinds.NoSkyfall: { //无天降
  1654. let dict = {
  1655. icon: createIcon(skill.kind),
  1656. };
  1657. frg.ap(tsp.skill.no_skyfall(dict));
  1658. break;
  1659. }
  1660. case SkillKinds.SelfHarm: { //主动自残
  1661. let value = skill.value;
  1662. let dict = {
  1663. icon: createIcon("heal", "hp-decr"),
  1664. value: renderValue(value, {percent: true}),
  1665. stats: tsp.stats.hp(),
  1666. };
  1667. frg.ap(tsp.skill.self_harm(dict));
  1668. break;
  1669. }
  1670. case SkillKinds.Heal: { //主动回血buff
  1671. let value = skill.value;
  1672. let dict = {
  1673. icon: createIcon("heal", "hp-incr"),
  1674. //icon: createIcon("auto-heal"),
  1675. value: renderValue(value, {unit: tsp.unit.point, percent: value.kind == SkillValueKind.xRCV ? false : true}),
  1676. stats: tsp.stats.hp(),
  1677. };
  1678. frg.ap(tsp.skill.heal(dict));
  1679. break;
  1680. }
  1681. case SkillKinds.AutoHealBuff: { //自动回血buff
  1682. let dict = {
  1683. icon: createIcon("auto-heal"),
  1684. value: renderValue(skill.value, {unit: tsp.unit.point, percent: true}),
  1685. stats: tsp.stats.hp(),
  1686. };
  1687. frg.ap(tsp.skill.auto_heal_buff(dict));
  1688. break;
  1689. }
  1690. case SkillKinds.DefenseBreak: { //破防
  1691. let dict = {
  1692. icon: createIcon(skill.kind),
  1693. value: renderValue(skill.value, {percent: true}),
  1694. };
  1695. frg.ap(tsp.skill.defense_break(dict));
  1696. break;
  1697. }
  1698. case SkillKinds.Poison: { //毒
  1699. let dict = {
  1700. icon: createIcon(skill.kind),
  1701. belong_to: tsp.target.self(),
  1702. target: tsp.target.enemy_all(),
  1703. stats: tsp.stats.hp(),
  1704. value: renderValue(skill.value),
  1705. };
  1706. frg.ap(tsp.skill.poison(dict));
  1707. break;
  1708. }
  1709. case SkillKinds.TimeExtend: { //时间变化buff
  1710. let value = skill.value;
  1711. let dict = {
  1712. icon: createIcon("status-time", SkillValue.isLess(value) ? "time-decr" : "time-incr"),
  1713. value: renderValue(value, { unit:tsp.unit.seconds, plusSign: value.kind != SkillValueKind.Percent, percent: SkillValue.isLess(value) }),
  1714. };
  1715. frg.ap(tsp.skill.time_extend(dict));
  1716. break;
  1717. }
  1718. case SkillKinds.FollowAttack: { //队长技倍率追打
  1719. let dict = {
  1720. //icon: createIcon("follow_attack"),
  1721. belong_to: tsp.target.self(),
  1722. target: tsp.target.enemy(),
  1723. value: renderValue(skill.value),
  1724. };
  1725. frg.ap(tsp.skill.follow_attack(dict));
  1726. break;
  1727. }
  1728. case SkillKinds.FollowAttackFixed: { //队长技固伤追打
  1729. let damage = skill.value;
  1730. let dict = {
  1731. damage: renderValue(damage, {unit: tsp.unit.point}),
  1732. attr: renderAttrs('fixed'),
  1733. };
  1734. frg.ap(tsp.skill.follow_attack_fixed(dict));
  1735. break;
  1736. }
  1737. case SkillKinds.AutoHeal: { //队长技自动回血
  1738. let dict = {
  1739. icon: createIcon(skill.kind),
  1740. belong_to: tsp.target.self(),
  1741. value: renderValue(skill.value),
  1742. stats: tsp.stats.hp(),
  1743. };
  1744. frg.ap(tsp.skill.auto_heal(dict));
  1745. break;
  1746. }
  1747. case SkillKinds.CTW: { //时间暂停
  1748. let dict = {
  1749. icon: createIcon(skill.kind),
  1750. value: renderValue(skill.value, { unit: tsp.unit.seconds }),
  1751. };
  1752. frg.ap(tsp.skill.ctw(dict));
  1753. break;
  1754. }
  1755. case SkillKinds.Gravity: { //重力
  1756. let dict = {
  1757. icon: createIcon(skill.kind),
  1758. target: tsp.target.enemy(),
  1759. value: renderValue(skill.value, { percent:true }),
  1760. };
  1761. frg.ap(tsp.skill.gravity(dict));
  1762. break;
  1763. }
  1764. case SkillKinds.Resolve: { //根性
  1765. let prob = skill.prob;
  1766. let dict = {
  1767. icon: createIcon(skill.kind),
  1768. stats: renderStat('chp'),
  1769. min: renderValue(skill.min, { percent:true }),
  1770. max: renderValue(skill.max, { percent:true }),
  1771. };
  1772. frg.ap(tsp.skill.resolve(dict));
  1773. break;
  1774. }
  1775. case SkillKinds.DamageEnemy: { //大炮和固伤
  1776. let attr = skill.attr, target = skill.target, damage = skill.damage, times = skill.times;
  1777. if (attr == null) break; //没有属性时,编号为0的空技能
  1778. dict = {
  1779. target: target === 'all' ? tsp.target.enemy_all() : target === 'single' ? tsp.target.enemy_one() : tsp.target.enemy_attr({attr: renderAttrs(target, {affix: true})}),
  1780. damage: renderValue(damage, {unit: tsp.unit.point}),
  1781. attr: renderAttrs(attr, {affix: (attr === 'self' || attr === 'fixed') ? false : true}),
  1782. };
  1783. if (times)
  1784. {
  1785. dict.times = tsp.skill.damage_enemy_times({
  1786. times: renderValue(v.constant(times), {unit: tsp.unit.times})
  1787. });
  1788. dict.totalDamage = tsp.skill.damage_enemy_count({
  1789. damage: renderValue(v.constant(damage.value * times), {unit: tsp.unit.point})
  1790. });
  1791. }
  1792. frg.ap(tsp.skill.damage_enemy(dict));
  1793. break;
  1794. }
  1795. case SkillKinds.Unbind: { //解封
  1796. let normal = skill.normal, awakenings = skill.awakenings, matches = skill.matches;
  1797. let effects = [];
  1798. let enabledStats = [normal, awakenings, matches].filter(Boolean);
  1799. if (merge_skill && enabledStats.length >= 2 && enabledStats.every((s,i,arr)=>s==arr[0]))
  1800. {
  1801. if (normal)
  1802. {
  1803. effects.push(tsp.skill.unbind_normal({icon: createIcon("unbind-normal")}));
  1804. }
  1805. if (awakenings)
  1806. {
  1807. effects.push(tsp.skill.unbind_awakenings({icon: createIcon("unbind-awakenings")}));
  1808. }
  1809. if (matches)
  1810. {
  1811. effects.push(tsp.skill.unbind_matches({icon: createIcon("unbind-matches")}));
  1812. }
  1813. let dict = {
  1814. turns: enabledStats[0],
  1815. stats: effects.nodeJoin(tsp.word.slight_pause()),
  1816. }
  1817. frg.ap(tsp.skill.unbind(dict));
  1818. }
  1819. else
  1820. {
  1821. if (normal)
  1822. {
  1823. let dict = {
  1824. turns: normal,
  1825. stats: tsp.skill.unbind_normal({icon: createIcon("unbind-normal")}),
  1826. }
  1827. effects.push(tsp.skill.unbind(dict));
  1828. }
  1829. if (awakenings)
  1830. {
  1831. let dict = {
  1832. turns: awakenings,
  1833. stats: tsp.skill.unbind_awakenings({icon: createIcon("unbind-awakenings")}),
  1834. }
  1835. effects.push(tsp.skill.unbind(dict));
  1836. }
  1837. if (matches)
  1838. {
  1839. let dict = {
  1840. turns: matches,
  1841. stats: tsp.skill.unbind_matches({icon: createIcon("unbind-matches")}),
  1842. }
  1843. effects.push(tsp.skill.unbind(dict));
  1844. }
  1845. frg.ap(effects.nodeJoin(tsp.word.comma()));
  1846. }
  1847. break;
  1848. }
  1849. case SkillKinds.BindSkill: {
  1850. dict = {
  1851. icon: createIcon(skill.kind)
  1852. };
  1853. frg.ap(tsp.skill.bind_skill(dict));
  1854. break;
  1855. }
  1856. case SkillKinds.BoardChange: { //洗版
  1857. const attrs = skill.attrs;
  1858. dict = {
  1859. orbs: renderOrbs(attrs),
  1860. };
  1861. frg.ap(tsp.skill.board_change(dict));
  1862. if (!merge_skill)
  1863. {
  1864. let board = new Board(attrs);
  1865. frg.ap(board.toTable());
  1866. }
  1867. break;
  1868. }
  1869. case SkillKinds.SkillBoost: { //溜
  1870. const min = skill.min, max = skill.max;
  1871. let dict = {
  1872. icon: createIcon(skill.kind, SkillValue.isLess(min) ? "boost-decr" : "boost-incr"),
  1873. turns_min: renderValue(min, { unit:tsp.unit.turns, plusSign:true }),
  1874. };
  1875. if (max.value !== min.value) {
  1876. dict.turns_max = tsp.skill.skill_boost_range(
  1877. {turns: renderValue(max, { unit:tsp.unit.turns, plusSign:true })}
  1878. );
  1879. }
  1880. frg.ap(tsp.skill.skill_boost(dict));
  1881. break;
  1882. }
  1883. case SkillKinds.AddCombo: { //+C
  1884. const value = skill.value;
  1885. let icon = createIcon(skill.kind);
  1886. icon.setAttribute("data-add-combo", value);
  1887. let dict = {
  1888. icon: icon,
  1889. value: value,
  1890. };
  1891. frg.ap(tsp.skill.add_combo(dict));
  1892. break;
  1893. }
  1894. case SkillKinds.FixedTime: { //固定手指
  1895. const value = skill.value;
  1896. let dict = {
  1897. icon: createIcon(skill.kind),
  1898. value: renderValue(value, { unit: tsp.unit.seconds }),
  1899. };
  1900. frg.ap(tsp.skill.fixed_time(dict));
  1901. break;
  1902. }
  1903. case SkillKinds.MinMatchLength: { //最低匹配长度
  1904. const value = skill.value;
  1905. let dict = {
  1906. icon: createIcon(skill.kind),
  1907. unmatchable: value - 1,
  1908. matchable: value,
  1909. };
  1910. frg.ap(tsp.skill.min_match_length(dict));
  1911. break;
  1912. }
  1913. case SkillKinds.DropRefresh: { //刷版
  1914. let dict = {
  1915. icon: createIcon(skill.kind),
  1916. };
  1917. frg.ap(tsp.skill.drop_refresh(dict));
  1918. break;
  1919. }
  1920. case SkillKinds.Drum: { //太鼓达人音效
  1921. frg.ap(tsp.skill.drum());
  1922. break;
  1923. }
  1924. case SkillKinds.AutoPath: { //小龙的萌新技能
  1925. frg.ap(tsp.skill.auto_path());
  1926. break;
  1927. }
  1928. case SkillKinds.Board7x6: { //76版
  1929. let dict = {
  1930. icon: createIcon(skill.kind),
  1931. };
  1932. frg.ap(tsp.skill.board7x6(dict));
  1933. break;
  1934. }
  1935. case SkillKinds.Vampire: { //吸血
  1936. let attr = skill.attr, damage = skill.damage, heal = skill.heal;
  1937. let _dict = {
  1938. target: tsp.target.enemy_one(),
  1939. damage: renderValue(damage),
  1940. attr: renderAttrs(attr, {affix: (attr === 'self' || attr === 'fixed') ? false : true}),
  1941. };
  1942. dict = {
  1943. icon: createIcon("heal", "hp-incr"),
  1944. damage_enemy: tsp.skill.damage_enemy(_dict),
  1945. heal: renderValue(heal, {percent: true}),
  1946. };
  1947. frg.ap(tsp.skill.vampire(dict));
  1948. break;
  1949. }
  1950. case SkillKinds.CounterAttack: { //反击
  1951. let attr = skill.attr, prob = skill.prob, value = skill.value;
  1952. dict = {
  1953. icon: createIcon(skill.kind),
  1954. target: tsp.target.enemy(),
  1955. chance: prob.value < 1 ? tsp.value.prob({value: renderValue(prob, { percent:true })}) : null,
  1956. value: renderValue(value),
  1957. attr: renderAttrs(attr, {affix: true}),
  1958. };
  1959. frg.ap(tsp.skill.counter_attack(dict));
  1960. break;
  1961. }
  1962. case SkillKinds.ChangeOrbs: { //珠子变换
  1963. let changes = skill.changes;
  1964. let subDocument = [];
  1965. for (const change of changes)
  1966. {
  1967. dict = {
  1968. from: renderOrbs(change.from),
  1969. to: renderOrbs(change.to),
  1970. };
  1971. subDocument.push(tsp.skill.change_orbs(dict));
  1972. }
  1973. frg.ap(subDocument.nodeJoin(tsp.word.comma()));
  1974. break;
  1975. }
  1976. case SkillKinds.GenerateOrbs: { //产生珠子
  1977. let orbs = skill.orbs, exclude = skill.exclude, count = skill.count, time = skill.time;
  1978. dict = {
  1979. exclude: exclude?.length ? tsp.word.affix_exclude({cotent: renderOrbs(exclude)}) : void 0,
  1980. orbs: renderOrbs(orbs, {time}),
  1981. value: count,
  1982. };
  1983. frg.ap(tsp.skill.generate_orbs(dict));
  1984. if (!merge_skill)
  1985. {
  1986. let board = new Board();
  1987. board.generateOrbs(orbs, count, exclude);
  1988. frg.ap(board.toTable());
  1989. }
  1990. break;
  1991. }
  1992. case SkillKinds.FixedOrbs: { //固定位置产生珠子
  1993. let generates = skill.generates;
  1994. let slight_pause = tsp.word.slight_pause().textContent;
  1995. let subDocument = [];
  1996. let board = merge_skill ? null : new Board();
  1997. function posSplit(pos, max)
  1998. {
  1999. return {sequence: pos.filter(n=>n<=2).map(n=>n+1), reverse: pos.filter(n=>n>=3).reverse().map(n=>max-n)};
  2000. }
  2001. for (const generate of generates)
  2002. {
  2003. let orb = generate.orbs?.[0], time = generate.time;
  2004. dict = {
  2005. orbs: renderOrbs(orb, {time}),
  2006. };
  2007. if (generate.type == 'shape')
  2008. {
  2009. dict.position = tsp.position.shape();
  2010. if (!merge_skill) board.setShape(generate.positions, orb);
  2011. }else
  2012. {
  2013. let posFrgs = [];
  2014. if (generate.positions.length == 0) continue;
  2015. if (generate.type == 'row')
  2016. {
  2017. const pos = posSplit(generate.positions, 5);
  2018. if (pos.sequence.length) posFrgs.push(tsp.position.top({pos: pos.sequence.join(slight_pause)}));
  2019. if (pos.reverse.length) posFrgs.push(tsp.position.bottom({pos: pos.reverse.join(slight_pause)}));
  2020. if (!merge_skill) board.setRow(generate.positions, orb);
  2021. }else
  2022. {
  2023. const pos = posSplit(generate.positions, 6);
  2024. if (pos.sequence.length) posFrgs.push(tsp.position.left({pos: pos.sequence.join(slight_pause)}));
  2025. if (pos.reverse.length) posFrgs.push(tsp.position.right({pos: pos.reverse.join(slight_pause)}));
  2026. if (!merge_skill) board.setColumn(generate.positions, orb);
  2027. }
  2028. dict.position = posFrgs.nodeJoin(tsp.word.slight_pause());
  2029. }
  2030. subDocument.push(tsp.skill.fixed_orbs(dict));
  2031. }
  2032. frg.ap(subDocument.nodeJoin(tsp.word.comma()));
  2033. if (!merge_skill) frg.ap(board.toTable());
  2034. break;
  2035. }
  2036. case SkillKinds.OrbDropIncrease: { //增加天降
  2037. let attrs = skill.attrs, value = skill.value, flag = skill.flag;
  2038. dict = {
  2039. value: value && renderValue(value, {percent: true}) || null,
  2040. chance: value && tsp.value.prob({
  2041. value: renderValue(value, {percent: true})
  2042. }) || null,
  2043. orbs: renderOrbs(attrs, {className: "drop", affix: true}),
  2044. flag: flag && tsp.orbs[flag]({icon: createIcon("orb-" + flag)}) || null,
  2045. };
  2046. frg.ap(flag ? tsp.skill.orb_drop_increase_flag(dict) : tsp.skill.orb_drop_increase(dict));
  2047. break;
  2048. }
  2049. case SkillKinds.VoidEnemyBuff: {
  2050. let buffs = skill.buffs;
  2051. let subDocument = [];
  2052. for (let buff of buffs)
  2053. {
  2054. let dict = {
  2055. icon: createIcon(buff),
  2056. };
  2057. subDocument.push(tsp.skill[buff.replace(/\-/g,'_')](dict));
  2058. }
  2059. let dict = {
  2060. buff: subDocument.nodeJoin(tsp.word.slight_pause()),
  2061. };
  2062. frg.ap(tsp.skill.void_enemy_buff(dict));
  2063. break;
  2064. }
  2065. case SkillKinds.ChangeAttribute: {
  2066. let attr = skill.attr, target = skill.target;
  2067. dict = {
  2068. attrs: renderAttrs(attr, {affix: true}),
  2069. target: target === 'opponent' ? tsp.target.enemy_all() : tsp.target.self(),
  2070. };
  2071. frg.ap(tsp.skill.change_attribute(dict));
  2072. break;
  2073. }
  2074. case SkillKinds.SetOrbState: {
  2075. let orbs = skill.orbs, state = skill.state, arg = skill.arg;
  2076. dict = {
  2077. orbs: renderOrbs(orbs, {className: state, affix: true}),
  2078. icon: createIcon('orb-' + state),
  2079. };
  2080. switch (state)
  2081. {
  2082. case "enhanced":{
  2083. dict.value = renderValue(arg.enhance, {percent: true});
  2084. frg.ap(tsp.skill.set_orb_state_enhanced(dict));
  2085. break;
  2086. }
  2087. case "locked":{
  2088. if (arg.count.value < 42)
  2089. dict.value = renderValue(arg.count, {unit: tsp.unit.orbs});
  2090. frg.ap(tsp.skill.set_orb_state_locked(dict));
  2091. break;
  2092. }
  2093. case "unlocked":{
  2094. frg.ap(tsp.skill.set_orb_state_unlocked(dict));
  2095. break;
  2096. }
  2097. case "bound":{
  2098. frg.ap(tsp.skill.set_orb_state_bound(dict));
  2099. break;
  2100. }
  2101. }
  2102. break;
  2103. }
  2104. case SkillKinds.RateMultiply: {
  2105. let rate = skill.rate, value = skill.value;
  2106. dict = {
  2107. rate: tsp.skill["rate_multiply_" + rate]({icon: createIcon(skill.kind + "-" + rate)}),
  2108. value: renderValue(value),
  2109. };
  2110. frg.ap(tsp.skill.rate_multiply(dict));
  2111. break;
  2112. }
  2113. case SkillKinds.ReduceDamage: {
  2114. let attrs = skill.attrs, percent = skill.percent, condition = skill.condition, prob = skill.prob;
  2115. dict = {
  2116. icon: createIcon(skill.kind),
  2117. attrs: renderAttrs(attrs, {affix: true}),
  2118. value: renderValue(percent, {percent: true}),
  2119. condition: condition ? renderCondition(condition) : null,
  2120. chance: prob.value < 1 ? tsp.value.prob({value: renderValue(prob, { percent:true })}) : null,
  2121. };
  2122. frg.ap(tsp.skill.reduce_damage(dict));
  2123. break;
  2124. }
  2125. case SkillKinds.PowerUp: {
  2126. let attrs = skill.attrs, types = skill.types, targets = skill.targets, condition = skill.condition, value = skill.value, reduceDamage = skill.reduceDamage, additional = skill.additional;
  2127. dict = {
  2128. icon: createIcon(skill.kind),
  2129. };
  2130. if (condition) dict.condition = renderCondition(condition);
  2131. let targetDict = {}, attrs_types = [];
  2132. if (attrs?.length && !isEqual(attrs, Attributes.all()))
  2133. {
  2134. targetDict.attrs = renderAttrs(attrs || [], {affix: attrs?.filter(attr=> attr !== 5)?.length});
  2135. attrs_types.push(targetDict.attrs);
  2136. }
  2137. if (types?.length)
  2138. {
  2139. targetDict.types = renderTypes(types || [], {affix: true});
  2140. attrs_types.push(targetDict.types);
  2141. }
  2142. if (targets != undefined)
  2143. {
  2144. targetDict.target = targets.map(target=>
  2145. tsp?.target[target.replaceAll("-","_")]?.())
  2146. .nodeJoin(tsp.word.slight_pause());
  2147. attrs_types.push(targetDict.target);
  2148. }
  2149. if (attrs_types.length)
  2150. {
  2151. targetDict.attrs_types = attrs_types.nodeJoin(tsp.word.slight_pause());
  2152. }
  2153. if (attrs_types.length) dict.targets = tsp.skill.power_up_targets(targetDict);
  2154. let subDocument = [];
  2155. if (value){
  2156. /*if (attrs?.includes(5) && value.kind == SkillPowerUpKind.Multiplier)
  2157. { //如果属性有5,则是回复力
  2158. let _value = Object.assign({}, value);
  2159. _value.rcv = value.atk;
  2160. _value.atk = value.rcv;
  2161. value = _value;
  2162. }*/
  2163. if (value.kind == SkillPowerUpKind.Multiplier && Boolean(value.hp || value.atk || value.rcv) == false)
  2164. {
  2165. //不显示 value
  2166. }else
  2167. {
  2168. subDocument.push(renderPowerUp(value));
  2169. }
  2170. }
  2171. if (reduceDamage && reduceDamage.value > 0) {
  2172. subDocument.push(tsp.skill.reduce_damage({
  2173. value: renderValue(reduceDamage, {percent: true}),
  2174. icon: createIcon("reduce-damage"),
  2175. }));
  2176. }
  2177. if (additional?.length) {
  2178. for (let subSkill of additional.filter(Boolean))
  2179. {
  2180. subDocument.push(renderSkill(subSkill, option));
  2181. }
  2182. }
  2183. dict.value = subDocument.filter(Boolean).nodeJoin(tsp.word.comma());
  2184. frg.ap(tsp.skill.power_up(dict));
  2185. break;
  2186. }
  2187. case SkillKinds.Henshin: { //变身
  2188. let ids = skill.ids, random = skill.random;
  2189. let doms = ids.map(id=>{
  2190. let dom = cardN(id);
  2191. dom.monDom.onclick = changeToIdInSkillDetail;
  2192. return dom; })
  2193. dict = {
  2194. cards: doms.nodeJoin(),
  2195. }
  2196. frg.ap(random ?
  2197. tsp.skill.random_henshin(dict) :
  2198. tsp.skill.henshin(dict)
  2199. );
  2200. break;
  2201. }
  2202. case SkillKinds.VoidPoison: { //毒无效
  2203. dict = {
  2204. poison: renderOrbs([7,8], {affix: true})
  2205. }
  2206. frg.ap(tsp.skill.void_poison(dict));
  2207. break;
  2208. }
  2209. case SkillKinds.SkillProviso: { //条件限制才能用技能
  2210. let cond = skill.cond;
  2211. dict = {
  2212. condition: renderCondition(cond)
  2213. }
  2214. frg.ap(tsp.skill.skill_proviso(dict));
  2215. break;
  2216. }
  2217. case SkillKinds.ImpartAwakenings: { //赋予队员觉醒
  2218. let attrs = skill.attrs, types = skill.types, awakenings = skill.awakenings;
  2219. dict = {
  2220. awakenings: renderAwakenings(awakenings, {affix: true}),
  2221. }
  2222. let attrs_types = [];
  2223. if (attrs?.length && !isEqual(attrs, Attributes.all()))
  2224. {
  2225. dict.attrs = renderAttrs(attrs || [], {affix: attrs?.filter(attr=> attr !== 5)?.length});
  2226. attrs_types.push(dict.attrs);
  2227. }
  2228. if (types?.length)
  2229. {
  2230. dict.types = renderTypes(types || [], {affix: true});
  2231. attrs_types.push(dict.types);
  2232. }
  2233. if (attrs_types.length)
  2234. {
  2235. dict.attrs_types = attrs_types.nodeJoin(tsp.word.slight_pause());
  2236. }
  2237. frg.ap(tsp.skill.impart_awoken(dict));
  2238. break;
  2239. }
  2240. case SkillKinds.ObstructOpponent: { //条件限制才能用技能
  2241. let type = skill.type, pos = skill.pos, enemy_skills = skill.enemy_skills;
  2242. let slight_pause = tsp.word.slight_pause().textContent;
  2243. dict = {
  2244. skills: enemy_skills.join(slight_pause)
  2245. }
  2246. let targetDict = { positions: pos?.map(p=>p+1).join(slight_pause)}
  2247. switch (type)
  2248. {
  2249. case "after-me": {
  2250. dict.target = tsp.skill.obstruct_opponent_after_me(targetDict);
  2251. break;
  2252. }
  2253. case "designated-position": {
  2254. dict.target = tsp.skill.obstruct_opponent_designated_position(targetDict);
  2255. break;
  2256. }
  2257. case "before-me": {
  2258. dict.target = tsp.skill.obstruct_opponent_before_me(targetDict);
  2259. break;
  2260. }
  2261. default: {
  2262. dict.target = tsp.cond.unknown();
  2263. break;
  2264. }
  2265. }
  2266. frg.ap(tsp.skill.obstruct_opponent(dict));
  2267. break;
  2268. }
  2269. default: {
  2270. console.log("未处理的技能类型",skill.kind, skill);
  2271. frg.ap(skill.kind);
  2272. }
  2273. }
  2274. return frg;
  2275. };
  2276. function renderStat(stat, option) {
  2277. const frg = document.createDocumentFragment();
  2278. if (typeof localTranslating == "undefined") return frg;
  2279. const tspt = localTranslating.skill_parse.stats;
  2280. if (tspt[stat])
  2281. frg.ap(tspt[stat](option));
  2282. else
  2283. {
  2284. console.log("未知状态类型",stat);
  2285. frg.ap(tspt.unknown({ type: stat }));
  2286. }
  2287. return frg;
  2288. }
  2289. function renderAttrs(attrs, option = {}) {
  2290. if (!Array.isArray(attrs))
  2291. attrs = [attrs ?? 0];
  2292. const frg = document.createDocumentFragment();
  2293. if (typeof localTranslating == "undefined") return frg;
  2294. const tsp = localTranslating.skill_parse;
  2295. let contentFrg;
  2296. if (isEqual(attrs, Attributes.all()))
  2297. {
  2298. contentFrg = tsp.attrs.all();
  2299. }
  2300. else
  2301. {
  2302. contentFrg = attrs.map(attr => {
  2303. const icon = document.createElement("icon");
  2304. icon.className = "attr";
  2305. icon.setAttribute("data-attr-icon",attr);
  2306. return tsp.attrs?.[attr]({icon: icon});
  2307. })
  2308. .nodeJoin(tsp.word.slight_pause());
  2309. }
  2310. if (option.affix)
  2311. contentFrg = tsp.word.affix_attr({cotent: contentFrg});
  2312. frg.ap(contentFrg);
  2313. return frg;
  2314. }
  2315. function renderOrbs(attrs, option = {}) {
  2316. if (!Array.isArray(attrs))
  2317. attrs = [attrs ?? 0];
  2318. const frg = document.createDocumentFragment();
  2319. if (typeof localTranslating == "undefined") return frg;
  2320. const tsp = localTranslating.skill_parse;
  2321. let contentFrg;
  2322. if (isEqual(attrs, Attributes.orbs()))
  2323. {
  2324. contentFrg = tsp.orbs.all();
  2325. }
  2326. else if (isEqual(attrs, Attributes.all()))
  2327. {
  2328. contentFrg = renderOrbs('_5color');
  2329. }
  2330. else if (isEqual(attrs, Attributes._6color()))
  2331. {
  2332. contentFrg = tsp.orbs._6color({
  2333. _5color: renderOrbs('_5color'),
  2334. orb_rcv: renderOrbs(5),
  2335. });
  2336. }
  2337. else
  2338. {
  2339. contentFrg = attrs.map(attr => {
  2340. const icon = document.createElement("icon");
  2341. icon.className = "orb";
  2342. if (option.className) icon.className += " " + option.className;
  2343. if (attr == 'variation')
  2344. icon.classList.add('variation');
  2345. else
  2346. icon.setAttribute("data-orb-icon",attr);
  2347. let dict = {
  2348. icon: icon,
  2349. }
  2350. if (attr == 'variation') dict.time = renderValue(v.constant(option.time), {unit: tsp.unit.seconds}) ;
  2351. return tsp.orbs?.[attr](dict);
  2352. })
  2353. .nodeJoin(tsp.word.slight_pause());
  2354. }
  2355. if (option.affix)
  2356. contentFrg = tsp.word.affix_orb({cotent: contentFrg});
  2357. if (option.any && attrs.length >= 2)
  2358. contentFrg = tsp.orbs.any({cotent: contentFrg});
  2359. frg.ap(contentFrg);
  2360. return frg;
  2361. }
  2362. function renderTypes(types, option = {}) {
  2363. if (!Array.isArray(types))
  2364. types = [types ?? 0];
  2365. const frg = document.createDocumentFragment();
  2366. if (typeof localTranslating == "undefined") return frg;
  2367. const tsp = localTranslating.skill_parse;
  2368. let contentFrg = types.map(type => {
  2369. const icon = document.createElement("icon");
  2370. icon.className = "type";
  2371. icon.setAttribute("data-type-icon",type);
  2372. return tsp.types?.[type]({icon: icon});
  2373. })
  2374. .nodeJoin(tsp.word.slight_pause());
  2375. if (option.affix)
  2376. contentFrg = tsp.word.affix_type({cotent: contentFrg});
  2377. frg.ap(contentFrg);
  2378. return frg;
  2379. }
  2380. function renderAwakenings(awakenings, option = {}) {
  2381. if (!Array.isArray(awakenings))
  2382. awakenings = [awakenings ?? 0];
  2383. const frg = document.createDocumentFragment();
  2384. if (typeof localTranslating == "undefined") return frg;
  2385. const tsp = localTranslating.skill_parse;
  2386. let contentFrg = awakenings.map(awoken => {
  2387. const icon = document.createElement("icon");
  2388. icon.className = "awoken-icon";
  2389. icon.setAttribute("data-awoken-icon",awoken);
  2390. return tsp.awokens?.[awoken]({icon: icon});
  2391. })
  2392. .nodeJoin(tsp.word.slight_pause());
  2393. if (option.affix)
  2394. contentFrg = tsp.word.affix_awakening({cotent: contentFrg});
  2395. frg.ap(contentFrg);
  2396. return frg;
  2397. }
  2398. function renderCondition(cond) {
  2399. const frg = document.createDocumentFragment();
  2400. const tsp = localTranslating.skill_parse;
  2401. if (cond.hp) {
  2402. let dict = {
  2403. hp: renderStat('chp'),
  2404. min: renderValue(v.percent(cond.hp.min * 100), {percent: true}),
  2405. max: renderValue(v.percent(cond.hp.max * 100), {percent: true}),
  2406. };
  2407. if (cond.hp.min === cond.hp.max)
  2408. frg.ap(tsp.cond.hp_equal(dict));
  2409. else if (cond.hp.min === 0)
  2410. frg.ap(tsp.cond.hp_less_or_equal(dict));
  2411. else if (cond.hp.max === 1)
  2412. frg.ap(tsp.cond.hp_greater_or_equal(dict));
  2413. else
  2414. frg.ap(tsp.cond.hp_belong_to_range(dict));
  2415. } else if (cond.useSkill) {
  2416. frg.ap(tsp.cond.use_skill());
  2417. } else if (cond.multiplayer) {
  2418. frg.ap(tsp.cond.multi_player());
  2419. } else if (cond.remainOrbs) {
  2420. let dict = {
  2421. value: renderValue(v.constant(cond.remainOrbs.count), {unit: tsp.unit.orbs}),
  2422. };
  2423. frg.ap(tsp.cond.remain_orbs(dict));
  2424. } else if (cond.exact) {
  2425. if (cond.exact.type === 'combo') {
  2426. let dict = {value: cond.exact.value};
  2427. frg.ap(tsp.cond.exact_combo(dict));
  2428. } else if (cond.exact.type === 'match-length') {
  2429. let dict = {
  2430. value: renderValue(v.constant(cond.exact.value), {unit: tsp.unit.orbs}),
  2431. orbs: cond.exact.attrs === 'enhanced' ? tsp.cond.exact_match_enhanced() : renderOrbs(cond.exact.attrs, {affix: true})
  2432. };
  2433. frg.ap(cond.exact.multiple ?
  2434. tsp.cond.exact_match_length_multiple(dict) :
  2435. tsp.cond.exact_match_length(dict));
  2436. }
  2437. } else if (cond.compo) {
  2438. let dict = {};
  2439. switch (cond.compo.type)
  2440. {
  2441. case 'card':{
  2442. dict.ids = cond.compo.ids.map(mid=>{
  2443. const dom = cardN(mid);
  2444. dom.monDom.onclick = changeToIdInSkillDetail;
  2445. return dom;
  2446. }).nodeJoin();
  2447. frg.ap(tsp.cond.compo_type_card(dict));
  2448. break;
  2449. }
  2450. case 'series':{
  2451. dict.ids = cond.compo.ids.map(cid=>{
  2452. const lnk = document.createElement("a");
  2453. lnk.className ="detail-search monster-collabId";
  2454. lnk.setAttribute("data-collabId",cid);
  2455. lnk.onclick = searchCollab;
  2456. lnk.textContent = (cid == 10001 ? Cards[5435] : Cards.find(card=>card.collabId == cid))?.altName?.[0] ?? `No.${cid}`;
  2457. return lnk;
  2458. }).nodeJoin(tsp.word.slight_pause());
  2459. frg.ap(tsp.cond.compo_type_series(dict));
  2460. break;
  2461. }
  2462. case 'evolution':{
  2463. dict.ids = cond.compo.ids.map(type=>{
  2464. const lnk = document.createElement("a");
  2465. lnk.className ="detail-search";
  2466. switch (type)
  2467. {
  2468. case "pixel-evo":{ //像素进化
  2469. lnk.appendChild(tsp.word.evo_type_pixel());
  2470. lnk.onclick = function(){
  2471. showSearch(Cards.filter(card=>card.evoMaterials.includes(3826)));
  2472. };
  2473. break;
  2474. }
  2475. case "reincarnation-evo":{ //转生或超转生
  2476. lnk.appendChild(tsp.word.evo_type_reincarnation());
  2477. lnk.onclick = function(){
  2478. showSearch(Cards.filter(card=>isReincarnated(card)));
  2479. };
  2480. break;
  2481. }
  2482. default:{ //转生或超转生
  2483. return tsp.word.evo_type_unknow({ type });
  2484. }
  2485. }
  2486. return lnk;
  2487. }).nodeJoin(tsp.word.slight_pause());
  2488. frg.ap(tsp.cond.compo_type_evolution(dict));
  2489. break;
  2490. }
  2491. case 'rarity':{
  2492. dict.rarity = cond.compo.ids;
  2493. frg.ap(tsp.cond.compo_type_rarity(dict));
  2494. break;
  2495. }
  2496. }
  2497. } else if (cond.LShape) {
  2498. let dict = {
  2499. orbs: renderOrbs(cond.LShape.attrs, {affix: true, any: true}),
  2500. };
  2501. frg.ap(tsp.cond.L_shape(dict));
  2502. } else if (cond.heal) {
  2503. let dict = {
  2504. orbs: renderOrbs(5, {affix: true}),
  2505. heal: renderValue(v.constant(cond.heal.min), {unit: tsp.unit.point}),
  2506. stats: renderStat('hp'),
  2507. };
  2508. frg.ap(tsp.cond.heal(dict));
  2509. } else if (cond.stage) {
  2510. let dict = {
  2511. stage: renderStat('cstage'),
  2512. min: renderValue(v.constant(cond.stage.min)),
  2513. max: renderValue(v.constant(cond.stage.max)),
  2514. };
  2515. if (cond.stage.min > 0)
  2516. frg.ap(tsp.cond.stage_greater_or_equal(dict));
  2517. else if (cond.stage.max > 0)
  2518. frg.ap(tsp.cond.stage_less_or_equal(dict));
  2519. } else {
  2520. frg.ap(tsp.cond.unknown());
  2521. }
  2522. return frg;
  2523. }
  2524. function renderPowerUp(powerUp) {
  2525. const frg = document.createDocumentFragment();
  2526. const tsp = localTranslating.skill_parse;
  2527. function renderStats(hp, atk, rcv, option = {}) {
  2528. const mul = option.mul ?? true;
  2529. option.percent = !mul;
  2530. const frg = document.createDocumentFragment();
  2531. const operator = mul ? ' ' : '+';
  2532. let list = [['hp', hp], ['atk', atk], ['rcv', rcv]];
  2533. //去除不改变的值
  2534. list = list.filter(([, value]) => value !== (mul ? 1 : 0));
  2535. //&&!(name === 'hp' && value === 0));
  2536. if (list.length === 0) return frg;
  2537. if (list.every(([, value]) => value === list[0][1])) {
  2538. let value = list[0][1];
  2539. //三个值一样
  2540. frg.ap(list.map(([name]) => renderStat(name)).nodeJoin(tsp.word.slight_pause()));
  2541. frg.ap(operator);
  2542. frg.ap(renderValue(v.percent(value * 100), option));
  2543. } else {
  2544. //三个值不一样
  2545. let subDocument = list.map(([name, value]) => {
  2546. let _frg = document.createDocumentFragment();
  2547. _frg.ap(renderStat(name));
  2548. _frg.ap(operator);
  2549. _frg.ap(renderValue(v.percent(value * 100), option));
  2550. return _frg;
  2551. });
  2552. frg.ap(subDocument.nodeJoin(tsp.word.comma()));
  2553. }
  2554. return frg;
  2555. }
  2556. switch (powerUp.kind) {
  2557. case SkillPowerUpKind.Multiplier: {
  2558. let hp = powerUp.hp, atk = powerUp.atk, rcv = powerUp.rcv;
  2559. frg.ap(renderStats(hp, atk, rcv));
  2560. break;
  2561. }
  2562. case SkillPowerUpKind.ScaleAttributes: {
  2563. let attrs = powerUp.attrs, min = powerUp.min, max = powerUp.max, baseAtk = powerUp.baseAtk, baseRcv = powerUp.baseRcv, bonusAtk = powerUp.bonusAtk, bonusRcv = powerUp.bonusRcv;
  2564. let dict = {
  2565. orbs: renderOrbs(attrs, {affix: true}),
  2566. min: min,
  2567. stats: renderStats(1, baseAtk, baseRcv),
  2568. }
  2569. if (max !== min)
  2570. {
  2571. let _dict = {
  2572. max: max,
  2573. bonus: renderStats(0, bonusAtk, bonusRcv, {mul: false}),
  2574. stats_max: renderStats(1, baseAtk + bonusAtk * (max-min), baseRcv + bonusRcv * (max-min)),
  2575. }
  2576. dict.bonus = frg.ap(tsp.power.scale_attributes_bonus(_dict));
  2577. }
  2578. frg.ap(tsp.power.scale_attributes(dict));
  2579. break;
  2580. }
  2581. case SkillPowerUpKind.ScaleCombos: {
  2582. let min = powerUp.min, max = powerUp.max, baseAtk = powerUp.baseAtk, baseRcv = powerUp.baseRcv, bonusAtk = powerUp.bonusAtk, bonusRcv = powerUp.bonusRcv;
  2583. let dict = {
  2584. min: min,
  2585. stats: renderStats(1, baseAtk, baseRcv),
  2586. }
  2587. if (max !== min)
  2588. {
  2589. let _dict = {
  2590. max: max,
  2591. bonus: renderStats(0, bonusAtk, bonusRcv, {mul: false}),
  2592. stats_max: renderStats(1, baseAtk + bonusAtk * (max-min), baseRcv + bonusRcv * (max-min)),
  2593. }
  2594. dict.bonus = frg.ap(tsp.power.scale_combos_bonus(_dict));
  2595. }
  2596. frg.ap(tsp.power.scale_combos(dict));
  2597. break;
  2598. }
  2599. case SkillPowerUpKind.ScaleMatchAttrs: {
  2600. let matches = powerUp.matches, min = powerUp.min, max = powerUp.max, baseAtk = powerUp.baseAtk, baseRcv = powerUp.baseRcv, bonusAtk = powerUp.bonusAtk, bonusRcv = powerUp.bonusRcv;
  2601. let dict = {
  2602. matches: matches.map(orbs=>renderOrbs(orbs)).nodeJoin(tsp.word.slight_pause()),
  2603. min: min,
  2604. stats: renderStats(1, baseAtk, baseRcv),
  2605. }
  2606. if (max !== min)
  2607. {
  2608. let _dict = {
  2609. max: max,
  2610. bonus: renderStats(0, bonusAtk, bonusRcv, {mul: false}),
  2611. stats_max: renderStats(1, baseAtk + bonusAtk * (max-min), baseRcv + bonusRcv * (max-min)),
  2612. }
  2613. dict.bonus = frg.ap(tsp.power.scale_match_attrs_bonus(_dict));
  2614. }
  2615. frg.ap(tsp.power.scale_match_attrs(dict));
  2616. break;
  2617. }
  2618. case SkillPowerUpKind.ScaleMatchLength: {
  2619. let attrs = powerUp.attrs, min = powerUp.min, max = powerUp.max, baseAtk = powerUp.baseAtk, baseRcv = powerUp.baseRcv, bonusAtk = powerUp.bonusAtk, bonusRcv = powerUp.bonusRcv, matchAll = powerUp.matchAll;
  2620. let dict = {
  2621. orbs: renderOrbs(attrs, {affix: true}),
  2622. min: min,
  2623. stats: renderStats(1, baseAtk, baseRcv),
  2624. in_once: matchAll && attrs.length>1 && tsp.word.in_once() || null,
  2625. }
  2626. if (max !== min)
  2627. {
  2628. let _dict = {
  2629. max: max,
  2630. bonus: renderStats(0, bonusAtk, bonusRcv, {mul: false}),
  2631. stats_max: renderStats(1, baseAtk + bonusAtk * (max-min), baseRcv + bonusRcv * (max-min)),
  2632. }
  2633. dict.bonus = frg.ap(tsp.power.scale_match_length_bonus(_dict));
  2634. }
  2635. frg.ap(tsp.power.scale_match_length(dict));
  2636. break;
  2637. }
  2638. case SkillPowerUpKind.ScaleCross: {
  2639. let crosses = powerUp.crosses;
  2640. /*if (crosses.length >= 2 && crosses.every(cross => cross.atk === crosses[0].atk)) {
  2641. //所有值一样
  2642. let cross = crosses[0];
  2643. let dict = {
  2644. orbs: renderOrbs(crosses.map(cross => cross.attr), {affix: true, any: true}),
  2645. stats: renderStats(1, cross.atk, cross.rcv),
  2646. }
  2647. frg.ap(cross.single ? tsp.power.scale_cross_single(dict) : tsp.power.scale_cross(dict));
  2648. } else {*/
  2649. let subDocument = crosses.map(cross=>{
  2650. let dict = {
  2651. orbs: renderOrbs(cross.attr, {affix: true, any: true}),
  2652. stats: renderStats(1, cross.atk, cross.rcv),
  2653. }
  2654. return cross.single ? tsp.power.scale_cross_single(dict) : tsp.power.scale_cross(dict);
  2655. });
  2656. frg.ap(subDocument.nodeJoin(tsp.word.comma()));
  2657. //}
  2658. break;
  2659. }
  2660. case SkillPowerUpKind.ScaleRemainOrbs: {
  2661. let min = powerUp.min, max = powerUp.max, baseAtk = powerUp.baseAtk, baseRcv = powerUp.baseRcv, bonusAtk = powerUp.bonusAtk, bonusRcv = powerUp.bonusRcv;
  2662. let dict = {
  2663. max: max,
  2664. stats: renderStats(1, baseAtk, baseRcv),
  2665. }
  2666. if (max !== min)
  2667. {
  2668. let _dict = {
  2669. min: min,
  2670. bonus: renderStats(0, bonusAtk, bonusRcv, {mul: false}),
  2671. stats_max: renderStats(1, baseAtk + bonusAtk * (max-min), baseRcv + bonusRcv * (max-min)),
  2672. }
  2673. dict.bonus = frg.ap(tsp.power.scale_remain_orbs_bonus(_dict));
  2674. }
  2675. frg.ap(tsp.power.scale_remain_orbs(dict));
  2676. break;
  2677. }
  2678. case SkillPowerUpKind.ScaleStateKindCount: {
  2679. let awakenings = powerUp.awakenings, attrs = powerUp.attrs, types = powerUp.types, value = powerUp.value;
  2680. let dict = {
  2681. stats: renderStats(value.hp, value.atk, value.rcv, {mul: false, percent: true}),
  2682. awakenings: awakenings?.length && renderAwakenings(awakenings, {affix: true}) || null,
  2683. attrs: attrs?.length && renderAttrs(attrs, {affix: true}) || null,
  2684. types: types?.length && renderTypes(types, {affix: true}) || null,
  2685. }
  2686. frg.ap(tsp.power.scale_state_kind_count(dict));
  2687. break;
  2688. }
  2689. default:
  2690. frg.ap(tsp.power.unknown({type: powerUp.kind}));
  2691. }
  2692. return frg;
  2693. }
  2694. function renderValue(_value, option = {}) {
  2695. const frg = document.createDocumentFragment();
  2696. if (typeof localTranslating == "undefined") return frg;
  2697. const tsp = localTranslating.skill_parse
  2698. const tspv = tsp.value;
  2699. const od = option.decimalDigits, os = option.plusSign;
  2700. let dict;
  2701. switch (_value.kind) {
  2702. case SkillValueKind.Percent: {
  2703. dict = {
  2704. value: option.percent ? (_value.value * 100).keepCounts(od,os) : _value.value.keepCounts(od,os),
  2705. };
  2706. frg.ap(
  2707. option.percent ?
  2708. tspv.mul_percent(dict) :
  2709. tspv.mul_times(dict)
  2710. );
  2711. break;
  2712. }
  2713. case SkillValueKind.Constant: {
  2714. dict = {
  2715. value: _value.value.keepCounts(od,os),
  2716. unit: option.unit ? option.unit() : null,
  2717. };
  2718. frg.ap(tspv.const(dict));
  2719. break;
  2720. }
  2721. case SkillValueKind.ConstantTo: {
  2722. dict = {
  2723. value: _value.value.keepCounts(od,os)
  2724. };
  2725. frg.ap(tspv.const_to(dict));
  2726. break;
  2727. }
  2728. case SkillValueKind.xMaxHP: {
  2729. dict = {
  2730. value: option.percent ? (_value.value * 100).keepCounts(od,os) : _value.value.keepCounts(od,os),
  2731. stats: renderStat('maxhp'),
  2732. };
  2733. frg.ap(
  2734. option.percent ?
  2735. tspv.mul_of_percent(dict) :
  2736. tspv.mul_of_times(dict)
  2737. );
  2738. break;
  2739. }
  2740. case SkillValueKind.xHP: {
  2741. dict = {
  2742. value: option.percent ? (_value.value * 100).keepCounts(od,os) : _value.value.keepCounts(od,os),
  2743. stats: renderStat('hp'),
  2744. };
  2745. frg.ap(
  2746. option.percent ?
  2747. tspv.mul_of_percent(dict) :
  2748. tspv.mul_of_times(dict)
  2749. );
  2750. break;
  2751. }
  2752. case SkillValueKind.xCHP: {
  2753. dict = {
  2754. value: option.percent ? (_value.value * 100).keepCounts(od,os) : _value.value.keepCounts(od,os),
  2755. stats: renderStat('chp'),
  2756. };
  2757. frg.ap(
  2758. option.percent ?
  2759. tspv.mul_of_percent(dict) :
  2760. tspv.mul_of_times(dict)
  2761. );
  2762. break;
  2763. }
  2764. case SkillValueKind.xATK: {
  2765. dict = {
  2766. value: option.percent ? (_value.value * 100).keepCounts(od,os) : _value.value.keepCounts(od,os),
  2767. stats: renderStat('atk'),
  2768. };
  2769. frg.ap(
  2770. option.percent ?
  2771. tspv.mul_of_percent(dict) :
  2772. tspv.mul_of_times(dict)
  2773. );
  2774. break;
  2775. }
  2776. case SkillValueKind.xRCV: {
  2777. dict = {
  2778. value: option.percent ? (_value.value * 100).keepCounts(od,os) : _value.value.keepCounts(od,os),
  2779. stats: renderStat('rcv'),
  2780. };
  2781. frg.ap(
  2782. option.percent ?
  2783. tspv.mul_of_percent(dict) :
  2784. tspv.mul_of_times(dict)
  2785. );
  2786. break;
  2787. }
  2788. case SkillValueKind.xTeamHP: {
  2789. let value = _value.value;
  2790. dict = {
  2791. value: option.percent ? (value * 100).keepCounts(od,os) : value.keepCounts(od,os),
  2792. stats: renderStat('teamhp'),
  2793. };
  2794. frg.ap(
  2795. option.percent ?
  2796. tspv.mul_of_percent(dict) :
  2797. tspv.mul_of_times(dict)
  2798. );
  2799. break;
  2800. }
  2801. case SkillValueKind.xTeamRCV: {
  2802. dict = {
  2803. value: option.percent ? (_value.value * 100).keepCounts(od,os) : _value.value.keepCounts(od,os),
  2804. stats: renderStat('teamrcv'),
  2805. };
  2806. frg.ap(
  2807. option.percent ?
  2808. tspv.mul_of_percent(dict) :
  2809. tspv.mul_of_times(dict)
  2810. );
  2811. break;
  2812. }
  2813. case SkillValueKind.xTeamATK: {
  2814. let attrs = _value.attrs, value = _value.value;
  2815. dict = {
  2816. value: option.percent ? (value * 100).keepCounts(od,os) : value.keepCounts(od,os),
  2817. stats: renderStat('teamatk', {attrs: renderAttrs(attrs, {affix: true})}),
  2818. };
  2819. frg.ap(
  2820. option.percent ?
  2821. tspv.mul_of_percent(dict) :
  2822. tspv.mul_of_times(dict)
  2823. );
  2824. break;
  2825. }
  2826. case SkillValueKind.HPScale: {
  2827. let min = _value.min, max = _value.max;
  2828. dict = {
  2829. min: tspv.mul_of_times({value: min.keepCounts(od,os), stats:renderStat('atk')}),
  2830. max: tspv.mul_of_times({value: max.keepCounts(od,os), stats:renderStat('atk')}),
  2831. hp: renderStat('hp'),
  2832. };
  2833. frg.ap(tspv.hp_scale(dict));
  2834. break;
  2835. }
  2836. case SkillValueKind.RandomATK: {
  2837. let min = _value.min, max = _value.max;
  2838. dict = {
  2839. min: min.keepCounts(od,os),
  2840. atk: renderStat('atk'),
  2841. };
  2842. if (max != min)
  2843. {
  2844. dict.max = tsp.word.range_hyphen().ap(max.keepCounts(od,os));
  2845. }
  2846. frg.ap(tspv.random_atk(dict));
  2847. break;
  2848. }
  2849. case SkillValueKind.xAwakenings: {
  2850. let value = _value.value, awakenings = _value.awakenings;
  2851. let dict = {
  2852. value: renderValue(value,{percent : true}),
  2853. awakenings: renderAwakenings(awakenings, {affix: true}),
  2854. }
  2855. frg.ap(tsp.value.x_awakenings(dict));
  2856. break;
  2857. }
  2858. default: {
  2859. console.log("未知数值类型",_value.kind, _value);
  2860. frg.ap(tspv.unknown({ type: _value.kind }));
  2861. }
  2862. }
  2863. return frg;
  2864. }

智龙迷城队伍图制作工具