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

智龙迷城队伍图制作工具