From 3951791854b1f31d6c3084620f565b097356639b Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 18 Sep 2023 10:37:59 +0800 Subject: [PATCH 01/19] =?UTF-8?q?[2023/09/18:=20=E2=91=A0]=20Extend=20`Eve?= =?UTF-8?q?nt#setContent`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/game/game.js b/game/game.js index b2b32c0111..78cc7facf5 100644 --- a/game/game.js +++ b/game/game.js @@ -28510,16 +28510,32 @@ } return this; }, - setContent:function(name){ - if(typeof name=='function'){ - this.content=lib.init.parsex(name); - } - else{ - if(!lib.element.content[name]._parsed){ - lib.element.content[name]=lib.init.parsex(lib.element.content[name]); - lib.element.content[name]._parsed=true; - } - this.content=lib.element.content[name]; + setContent:function(item){ + switch(typeof item){ + case "object": + if(Array.isArray(item)){ + // TODO: Parse Array + throw new Error("NYI: Parse Common Object"); + } + else{ + // TODO: Parse Common Object + throw new Error("NYI: Parse Common Object"); + } + break; + case "function": + if (gnc.is.generatorFunc(item)) { + // TODO: Parse Generator Function + throw new Error("NYI: Pase Generator Function"); + } + else this.content=lib.init.parsex(item); + break; + default: + if(!lib.element.content[item]._parsed){ + lib.element.content[item]=lib.init.parsex(lib.element.content[item]); + lib.element.content[item]._parsed=true; + } + this.content=lib.element.content[item]; + break; } return this; }, From 09479829fd765f4315282ce908db377534a12fdf Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 18 Sep 2023 11:07:55 +0800 Subject: [PATCH 02/19] =?UTF-8?q?[2023/09/18:=20=E2=91=A0]=20Handle=20the?= =?UTF-8?q?=20array=20content.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/game/game.js b/game/game.js index 78cc7facf5..8d1252d4af 100644 --- a/game/game.js +++ b/game/game.js @@ -28514,8 +28514,26 @@ switch(typeof item){ case "object": if(Array.isArray(item)){ - // TODO: Parse Array - throw new Error("NYI: Parse Common Object"); + let lastEvent=null; + this.content=(event,step,source,player,target,targets,card,cards,skill,forced,num,trigger,result,_status,lib,game,ui,get,ai)=>{ + if(step>=item.length) return event.finish(); + var current=item[step]; + lastEvent=current(event,{ + event:event, + step:step, + source:source, + player:player, + target:target, + targets:targets, + card:card, + cards:cards, + skill:skill, + forced:forced, + num:num, + trigger:trigger, + result:result + },(lastEvent&&("result" in lastEvent))?lastEvent.result:null); + } } else{ // TODO: Parse Common Object From 897f993409591195c35b779ed27f56e842e17645 Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 18 Sep 2023 12:43:49 +0800 Subject: [PATCH 03/19] =?UTF-8?q?[2023/09/18:=20=E2=91=A0]=20Move=20conten?= =?UTF-8?q?t=20handle=20to=20`lib.init.parsex`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/game/game.js b/game/game.js index 8d1252d4af..26121efdc3 100644 --- a/game/game.js +++ b/game/game.js @@ -28513,39 +28513,8 @@ setContent:function(item){ switch(typeof item){ case "object": - if(Array.isArray(item)){ - let lastEvent=null; - this.content=(event,step,source,player,target,targets,card,cards,skill,forced,num,trigger,result,_status,lib,game,ui,get,ai)=>{ - if(step>=item.length) return event.finish(); - var current=item[step]; - lastEvent=current(event,{ - event:event, - step:step, - source:source, - player:player, - target:target, - targets:targets, - card:card, - cards:cards, - skill:skill, - forced:forced, - num:num, - trigger:trigger, - result:result - },(lastEvent&&("result" in lastEvent))?lastEvent.result:null); - } - } - else{ - // TODO: Parse Common Object - throw new Error("NYI: Parse Common Object"); - } - break; case "function": - if (gnc.is.generatorFunc(item)) { - // TODO: Parse Generator Function - throw new Error("NYI: Pase Generator Function"); - } - else this.content=lib.init.parsex(item); + this.content=lib.init.parsex(item); break; default: if(!lib.element.content[item]._parsed){ From c7bf5c03f23be7a59a5f7c2b4fd2c08337724b01 Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 18 Sep 2023 12:55:40 +0800 Subject: [PATCH 04/19] =?UTF-8?q?[2023/09/18:=20=E2=91=A0]=20Move=20conten?= =?UTF-8?q?t=20handle=20to=20`lib.init.parsex`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 113 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 75 insertions(+), 38 deletions(-) diff --git a/game/game.js b/game/game.js index 26121efdc3..eb7e7c0e66 100644 --- a/game/game.js +++ b/game/game.js @@ -10234,47 +10234,84 @@ localStorage.removeItem(lib.configprefix+'background'); } }, - //by 诗笺、Tipx-L - parsex:function(func){ - //Remove all comments - //移除所有注释 - var str=func.toString().replace(/((?:(?:^[ \t]*)?(?:\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\/(?:[ \t]*\r?\n(?=[ \t]*(?:\r?\n|\/\*|\/\/)))?|\/\/(?:[^\\]|\\(?:\r?\n)?)*?(?:\r?\n(?=[ \t]*(?:\r?\n|\/\*|\/\/))|(?=\r?\n))))+)|("(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|(?:\r?\n|[\s\S])[^\/"'\\\s]*)/mg,'$2').trim(); - //获取第一个 { 后的所有字符 - str=str.slice(str.indexOf('{')+1); - //func中要写步骤的话,必须要写step 0 - if(str.indexOf('step 0')==-1){ - str='{if(event.step==1) {event.finish();return;}\n'+str; - }else{ - var skip=0; - //每层最多找99个step - for (var k=0;k<99;k++) { - //正则表达式 - var reg=new RegExp(`['"]step ${k}['"]`); - var result=str.slice(skip).match(reg); - if(result==null) break; - var insertStr; - if(k==0){ - insertStr=`switch(step){case 0:`; - }else{ - insertStr=`break;case ${k}:`; - } - var copy=str; - copy=copy.slice(0,skip+result.index)+insertStr+copy.slice(skip+result.index+result[0].length); - //测试是否有错误 - try{ - new Function(copy); - str=copy; - skip+=result.index+insertStr.length; - }catch(error){ - k--; - skip+=result.index+result[0].length; + parsex:function(item){ + //by 诗笺、Tipx-L + function Legacy(func){ + //Remove all comments + //移除所有注释 + var str=func.toString().replace(/((?:(?:^[ \t]*)?(?:\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\/(?:[ \t]*\r?\n(?=[ \t]*(?:\r?\n|\/\*|\/\/)))?|\/\/(?:[^\\]|\\(?:\r?\n)?)*?(?:\r?\n(?=[ \t]*(?:\r?\n|\/\*|\/\/))|(?=\r?\n))))+)|("(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|(?:\r?\n|[\s\S])[^\/"'\\\s]*)/mg,'$2').trim(); + //获取第一个 { 后的所有字符 + str=str.slice(str.indexOf('{')+1); + //func中要写步骤的话,必须要写step 0 + if(str.indexOf('step 0')==-1){ + str='{if(event.step==1) {event.finish();return;}\n'+str; + }else{ + var skip=0; + //每层最多找99个step + for (var k=0;k<99;k++) { + //正则表达式 + var reg=new RegExp(`['"]step ${k}['"]`); + var result=str.slice(skip).match(reg); + if(result==null) break; + var insertStr; + if(k==0){ + insertStr=`switch(step){case 0:`; + }else{ + insertStr=`break;case ${k}:`; + } + var copy=str; + copy=copy.slice(0,skip+result.index)+insertStr+copy.slice(skip+result.index+result[0].length); + //测试是否有错误 + try{ + new Function(copy); + str=copy; + skip+=result.index+insertStr.length; + }catch(error){ + k--; + skip+=result.index+result[0].length; + } } + str=`if(event.step==${k}){event.finish();return;}`+str; } - str=`if(event.step==${k}){event.finish();return;}`+str; + return (new Function('event','step','source','player','target','targets', + 'card','cards','skill','forced','num','trigger','result', + '_status','lib','game','ui','get','ai',str)); + } + switch(typeof item){ + case "object": + if(Array.isArray(item)){ + let lastEvent=null; + return (event,step,source,player,target,targets,card,cards,skill,forced,num,trigger,result,_status,lib,game,ui,get,ai)=>{ + if(step>=item.length) return event.finish(); + var current=item[step]; + lastEvent=current(event,{ + event:event, + step:step, + source:source, + player:player, + target:target, + targets:targets, + card:card, + cards:cards, + skill:skill, + forced:forced, + num:num, + trigger:trigger, + result:result + },(lastEvent&&("result" in lastEvent))?lastEvent.result:null); + } + } + else{ + // TODO: Parse Common Object + throw new Error("NYI: Parse Common Object"); + } + case "function": + if (gnc.is.generatorFunc(item)) { + // TODO: Parse Generator Function + throw new Error("NYI: Pase Generator Function"); + } + else return Legacy(item); } - return (new Function('event','step','source','player','target','targets', - 'card','cards','skill','forced','num','trigger','result', - '_status','lib','game','ui','get','ai',str)); }, eval:function(func){ if(typeof func=='function'){ From ee0bfc60a8db0b76bf7a2ab1410a260a3d07d15e Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 18 Sep 2023 16:06:58 +0800 Subject: [PATCH 05/19] =?UTF-8?q?[2023/09/18:=20=E2=91=A1]=20Handle=20Gene?= =?UTF-8?q?ratorFunction.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/game/game.js b/game/game.js index eb7e7c0e66..e33a81a0f4 100644 --- a/game/game.js +++ b/game/game.js @@ -10307,8 +10307,27 @@ } case "function": if (gnc.is.generatorFunc(item)) { - // TODO: Parse Generator Function - throw new Error("NYI: Pase Generator Function"); + let gen,lastEvent; + return (event,step,source,player,target,targets,card,cards,skill,forced,num,trigger,result,_status,lib,game,ui,get,ai)=>{ + if(!gen)gen=item(event,{ + event:event, + step:step, + source:source, + player:player, + target:target, + targets:targets, + card:card, + cards:cards, + skill:skill, + forced:forced, + num:num, + trigger:trigger, + result:result + }); + var res=gen.next((lastEvent&&("result" in lastEvent))?lastEvent.result:null); + if(res.done) event.finish(); + else lastEvent=res.value; + } } else return Legacy(item); } From 9ac2a0b1465c00649c30244527c7e2edab10426a Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 18 Sep 2023 17:49:05 +0800 Subject: [PATCH 06/19] =?UTF-8?q?[2023/09/18:=20=E2=91=A2]=20Add=20prework?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New `game.import` uses `document.currentScript` to determine the code caller. If the script is not `game.js`, we put the result to `_status` for `game.js` to wait, otherwise return the promise directly. --- game/game.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/game/game.js b/game/game.js index 47b1ee89f9..439b9c5437 100644 --- a/game/game.js +++ b/game/game.js @@ -29,6 +29,7 @@ } } } + const GameJS=document.currentScript; const GeneratorFunction=(function*(){}).constructor; // gnc: GeNCoroutine const gnc={ @@ -166,6 +167,8 @@ hook:{globaltrigger:{},globalskill:{}}, //函数钩子 hooks:{ + // getCurrentScript用到的接口 + _getCurrentScript:()=>null, // 本体势力的颜色 addGroup:[(id,_short,_name,config)=>{ if("color" in config&&config.color!=null){ @@ -32578,8 +32581,8 @@ '妹子,交个朋友吧', ], other:{ - bool:(item)=>Boolean(item), - ignore:()=>{} + getCurrentScript:()=>document.currentScript||lib.hooks._getCurrentScript(), + ignore:()=>void 0 } }; const game={ From 9f4aaa01d3823713a4ad2d9ec08c548a5eca27ef Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Mon, 18 Sep 2023 17:50:25 +0800 Subject: [PATCH 07/19] muniu icon --- card/extra.js | 1 + character/xianding.js | 2 +- game/game.js | 8 +++++++- image/card/muniu_small.png | Bin 0 -> 6689 bytes mode/identity.js | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 image/card/muniu_small.png diff --git a/card/extra.js b/card/extra.js index 75c0962b5d..98187bd2d0 100644 --- a/card/extra.js +++ b/card/extra.js @@ -604,6 +604,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ }, }, mark:true, + markimage2:'image/card/muniu_small.png', intro:{ content:function(storage,player){ var muniu=player.getEquip('muniu'); diff --git a/character/xianding.js b/character/xianding.js index 6c7ce8a48e..c76af4b5b7 100644 --- a/character/xianding.js +++ b/character/xianding.js @@ -4715,7 +4715,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ countdown:{ trigger:{player:'useCardAfter'}, mark:true, - marktext:'💀', + marktext:'噬', silent:true, forced:true, charlotte:true, diff --git a/game/game.js b/game/game.js index 47b1ee89f9..cba0bfe358 100644 --- a/game/game.js +++ b/game/game.js @@ -24892,6 +24892,11 @@ node.style['box-shadow']='none'; node.style['background-size']='contain'; } + else if(lib.skill[name]&&lib.skill[name].markimage2){ + let img=ui.create.div('.background.skillmark',node); + img.setBackgroundImage(lib.skill[name].markimage2); + img.style['background-size']='contain'; + } else{ var str=lib.translate[name+'_bg']; if(!str||str[0]=='+'||str[0]=='-'){ @@ -46384,7 +46389,8 @@ } } else if(updates[i].indexOf('image/card')==0){ - if(updates[i].indexOf('qiaosi_card')!=11&&!skipcard.contains(updates[i].slice(11,updates[i].lastIndexOf('.')))){ + let cardname=updates[i].slice(11,updates[i].lastIndexOf('.')); + if(lib.card[cardname]&&!skipcard.contains(cardname)){ updates.splice(i--,1); } } diff --git a/image/card/muniu_small.png b/image/card/muniu_small.png new file mode 100644 index 0000000000000000000000000000000000000000..5c71285c44996b2b880a1097a3f4d6fe063a20ca GIT binary patch literal 6689 zcmcgxc{H2byN-FTc_>N*rCKCHNKjg{nunsNN+dx{38IOq=9y~E)X-{CMO%uZremgP zDN0*&i<;-D=#6uF&hOm2e)q0>|G8P~%eTL8Kl|D5`@BQ;T8S|+(qUobX9NHMEPA?{ zX5_ov=|xXV{uWY;E+^j@@VYkM000x`=|us^%H{(AXwPCTtO?eJ1_%_+T?UE9IbdW+ z?szg908mjQ;gKj;3<2nXal(42g4W(Nfq+=FD#%K~5NwFoz&K-d{k$;denu83KUWkS z4N|)dR3RbA1nw9D5=e4)^YBKHR6&36BFN*@*Rmks9}t48D(K4ThCpjW6QBmp3jjNV1=7n}dm}zSN+Kc?8 z3UVe8@CaF1B9SOVgv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9bobs`mf@y$cr7i@aos*Mt7-Bwgq{(?6};4} zu9mp8R2#S=Rg}0qf0)X|yxj!oDy#L=R;lyW9~!oZnR}4xuoh(bwdtV#NV?gnvf74< pi}J&r Date: Mon, 18 Sep 2023 18:23:53 +0800 Subject: [PATCH 08/19] =?UTF-8?q?chooseToMove=20=E6=8B=96=E6=8B=BD+?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E6=95=88=E6=9E=9C=EF=BC=8C=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E7=89=88=E6=97=A0=E6=B3=95=E6=8B=96=E6=8B=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 130 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 125 insertions(+), 5 deletions(-) diff --git a/game/game.js b/game/game.js index cba0bfe358..ef1437207d 100644 --- a/game/game.js +++ b/game/game.js @@ -12149,6 +12149,66 @@ event.moved=[]; var buttonss=[]; event.buttonss=buttonss; + event.isPlayingAnimation=false; + //已经处理了拖拽结束 + var isDragEnd=false; + var dragstart=function(e){ + if(ui.selected.guanxing_button){ + ui.selected.guanxing_button.classList.remove('glow2'); + } + ui.selected.guanxing_button=this; + this.classList.add('glow2'); + isDragEnd=false; + e.stopPropagation(); + }; + var dragend=function(e){ + if(ui.selected.guanxing_button){ + ui.selected.guanxing_button.classList.remove('glow2'); + delete ui.selected.guanxing_button; + } + isDragEnd=true; + }; + var cardDrop=function(e){ + if(isDragEnd)return; + isDragEnd=true; + event.custom.replace.button(this); + }; + var buttonDrop=function(e){ + if(isDragEnd)return; + isDragEnd=true; + if(!this.hasChildNodes()){ + clickButtons.call(this); + }else{ + var xs=Array.from(this.children).map(c=>c.getBoundingClientRect().left); + var x=e.x; + var index=xs.findIndex(_x=>x<_x); + //FLIP + //First + ui.selected.guanxing_button.style.transition='none'; + var guanxingRect=ui.selected.guanxing_button.getBoundingClientRect(); + //Last + if(index==-1){ + this.appendChild(ui.selected.guanxing_button); + }else{ + this.insertBefore(ui.selected.guanxing_button, this.children[index]); + } + var guanxingRect2=ui.selected.guanxing_button.getBoundingClientRect(); + //Invert + ui.selected.guanxing_button.style.transform=`translateX(${guanxingRect.left-guanxingRect2.left}px) translateY(${guanxingRect.top-guanxingRect2.top}px)`; + console.log(ui.selected.guanxing_button.style.transform); + //Play + event.isPlayingAnimation=true; + setTimeout((guanxing_button)=>{ + guanxing_button.style.transition=''; + guanxing_button.style.transform='translateX(0px) translateY(0px)'; + delete ui.selected.guanxing_button; + guanxing_button.addEventListener('transitionend',function(){ + event.isPlayingAnimation=false; + updateButtons(); + },{once:true}); + },0,ui.selected.guanxing_button); + } + }; var updateButtons=function(){ for(var i of buttonss){ event.moved[i._link]=get.links(Array.from(i.childNodes)); @@ -12163,13 +12223,33 @@ } }; var clickButtons=function(){ + if(event.isPlayingAnimation) return; if(!ui.selected.guanxing_button) return; if(ui.selected.guanxing_button.parentNode==this) return; if(!filterMove(ui.selected.guanxing_button,this._link,event.moved)) return; ui.selected.guanxing_button.classList.remove('glow2'); + //FLIP + //First + ui.selected.guanxing_button.style.transition='none'; + if(ui.selected.guanxing_button.style.transform) ui.selected.guanxing_button.style.transform='translateX(0px) translateY(0px)'; + var guanxingRect=ui.selected.guanxing_button.getBoundingClientRect(); + //Last this.appendChild(ui.selected.guanxing_button); - delete ui.selected.guanxing_button; - updateButtons(); + var guanxingRect2=ui.selected.guanxing_button.getBoundingClientRect(); + //Invert + ui.selected.guanxing_button.style.transform=`translateX(${guanxingRect.left-guanxingRect2.left}px) translateY(${guanxingRect.top-guanxingRect2.top}px)`; + //Play + event.isPlayingAnimation=true; + setTimeout((guanxing_button)=>{ + guanxing_button.style.transition=''; + guanxing_button.style.transform='translateX(0px) translateY(0px)'; + delete ui.selected.guanxing_button; + guanxing_button.addEventListener('transitionend',function(){ + event.isPlayingAnimation=false; + updateButtons(); + },{once:true}); + + },0,ui.selected.guanxing_button); }; for(var i=0;ie.preventDefault()); + buttons.addEventListener('drop', buttonDrop); + } if(list[i][1]){ if(get.itemtype(list[i][1])=='cards'){ var cardsb=ui.create.buttons(list[i][1],'card',buttons); + if(!navigator.userAgent.includes('Mobile ')) cardsb.forEach(card => { + card.draggable=true; + card.addEventListener('dragstart',dragstart); + card.addEventListener('dragover',e=>e.preventDefault()); + card.addEventListener('dragend',dragend); + card.addEventListener('drop', cardDrop); + }); if(list[i][2]&&typeof list[i][2]=='string'){ for(var ij of cardsb) ij.node.gaintag.innerHTML=get.translation(list[i][2]); } @@ -12213,12 +12304,41 @@ return; } if(!filterMove(button,ui.selected.guanxing_button,event.moved)) return; - var par1=ui.selected.guanxing_button.parentNode,ind1=ui.selected.guanxing_button.nextSibling,par2=button.parentNode,ind2=button.nextSibling; + var par1=ui.selected.guanxing_button.parentNode, + ind1=ui.selected.guanxing_button.nextSibling, + par2=button.parentNode, + ind2=button.nextSibling; ui.selected.guanxing_button.classList.remove('glow2'); + //FLIP + //First + button.style.transition='none'; + ui.selected.guanxing_button.style.transition='none'; + if(button.style.transform) button.style.transform='translateX(0px) translateY(0px)'; + if(ui.selected.guanxing_button.style.transform) ui.selected.guanxing_button.style.transform='translateX(0px) translateY(0px)'; + var buttonRect=button.getBoundingClientRect(); + var guanxingRect=ui.selected.guanxing_button.getBoundingClientRect(); par1.insertBefore(button,ind1); par2.insertBefore(ui.selected.guanxing_button,ind2); - delete ui.selected.guanxing_button; - updateButtons(); + //Last + var buttonRect2=button.getBoundingClientRect(); + var guanxingRect2=ui.selected.guanxing_button.getBoundingClientRect(); + //Invert + button.style.transform=`translateX(${buttonRect.left-buttonRect2.left}px) translateY(${buttonRect.top-buttonRect2.top}px)`; + ui.selected.guanxing_button.style.transform=`translateX(${guanxingRect.left-guanxingRect2.left}px) translateY(${guanxingRect.top-guanxingRect2.top}px)`; + //Play + event.isPlayingAnimation=true; + setTimeout((button,guanxing_button)=>{ + button.style.transition=''; + guanxing_button.style.transition=''; + + button.style.transform='translateX(0px) translateY(0px)'; + guanxing_button.style.transform='translateX(0px) translateY(0px)'; + delete ui.selected.guanxing_button; + guanxing_button.addEventListener('transitionend',function(){ + event.isPlayingAnimation=false; + updateButtons(); + },{once:true}); + },0,button,ui.selected.guanxing_button); } event.custom.replace.confirm=function(bool){ if(bool) event._result={ From e530ae82b9f3bbcd735e1a962c3984bf2e981ae6 Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Mon, 18 Sep 2023 18:42:20 +0800 Subject: [PATCH 09/19] =?UTF-8?q?Revert=20"chooseToMove=20=E6=8B=96?= =?UTF-8?q?=E6=8B=BD+=E5=8A=A8=E7=94=BB=E6=95=88=E6=9E=9C=EF=BC=8C?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=89=88=E6=97=A0=E6=B3=95=E6=8B=96=E6=8B=BD?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 130 ++------------------------------------------------- 1 file changed, 5 insertions(+), 125 deletions(-) diff --git a/game/game.js b/game/game.js index ef1437207d..cba0bfe358 100644 --- a/game/game.js +++ b/game/game.js @@ -12149,66 +12149,6 @@ event.moved=[]; var buttonss=[]; event.buttonss=buttonss; - event.isPlayingAnimation=false; - //已经处理了拖拽结束 - var isDragEnd=false; - var dragstart=function(e){ - if(ui.selected.guanxing_button){ - ui.selected.guanxing_button.classList.remove('glow2'); - } - ui.selected.guanxing_button=this; - this.classList.add('glow2'); - isDragEnd=false; - e.stopPropagation(); - }; - var dragend=function(e){ - if(ui.selected.guanxing_button){ - ui.selected.guanxing_button.classList.remove('glow2'); - delete ui.selected.guanxing_button; - } - isDragEnd=true; - }; - var cardDrop=function(e){ - if(isDragEnd)return; - isDragEnd=true; - event.custom.replace.button(this); - }; - var buttonDrop=function(e){ - if(isDragEnd)return; - isDragEnd=true; - if(!this.hasChildNodes()){ - clickButtons.call(this); - }else{ - var xs=Array.from(this.children).map(c=>c.getBoundingClientRect().left); - var x=e.x; - var index=xs.findIndex(_x=>x<_x); - //FLIP - //First - ui.selected.guanxing_button.style.transition='none'; - var guanxingRect=ui.selected.guanxing_button.getBoundingClientRect(); - //Last - if(index==-1){ - this.appendChild(ui.selected.guanxing_button); - }else{ - this.insertBefore(ui.selected.guanxing_button, this.children[index]); - } - var guanxingRect2=ui.selected.guanxing_button.getBoundingClientRect(); - //Invert - ui.selected.guanxing_button.style.transform=`translateX(${guanxingRect.left-guanxingRect2.left}px) translateY(${guanxingRect.top-guanxingRect2.top}px)`; - console.log(ui.selected.guanxing_button.style.transform); - //Play - event.isPlayingAnimation=true; - setTimeout((guanxing_button)=>{ - guanxing_button.style.transition=''; - guanxing_button.style.transform='translateX(0px) translateY(0px)'; - delete ui.selected.guanxing_button; - guanxing_button.addEventListener('transitionend',function(){ - event.isPlayingAnimation=false; - updateButtons(); - },{once:true}); - },0,ui.selected.guanxing_button); - } - }; var updateButtons=function(){ for(var i of buttonss){ event.moved[i._link]=get.links(Array.from(i.childNodes)); @@ -12223,33 +12163,13 @@ } }; var clickButtons=function(){ - if(event.isPlayingAnimation) return; if(!ui.selected.guanxing_button) return; if(ui.selected.guanxing_button.parentNode==this) return; if(!filterMove(ui.selected.guanxing_button,this._link,event.moved)) return; ui.selected.guanxing_button.classList.remove('glow2'); - //FLIP - //First - ui.selected.guanxing_button.style.transition='none'; - if(ui.selected.guanxing_button.style.transform) ui.selected.guanxing_button.style.transform='translateX(0px) translateY(0px)'; - var guanxingRect=ui.selected.guanxing_button.getBoundingClientRect(); - //Last this.appendChild(ui.selected.guanxing_button); - var guanxingRect2=ui.selected.guanxing_button.getBoundingClientRect(); - //Invert - ui.selected.guanxing_button.style.transform=`translateX(${guanxingRect.left-guanxingRect2.left}px) translateY(${guanxingRect.top-guanxingRect2.top}px)`; - //Play - event.isPlayingAnimation=true; - setTimeout((guanxing_button)=>{ - guanxing_button.style.transition=''; - guanxing_button.style.transform='translateX(0px) translateY(0px)'; - delete ui.selected.guanxing_button; - guanxing_button.addEventListener('transitionend',function(){ - event.isPlayingAnimation=false; - updateButtons(); - },{once:true}); - - },0,ui.selected.guanxing_button); + delete ui.selected.guanxing_button; + updateButtons(); }; for(var i=0;ie.preventDefault()); - buttons.addEventListener('drop', buttonDrop); - } if(list[i][1]){ if(get.itemtype(list[i][1])=='cards'){ var cardsb=ui.create.buttons(list[i][1],'card',buttons); - if(!navigator.userAgent.includes('Mobile ')) cardsb.forEach(card => { - card.draggable=true; - card.addEventListener('dragstart',dragstart); - card.addEventListener('dragover',e=>e.preventDefault()); - card.addEventListener('dragend',dragend); - card.addEventListener('drop', cardDrop); - }); if(list[i][2]&&typeof list[i][2]=='string'){ for(var ij of cardsb) ij.node.gaintag.innerHTML=get.translation(list[i][2]); } @@ -12304,41 +12213,12 @@ return; } if(!filterMove(button,ui.selected.guanxing_button,event.moved)) return; - var par1=ui.selected.guanxing_button.parentNode, - ind1=ui.selected.guanxing_button.nextSibling, - par2=button.parentNode, - ind2=button.nextSibling; + var par1=ui.selected.guanxing_button.parentNode,ind1=ui.selected.guanxing_button.nextSibling,par2=button.parentNode,ind2=button.nextSibling; ui.selected.guanxing_button.classList.remove('glow2'); - //FLIP - //First - button.style.transition='none'; - ui.selected.guanxing_button.style.transition='none'; - if(button.style.transform) button.style.transform='translateX(0px) translateY(0px)'; - if(ui.selected.guanxing_button.style.transform) ui.selected.guanxing_button.style.transform='translateX(0px) translateY(0px)'; - var buttonRect=button.getBoundingClientRect(); - var guanxingRect=ui.selected.guanxing_button.getBoundingClientRect(); par1.insertBefore(button,ind1); par2.insertBefore(ui.selected.guanxing_button,ind2); - //Last - var buttonRect2=button.getBoundingClientRect(); - var guanxingRect2=ui.selected.guanxing_button.getBoundingClientRect(); - //Invert - button.style.transform=`translateX(${buttonRect.left-buttonRect2.left}px) translateY(${buttonRect.top-buttonRect2.top}px)`; - ui.selected.guanxing_button.style.transform=`translateX(${guanxingRect.left-guanxingRect2.left}px) translateY(${guanxingRect.top-guanxingRect2.top}px)`; - //Play - event.isPlayingAnimation=true; - setTimeout((button,guanxing_button)=>{ - button.style.transition=''; - guanxing_button.style.transition=''; - - button.style.transform='translateX(0px) translateY(0px)'; - guanxing_button.style.transform='translateX(0px) translateY(0px)'; - delete ui.selected.guanxing_button; - guanxing_button.addEventListener('transitionend',function(){ - event.isPlayingAnimation=false; - updateButtons(); - },{once:true}); - },0,button,ui.selected.guanxing_button); + delete ui.selected.guanxing_button; + updateButtons(); } event.custom.replace.confirm=function(bool){ if(bool) event._result={ From 0a2ab57ab8cb712cb90a4bee6a0af14d0af1e376 Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 18 Sep 2023 18:49:56 +0800 Subject: [PATCH 10/19] =?UTF-8?q?[2023/09/18:=20=E2=91=A2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/game/game.js b/game/game.js index 439b9c5437..6692557097 100644 --- a/game/game.js +++ b/game/game.js @@ -168,7 +168,7 @@ //函数钩子 hooks:{ // getCurrentScript用到的接口 - _getCurrentScript:()=>null, + _getCurrentScript:(_url)=>null, // 本体势力的颜色 addGroup:[(id,_short,_name,config)=>{ if("color" in config&&config.color!=null){ @@ -7278,31 +7278,31 @@ } }, comparator:{ - e:function(){ + equals:function(){ if(arguments.length==0) return false; if(arguments.length==1) return true; for(let i=1;i[], set:()=>null }); - Object.defineProperty(lib.creation,"o",{ + Object.defineProperty(lib.creation,"object",{ enumerable:true, get:()=>({}), set:()=>null }); - Object.defineProperty(lib.creation,"no",{ + Object.defineProperty(lib.creation,"nullObject",{ enumerable:true, get:()=>Object.create(null), set:()=>null }); - Object.defineProperty(lib.creation,"s",{ + Object.defineProperty(lib.creation,"string",{ enumerable:true, get:()=>"", set:()=>null @@ -32581,7 +32581,7 @@ '妹子,交个朋友吧', ], other:{ - getCurrentScript:()=>document.currentScript||lib.hooks._getCurrentScript(), + getCurrentScript:(url)=>document.currentScript||lib.hooks._getCurrentScript(url), ignore:()=>void 0 } }; @@ -32622,15 +32622,15 @@ //基于钩子的添加势力方法 addGroup:(id,short,name,config)=>{ if(!id) throw new TypeError(); - if(lib.comparator.te(short,"object")){ + if(lib.comparator.typeEquals(short,"object")){ config=short; short=null; } - if(lib.comparator.te(name,"object")){ + if(lib.comparator.typeEquals(name,"object")){ config=name; name=null; } - if(!lib.comparator.te(short,"string")&&short){ + if(!lib.comparator.typeEquals(short,"string")&&short){ name=short; } lib.group.add(id); @@ -33799,25 +33799,26 @@ } } }, - import:function(type,content){ + import:function(type,content,url){ + const currentScript = lib.other.getCurrentScript(url); if(type=='extension'){ - if(typeof _status.extensionLoading=="undefined")_status.extensionLoading=[]; const promise=game.loadExtension(content); + if(lib.comparator.equalAny(currentScript, null, GameJS)) return promise; + if(typeof _status.extensionLoading=="undefined")_status.extensionLoading=[]; _status.extensionLoading.add(promise); - return promise; } else{ if(!lib.imported[type])lib.imported[type]={}; - if(typeof _status.importing=="undefined")_status.importing={}; - if(!_status.importing[type])_status.importing[type]=[]; const promise=Promise.resolve((gnc.is.generator(content)?gnc.of(content):content)(lib,game,ui,get,ai,_status)).then(content2=>{ if(content2.name){ lib.imported[type][content2.name]=content2; delete content2.name; } }); + if(lib.comparator.equalAny(currentScript, null, GameJS)) return promise; + if(typeof _status.importing=="undefined")_status.importing={}; + if(!_status.importing[type])_status.importing[type]=[]; _status.importing[type].add(promise); - return promise; } }, loadExtension:gnc.of(function*(obj){ @@ -34107,9 +34108,7 @@ var str=zip.file('extension.js').asText(); if(str===""||undefined) throw('你导入的不是扩展!请选择正确的文件'); _status.importingExtension=true; - eval(str); - yield Promise.allSettled(_status.extensionLoading); - delete _status.extensionLoading; + yield eval(str); _status.importingExtension=false; if(!game.importedPack) throw('err'); var extname=game.importedPack.name; From 6b55691d394f23478e9f0245f4250de920442d6e Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 18 Sep 2023 19:11:02 +0800 Subject: [PATCH 11/19] =?UTF-8?q?[2023/09/18:=20=E2=91=A2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/game/game.js b/game/game.js index 6692557097..2b51c38a8c 100644 --- a/game/game.js +++ b/game/game.js @@ -9727,7 +9727,7 @@ _status.extension=lib.extensions[i][0]; _status.evaluatingExtension=lib.extensions[i][3]; if (typeof lib.extensions[i][1]=="function") - yield (gnc.is.coroutine(lib.extensions[i][1])?gnc.of(lib.extensions[i][1]):lib.extensions[i][1])(lib.extensions[i][2],lib.extensions[i][4]); + yield (gnc.is.coroutine(lib.extensions[i][1])?gnc.of(lib.extensions[i][1]):lib.extensions[i][1]).call(lib.extensions[i],lib.extensions[i][2],lib.extensions[i][4]); if(lib.extensions[i][4]){ if(lib.extensions[i][4].character){ for(var j in lib.extensions[i][4].character.character){ @@ -10019,8 +10019,7 @@ js:(path,file,onload,onerror)=>{ if(path[path.length-1]=='/') path=path.slice(0,path.length-1); if(path==`${lib.assetURL}mode`&&lib.config.all.stockmode.indexOf(file)==-1){ - lib.init[`setMode_${file}`](); - onload(); + lib.genAwait(lib.init[`setMode_${file}`]()).then(onload); return; } if(Array.isArray(file)){ @@ -33942,7 +33941,7 @@ } if(obj.precontent){ _status.extension=obj.name; - yield (gnc.is.generatorFunc(obj.precontent)?gnc.of(obj.precontent):obj.precontent)(cfg); + yield (gnc.is.generatorFunc(obj.precontent)?gnc.of(obj.precontent):obj.precontent).call(obj,cfg); delete _status.extension; } if(obj.content){ @@ -36591,12 +36590,12 @@ splash:imgsrc, fromextension:true } - lib.init['setMode_'+name]=function(){ - game.import('mode',function(lib,game,ui,get,ai,_status){ + lib.init['setMode_'+name]=gnc.of(function*(){ + yield game.import('mode',function(lib,game,ui,get,ai,_status){ info.name=name; return info; }); - } + }); if(!lib.config.extensionInfo[extname]){ lib.config.extensionInfo[extname]={}; } @@ -38299,7 +38298,8 @@ }, loadModeAsync:function(name,callback){ window.game=game; - var script=lib.init.js(lib.assetURL+'mode',name,function(){ + var script=lib.init.js(lib.assetURL+'mode',name,gnc.of(function*(){ + yield Promise.allSettled(_status.importing.mode); if(!lib.config.dev) delete window.game; script.remove(); var content=lib.imported.mode[name]; @@ -38308,7 +38308,7 @@ delete lib.imported.mode; } callback(content); - }); + })); }, switchMode:function(name,configx){ if(!lib.layoutfixed.contains(name)){ @@ -38322,7 +38322,8 @@ } } window.game=game; - var script=lib.init.js(lib.assetURL+'mode',name,function(){ + var script=lib.init.js(lib.assetURL+'mode',name,gnc.of(function*(){ + yield Promise.allSettled(_status.importing.mode); if(!lib.config.dev) delete window.game; script.remove(); var mode=lib.imported.mode; @@ -38497,7 +38498,7 @@ game.loop(); }); } - }); + })); }, loadMode:function(mode){ var next=game.createEvent('loadMode',false); From 0be236560a68c66dfdaf441394a64a391ef420dc Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 18 Sep 2023 19:11:25 +0800 Subject: [PATCH 12/19] =?UTF-8?q?[2023/09/18:=20=E2=91=A2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game/game.js b/game/game.js index 2b51c38a8c..1b46390f04 100644 --- a/game/game.js +++ b/game/game.js @@ -1,5 +1,5 @@ "use strict"; -(()=>{ +{ if(!localStorage.getItem('gplv3_noname_alerted')){ if(confirm('①无名杀是一款基于GPLv3协议的开源软件!\n你可以在遵守GPLv3协议的基础上任意使用,修改并转发《无名杀》,以及所有基于《无名杀》开发的拓展。\n点击“确定”即代表您认可并接受GPLv3协议↓️\nhttps://www.gnu.org/licenses/gpl-3.0.html\n②无名杀官方发布地址仅有GitHub仓库!\n其他所有的所谓“无名杀”社群(包括但不限于绝大多数“官方”QQ群、QQ频道等)均为玩家自发组织,与无名杀官方无关!')){ localStorage.setItem('gplv3_noname_alerted',true); @@ -59059,4 +59059,4 @@ get:get }; lib.init.init(); -})(); +} From 01044af9313c226e8c7ef66f1e7b4a78b1fc345d Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 18 Sep 2023 19:20:25 +0800 Subject: [PATCH 13/19] =?UTF-8?q?[2023/09/18:=20=E2=91=A3]=20Revert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/game/game.js b/game/game.js index 1b46390f04..c41382d8a7 100644 --- a/game/game.js +++ b/game/game.js @@ -29,7 +29,6 @@ } } } - const GameJS=document.currentScript; const GeneratorFunction=(function*(){}).constructor; // gnc: GeNCoroutine const gnc={ @@ -167,8 +166,6 @@ hook:{globaltrigger:{},globalskill:{}}, //函数钩子 hooks:{ - // getCurrentScript用到的接口 - _getCurrentScript:(_url)=>null, // 本体势力的颜色 addGroup:[(id,_short,_name,config)=>{ if("color" in config&&config.color!=null){ @@ -32580,7 +32577,6 @@ '妹子,交个朋友吧', ], other:{ - getCurrentScript:(url)=>document.currentScript||lib.hooks._getCurrentScript(url), ignore:()=>void 0 } }; @@ -33799,12 +33795,11 @@ } }, import:function(type,content,url){ - const currentScript = lib.other.getCurrentScript(url); if(type=='extension'){ const promise=game.loadExtension(content); - if(lib.comparator.equalAny(currentScript, null, GameJS)) return promise; if(typeof _status.extensionLoading=="undefined")_status.extensionLoading=[]; _status.extensionLoading.add(promise); + return promise; } else{ if(!lib.imported[type])lib.imported[type]={}; @@ -33814,10 +33809,10 @@ delete content2.name; } }); - if(lib.comparator.equalAny(currentScript, null, GameJS)) return promise; if(typeof _status.importing=="undefined")_status.importing={}; if(!_status.importing[type])_status.importing[type]=[]; _status.importing[type].add(promise); + return promise; } }, loadExtension:gnc.of(function*(obj){ @@ -34107,7 +34102,9 @@ var str=zip.file('extension.js').asText(); if(str===""||undefined) throw('你导入的不是扩展!请选择正确的文件'); _status.importingExtension=true; - yield eval(str); + eval(str); + yield Promise.allSettled(_status.extensionLoading); + delete _status.extensionLoading; _status.importingExtension=false; if(!game.importedPack) throw('err'); var extname=game.importedPack.name; From e91a589bc8c592a66b5f14114764ecbd52f00ad8 Mon Sep 17 00:00:00 2001 From: lieren2023 <131325076+lieren2023@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:43:28 +0800 Subject: [PATCH 14/19] Minor fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整菜单显示开关顺序 --- game/game.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/game/game.js b/game/game.js index f2bec4cbfe..b8afbd08b3 100644 --- a/game/game.js +++ b/game/game.js @@ -3938,17 +3938,17 @@ init:true, unfrequent:true, }, - show_skillnamepinyin:{ - name:'显示技能名拼音', - intro:'在武将资料卡显示技能名拼音', - init:true, - unfrequent:true, - }, show_characternamepinyin:{ name:'显示武将名拼音等信息', intro:'在武将资料卡显示武将名及其拼音、性别、势力、体力等信息', init:true, unfrequent:true, + }, + show_skillnamepinyin:{ + name:'显示技能名拼音', + intro:'在武将资料卡显示技能名拼音', + init:true, + unfrequent:true, } } }, From 8f6adf3fde3994e9b9df6348f9e85eab069907bf Mon Sep 17 00:00:00 2001 From: lieren2023 <131325076+lieren2023@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:46:37 +0800 Subject: [PATCH 15/19] Minor fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 回滚武将/卡牌全部禁用等按钮样式 --- layout/default/layout.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/default/layout.css b/layout/default/layout.css index 83ffe267ac..fe1b9338f0 100644 --- a/layout/default/layout.css +++ b/layout/default/layout.css @@ -1743,7 +1743,7 @@ div:not(.handcards)>.card>.info>span, margin-left: 4px; margin-right: 4px; position: relative; - width: calc(100% - 8px); + /* width: calc(100% - 8px); */ } .content>.caption + .buttons:not(*:last-child){ margin-top: 0; From b1bf033c36e8b270ade9ef7f62b81da699ea32de Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Mon, 18 Sep 2023 20:53:48 +0800 Subject: [PATCH 16/19] update sp.js --- character/sp.js | 7 +++++-- game/game.js | 30 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/character/sp.js b/character/sp.js index fa991e9209..dea68d8f16 100755 --- a/character/sp.js +++ b/character/sp.js @@ -1098,7 +1098,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, charlotte:true, filter:(event,player)=>{ - if(!event.olqifan_discard) return false; + return true; var num=player.getStorage('olqifan').length,pos=('jeh').slice(0,num); return num>0&&player.countCards(pos)>0; }, @@ -1122,14 +1122,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){ else card=get.autoViewAs({name,isCard:true}); event.result.card=card; player.markAuto('olqifan',[get.type2(card,false)]); - event.getParent().set('olqifan_discard',true); + var id=get.id(); + event.getParent().set('olqifan_discard',id); player.when('chooseToUseAfter') .filter(lib.skill.olqifan_discard.filter) + .filter((event)=>event.olqifan_discard==id) .then(()=>{ event.maxNum=Math.min(3,player.getStorage('olqifan').length); event.num=0; }) .then(lib.skill.olqifan_discard.content) + .translation('器翻'); }, filterCard:function(){return false}, selectCard:-1, diff --git a/game/game.js b/game/game.js index 6a054fbc6d..0e6f224d33 100644 --- a/game/game.js +++ b/game/game.js @@ -19232,6 +19232,18 @@ * 使用者只需要关注技能的效果,而不是技能的本身。 */ when:function(){ + if(!_status.postReconnect.player_when) _status.postReconnect.player_when=[ + function(map){ + for(var i in map){ + lib.skill[i]={ + charlotte:true, + forced:true, + popup:false, + } + if(typeof map[i]=='string') lib.translate[i]=map[i]; + } + },{} + ]; var triggerNames=Array.from(arguments); if(triggerNames.length==0) throw 'player.when的参数数量应大于0'; var skillName='player_when_'+Math.random().toString(36).slice(-8); @@ -19265,7 +19277,20 @@ writable:true, value:skill }); + game.broadcast(function(skillName){ + Object.defineProperty(lib.skill,skillName,{ + configurable:true, + enumerable:false, + writable:true, + value:{ + forced:true, + charlotte:true, + popup:false, + } + }); + },skillName); this.addSkill(skillName); + _status.postReconnect.player_when[1][skillName]=true; return{ filter(fun){ if(lib.skill[skillName]!=skill) throw `This skill has been destroyed`; @@ -19306,7 +19331,10 @@ }, translation(translation){ if(lib.skill[skillName]!=skill) throw `This skill has been destroyed`; - if(typeof translation=='string') lib.translate[skillName]=translation; + if(typeof translation=='string'){ + _status.postReconnect.player_when[1][skillName]=translation; + game.broadcastAll((skillName,translation)=>lib.translate[skillName]=translation,skillName,translation) + } return this; }, assgin(obj) { From 835c95fd8cd2ab1da21f292851f71f2aa4155913 Mon Sep 17 00:00:00 2001 From: Tipx-L <138244655+Tipx-L@users.noreply.github.com> Date: Mon, 18 Sep 2023 05:55:09 -0700 Subject: [PATCH 17/19] Fix and format the CSS. --- layout/mode/boss.css | 261 ++++++++++++++++++++++++------------------- 1 file changed, 148 insertions(+), 113 deletions(-) diff --git a/layout/mode/boss.css b/layout/mode/boss.css index 71bde7c454..275819f7e8 100644 --- a/layout/mode/boss.css +++ b/layout/mode/boss.css @@ -1,148 +1,183 @@ -#bosslist{ - width:100%; - height:260px; - text-align:center; - top:calc(50% - 200px); - top:60px; - white-space:nowrap; - z-index:1; - overflow-x:scroll; -} -#window[data-radius_size='reduce'] #bosslist>.player{ - border-radius:4px; -} -#window[data-radius_size='off'] #bosslist>.player{ - border-radius:0px; -} -#window[data-radius_size='increase'] #bosslist>.player{ - border-radius:20px; -} -#window #bosslist>.player{ - border-radius: 10px; -} -#window[data-player_border='normal'] #bosslist>.player>.avatar{ - left: 8px; - top: 8px; - width: 164px; - height: 200px; -} -#window[data-player_border='slim'] #bosslist>.player>.avatar{ - left: 4px; - top: 4px; - width: 172px; - height: 208px; +#bosslist { + width: 100%; + height: 260px; + text-align: center; + top: calc(50% - 200px); + top: 60px; + white-space: nowrap; + z-index: 1; + overflow-x: scroll; } + +#window[data-radius_size='reduce'] #bosslist>.player { + border-radius: 4px; +} + +#window[data-radius_size='off'] #bosslist>.player { + border-radius: 0px; +} + +#window[data-radius_size='increase'] #bosslist>.player { + border-radius: 20px; +} + +#window #bosslist>.player { + border-radius: 10px; +} + +#window[data-player_border='normal'] #bosslist>.player>.avatar { + left: 8px; + top: 8px; + width: 164px; + height: 200px; +} + +#window[data-player_border='slim'] #bosslist>.player>.avatar { + left: 4px; + top: 4px; + width: 172px; + height: 208px; +} + .bosspaused>#bosslist, .bosspaused>#control, -.bosspaused>.dialog.bosscharacter{ - opacity:0.2 !important; +.bosspaused>.dialog.bosscharacter { + opacity: 0.2 !important; } -#bosslist.hidden>.player{ - transition:all 0s; + +#bosslist.hidden>.player { + transition: all 0s; } + #bosslist>div:first-child, -#bosslist>div:last-child{ - width:20px; - position:relative; +#bosslist>div:last-child { + width: 20px; + position: relative; } -#window:not(.nopointer) #bosslist>.player{ - cursor: pointer; + +#bosslist>.player .identity { + align-items: flex-start; +} + +#bosslist>.player .identity>div { + writing-mode: vertical-rl; + -webkit-writing-mode: vertical-rl; +} + +#window:not(.nopointer) #bosslist>.player { + cursor: pointer; } -.dialog.bosscharacter .buttons .button.selectable{ + +.dialog.bosscharacter .buttons .button.selectable { cursor: pointer; } -.dialog.bosscharacter .buttons .button:not(.selectable){ - opacity: 0.6 + +.dialog.bosscharacter .buttons .button:not(.selectable) { + opacity: 0.6 } -.player.bossplayer.bossing{ - position:absolute; +.player.bossplayer.bossing { + position: absolute; } -.player.bossing .avatar{ - transition:all 0.5s; + +.player.bossing .avatar { + transition: all 0.5s; } -.player.bossplayer.highlight{ - transform:scale(1.1); - opacity:1; + +.player.bossplayer.highlight { + transform: scale(1.1); + opacity: 1; } -#bosslist.removing>.player.bossplayer.highlight{ - transition:all 0s; - opacity:0; + +#bosslist.removing>.player.bossplayer.highlight { + transition: all 0s; + opacity: 0; } -.player.bossplayer{ - position:relative; - margin:10px; - left:0; - top:4px; - width:180px; - height:216px; - transition: all 0.3s; - opacity:0.6; - animation:game_start 0.5s; - -webkit-animation:game_start 0.5s; + +.player.bossplayer { + position: relative; + margin: 10px; + left: 0; + top: 4px; + width: 180px; + height: 216px; + transition: all 0.3s; + opacity: 0.6; + animation: game_start 0.5s; + -webkit-animation: game_start 0.5s; } -.player.bossplayer>div:not(.hp):not(.identity):not(.avatar):not(.framebg){ - display:none !important; + +.player.bossplayer>div:not(.hp):not(.identity):not(.avatar):not(.framebg) { + display: none !important; } -.player.bossplayer>.identity{ - left:16px; - top:20px; - line-height:24px; - white-space:normal; + +.player.bossplayer>.identity { + left: 16px; + top: 18px; + line-height: 24px; + white-space: normal; } -.player.bossplayer>.hp{ - top:22px; - left:144px; + +.player.bossplayer>.hp { + top: 22px; + left: 144px; } -.player.bossplayer>.avatar{ - width:160px; - height:196px; + +.player.bossplayer>.avatar { + width: 160px; + height: 196px; } -#control.bosslist{ - top:calc(100% - 50px) !important; - position:fixed; +#control.bosslist { + top: calc(100% - 50px) !important; + position: fixed; } -.dialog.bosscharacter{ - top:auto; - bottom:65px; - height:calc(100% - 383px); - animation: dialog_start2 0.5s; +.dialog.bosscharacter { + top: auto; + bottom: 65px; + height: calc(100% - 383px); + animation: dialog_start2 0.5s; -webkit-animation: dialog_start2 0.5s; } -.bosschongzheng{ - width:calc(100% - 20px); - white-space:nowrap; - position:relative; +.bosschongzheng { + width: calc(100% - 20px); + white-space: nowrap; + position: relative; } -.bosschongzheng div{ - position:relative; + +.bosschongzheng div { + position: relative; } -.bosschongzheng>div{ - width:100%; - display:block; - margin-bottom:5px; + +.bosschongzheng>div { + width: 100%; + display: block; + margin-bottom: 5px; } -.bosschongzheng>div>div:first-child{ - text-align:left; - width:30%; + +.bosschongzheng>div>div:first-child { + text-align: left; + width: 30%; } -.bosschongzheng>div>div:last-child{ - text-align:right; - width:70%; + +.bosschongzheng>div>div:last-child { + text-align: right; + width: 70%; } @media screen and (min-height: 800px) { - .dialog.bosscharacter{ - height:417px; - bottom:calc(50% - 335px); + .dialog.bosscharacter { + height: 417px; + bottom: calc(50% - 335px); } - #control.bosslist{ - top:calc(50% + 350px) !important; - } - #bosslist{ - top:calc(40% - 260px); - } -} + + #control.bosslist { + top: calc(50% + 350px) !important; + } + + #bosslist { + top: calc(40% - 260px); + } +} \ No newline at end of file From 9ae9cd556a07766b63416be80572812f8f88ff69 Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Mon, 18 Sep 2023 20:57:34 +0800 Subject: [PATCH 18/19] update sp2.js --- character/sp.js | 4 +--- character/sp2.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/character/sp.js b/character/sp.js index dea68d8f16..521bdb11aa 100755 --- a/character/sp.js +++ b/character/sp.js @@ -1098,7 +1098,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, charlotte:true, filter:(event,player)=>{ - return true; var num=player.getStorage('olqifan').length,pos=('jeh').slice(0,num); return num>0&&player.countCards(pos)>0; }, @@ -1123,10 +1122,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ event.result.card=card; player.markAuto('olqifan',[get.type2(card,false)]); var id=get.id(); - event.getParent().set('olqifan_discard',id); player.when('chooseToUseAfter') + .filter((evt)=>evt==event.getParent()) .filter(lib.skill.olqifan_discard.filter) - .filter((event)=>event.olqifan_discard==id) .then(()=>{ event.maxNum=Math.min(3,player.getStorage('olqifan').length); event.num=0; diff --git a/character/sp2.js b/character/sp2.js index 623dd000a7..a73de5d081 100644 --- a/character/sp2.js +++ b/character/sp2.js @@ -2045,7 +2045,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=trigger.target; event.target=target; trigger.targets.remove(target); - trigger.triggeredTargets1.remove(target); + //trigger.triggeredTargets1.remove(target); trigger.untrigger(); game.delayx(); 'step 1' From 8682cd0808a96a1e59447fea677cbf0fc5af79e3 Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Mon, 18 Sep 2023 21:02:48 +0800 Subject: [PATCH 19/19] v1.10.1.0.1 metadata --- game/asset.js | 3 +- game/update.js | 74 +++++++++++++++++++++++++------------------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/game/asset.js b/game/asset.js index 1f4c6b001d..feb798234c 100644 --- a/game/asset.js +++ b/game/asset.js @@ -1,5 +1,5 @@ window.noname_asset_list=[ - 'v1.10.1', + 'v1.10.1.0.1', 'audio/background/aozhan_chaoming.mp3', 'audio/background/aozhan_online.mp3', 'audio/background/aozhan_rewrite.mp3', @@ -6199,6 +6199,7 @@ window.noname_asset_list=[ 'image/card/mtg_youlin.jpg', 'image/card/mujiaren.png', 'image/card/muniu.png', + 'image/card/muniu_small.png', 'image/card/mutoumianju.png', 'image/card/nanman.png', 'image/card/numa.png', diff --git a/game/update.js b/game/update.js index da90ce501d..98fe218b8a 100644 --- a/game/update.js +++ b/game/update.js @@ -1,6 +1,6 @@ window.noname_update={ - version:'1.10.1', - update:'1.9.126.1', + version:'1.10.1.0.1', + update:'1.10.1', changeLog:[ '整合@rintim @mengxinzxz @Tipx-L @chen079 @lieren2023 @universe-st @nonameShijian @copcap的Pull Request', '增加/更改一系列全新的机制写法', @@ -16,54 +16,54 @@ window.noname_update={ //'LICENSE', 'card/extra.js', //'card/gujian.js', - 'card/guozhan.js', + //'card/guozhan.js', //'card/gwent.js', //'card/hearth.js', //'card/huanlekapai.js', - 'card/mtg.js', + //'card/mtg.js', //'card/sp.js', //'card/standard.js', //'card/swd.js', //'card/yunchou.js', - 'card/yingbian.js', - 'card/yongjian.js', + //'card/yingbian.js', + //'card/yongjian.js', //'card/zhenfa.js', //'card/zhulu.js', - 'character/clan.js', - 'character/collab.js', - 'character/ddd.js', - 'character/diy.js', - 'character/extra.js', + //'character/clan.js', + //'character/collab.js', + //'character/ddd.js', + //'character/diy.js', + //'character/extra.js', //'character/gujian.js', - 'character/gwent.js', + //'character/gwent.js', //'character/hearth.js', - 'character/huicui.js', - 'character/jsrg.js', - 'character/mobile.js', + //'character/huicui.js', + //'character/jsrg.js', + //'character/mobile.js', //'character/mtg.js', - 'character/offline.js', - 'character/old.js', + //'character/offline.js', + //'character/old.js', //'character/ow.js', - 'character/rank.js', - 'character/refresh.js', - 'character/sb.js', - 'character/shenhua.js', - 'character/shiji.js', + //'character/rank.js', + //'character/refresh.js', + //'character/sb.js', + //'character/shenhua.js', + //'character/shiji.js', 'character/sp.js', 'character/sp2.js', - 'character/standard.js', - 'character/tw.js', + //'character/standard.js', + //'character/tw.js', //'character/swd.js', //'character/xiake.js', 'character/xianding.js', //'character/xianjian.js', - 'character/xinghuoliaoyuan.js', - 'character/yijiang.js', - 'character/yingbian.js', - 'character/yxs.js', + //'character/xinghuoliaoyuan.js', + //'character/yijiang.js', + //'character/yingbian.js', + //'character/yxs.js', //'extension/boss/extension.js', //'font/suits.woff2', - 'image/card/cardtempname_bg.png', + //'image/card/cardtempname_bg.png', 'layout/default/layout.css', //'layout/default/menu.css', //'layout/long2/layout.css', @@ -71,14 +71,14 @@ window.noname_update={ //'layout/mobile/layout.css', //'layout/newlayout/global.css', //'layout/nova/layout.css', - 'mode/boss.js', - 'mode/brawl.js', + //'mode/boss.js', + //'mode/brawl.js', //'mode/chess.js', //'mode/connect.js', - 'mode/doudizhu.js', - 'mode/guozhan.js', + //'mode/doudizhu.js', + //'mode/guozhan.js', 'mode/identity.js', - 'mode/single.js', + //'mode/single.js', //'mode/stone.js', //'mode/tafang.js', //'mode/versus.js', @@ -87,10 +87,10 @@ window.noname_update={ //'game/NoSleep.js', //'game/config.js', //'game/package.js', - 'game/path.min.js', - 'game/pinyinjs.js', + //'game/path.min.js', + //'game/pinyinjs.js', //'game/asset.js', - 'game/source.js', + //'game/source.js', //'theme/simple/style.css', //'theme/style/hp/custom.css', //'theme/style/hp/emotion.css',