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

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

智龙迷城队伍图制作工具