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

智龙迷城队伍图制作工具