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 124 kB

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

智龙迷城队伍图制作工具