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

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