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

智龙迷城队伍图制作工具