From aaa5bb65e79d23223a457b959e75135b74f2bac8 Mon Sep 17 00:00:00 2001 From: kuangshen04 <2832899707@qq.com> Date: Fri, 1 Dec 2023 23:06:06 +0800 Subject: [PATCH] =?UTF-8?q?tempname=E5=AE=9E=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/jsrg.js | 6 ++-- character/refresh.js | 83 +++++++++++++++++++++++--------------------- character/shenhua.js | 9 +++-- character/sp2.js | 10 ++++-- game/game.js | 9 ++--- 5 files changed, 64 insertions(+), 53 deletions(-) diff --git a/character/jsrg.js b/character/jsrg.js index d49fa986c..b365a30c9 100644 --- a/character/jsrg.js +++ b/character/jsrg.js @@ -3130,7 +3130,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var keys=['filterTarget','selectTarget','ai2']; for(var key of keys) delete next[key]; for(var i in trigger){ - if(!next.hasOwnProperty(i)) next[i]=trigger[i]; + if(!(i in next)) next[i]=trigger[i]; } next.filterTargetx=trigger.filterTarget||(()=>false); next.filterTarget=function(card,player,target){ @@ -3732,7 +3732,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(list.length>0) continue; var info=get.info(skill); if(info&&(!info.unique||info.gainable)){ - lib.skill.rehuashen.createAudio(name,skill,'jsrg_xushao'); + // lib.skill.rehuashen.createAudio(name,skill,'jsrg_xushao'); skills.add(skill); } } @@ -3744,6 +3744,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.addSkillBlocker('sbyingmen'); game.log(player,'将','#y'+get.translation(characters),'加入了','#g“访客”'); game.broadcastAll(function(player,characters){ + player.tempname.addArray(characters); player.$draw(characters.map(function(name){ var cardname='huashen_card_'+name; lib.card[cardname]={ @@ -3764,6 +3765,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var characters2=player.getStorage('sbyingmen').slice(0); characters2.removeArray(characters); skills.removeArray(lib.skill.sbyingmen.getSkills(characters2,player)); + game.broadcastAll((player,characters)=>player.tempname.removeArray(characters),player,characters); player.unmarkAuto('sbyingmen',characters); _status.characterlist.addArray(characters); player.removeInvisibleSkill(skills); diff --git a/character/refresh.js b/character/refresh.js index cb49f0a8f..1a456f772 100755 --- a/character/refresh.js +++ b/character/refresh.js @@ -10563,10 +10563,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } if(event.control=='弃置化身') return; if(player.storage.rehuashen.current!=event.card){ + const old=player.storage.rehuashen.current; player.storage.rehuashen.current=event.card; - game.broadcastAll(function(player,sex){ - player.sex=sex; - },player,lib.character[event.card][0]); + game.broadcastAll(function(player,character,old){ + player.tempname.remove(old); + player.tempname.add(character); + player.sex=lib.character[event.card][0]; + },player,event.card,old); game.log(player,'将性别变为了','#y'+get.translation(lib.character[event.card][0])+'性'); player.changeGroup(lib.character[event.card][1]); } @@ -10579,7 +10582,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.popup(link); player.syncStorage('rehuashen'); player.updateMarks('rehuashen'); - lib.skill.rehuashen.createAudio(event.card,link,'re_zuoci'); + // lib.skill.rehuashen.createAudio(event.card,link,'re_zuoci'); } }, init:function(player,skill){ @@ -10695,42 +10698,42 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } return node; }, - createAudio:(character,skillx,name)=>{ - var skills=game.expandSkills([skillx]); - skills=skills.filter(skill=>get.info(skill)); - if(!skills.length) return; - var skillss=skills.filter(skill=>get.info(skill).derivation); - if(skillss.length){ - skillss.forEach(skill=>{ - var derivationSkill=get.info(skill).derivation; - skills[Array.isArray(derivationSkill)?'addArray':'add'](derivationSkill); - }); - } - skills.forEach(skill=>{ - var info=lib.skill[skill]; - if(info){ - if(!info.audioname2) info.audioname2={}; - if(info.audioname&&info.audioname.includes(character)){ - if(info.audio){ - if(typeof info.audio=='string') skill=info.audio; - if(Array.isArray(info.audio)) skill=info.audio[0]; - } - if(!lib.skill[skill+'_'+character]) lib.skill[skill+'_'+character]={audio:2}; - info.audioname2[name]=(skill+'_'+character); - } - else if(info.audioname2[character]){ - info.audioname2[name]=info.audioname2[character]; - } - else{ - if(info.audio){ - if(typeof info.audio=='string') skill=info.audio; - if(Array.isArray(info.audio)) skill=info.audio[0]; - } - info.audioname2[name]=skill; - } - } - }); - }, + // createAudio:(character,skillx,name)=>{ + // var skills=game.expandSkills([skillx]); + // skills=skills.filter(skill=>get.info(skill)); + // if(!skills.length) return; + // var skillss=skills.filter(skill=>get.info(skill).derivation); + // if(skillss.length){ + // skillss.forEach(skill=>{ + // var derivationSkill=get.info(skill).derivation; + // skills[Array.isArray(derivationSkill)?'addArray':'add'](derivationSkill); + // }); + // } + // skills.forEach(skill=>{ + // var info=lib.skill[skill]; + // if(info){ + // if(!info.audioname2) info.audioname2={}; + // if(info.audioname&&info.audioname.includes(character)){ + // if(info.audio){ + // if(typeof info.audio=='string') skill=info.audio; + // if(Array.isArray(info.audio)) skill=info.audio[0]; + // } + // if(!lib.skill[skill+'_'+character]) lib.skill[skill+'_'+character]={audio:2}; + // info.audioname2[name]=(skill+'_'+character); + // } + // else if(info.audioname2[character]){ + // info.audioname2[name]=info.audioname2[character]; + // } + // else{ + // if(info.audio){ + // if(typeof info.audio=='string') skill=info.audio; + // if(Array.isArray(info.audio)) skill=info.audio[0]; + // } + // info.audioname2[name]=skill; + // } + // } + // }); + // }, mark:true, intro:{ onunmark:function(storage,player){ diff --git a/character/shenhua.js b/character/shenhua.js index a329089be..089543a0c 100755 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -4424,10 +4424,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!event.logged) player.logSkill('huashen'); var skill=map.skill,character=map.character; if(character!=player.storage.huashen.current){ + const old=player.storage.huashen.current; player.storage.huashen.current=character; player.storage.huashen.shown.add(character); player.markSkill('huashen'); - game.broadcastAll(function(character,player){ + game.broadcastAll(function(player,character,old){ + player.tempname.remove(old); + player.tempname.add(character); player.sex=lib.character[character][0]; //player.group=lib.character[character][1]; //player.node.name.dataset.nature=get.groupnature(player.group); @@ -4447,7 +4450,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ },50); },200); } - },character,player); + },player,character,old); game.log(player,'将性别变为了','#y'+get.translation(lib.character[character][0])+'性'); player.changeGroup(lib.character[character][1]); } @@ -4459,7 +4462,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.popup(skill); player.syncStorage('huashen'); player.updateMarks('huashen'); - lib.skill.rehuashen.createAudio(character,skill,'zuoci'); + // lib.skill.rehuashen.createAudio(character,skill,'zuoci'); } } } diff --git a/character/sp2.js b/character/sp2.js index e02ed2e54..fd190e554 100644 --- a/character/sp2.js +++ b/character/sp2.js @@ -8366,7 +8366,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.addTempSkill(result.control); player.storage.pingjian_check[result.control]=(trigger.name=='damage'?trigger:'phaseJieshu'); var name=event.list.find(name=>lib.character[name][3].includes(result.control)); - if(name) lib.skill.rehuashen.createAudio(name,result.control,'xushao'); + // if(name) lib.skill.rehuashen.createAudio(name,result.control,'xushao'); + if(name) game.broadcastAll((player,name)=>player.tempname.add(name),player,name); }, group:'pingjian_use', phaseUse_special:[], @@ -8454,7 +8455,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.addTempSkill(result.control); player.storage.pingjian_check[result.control]='phaseUse'; var name=event.list.find(name=>lib.character[name][3].includes(result.control)); - if(name) lib.skill.rehuashen.createAudio(name,result.control,'xushao'); + // if(name) lib.skill.rehuashen.createAudio(name,result.control,'xushao'); + if(name) game.broadcastAll((player,name)=>player.tempname.add(name),player,name); }, ai:{order:12,result:{player:1}}, }, @@ -8473,6 +8475,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ var skill=trigger.sourceSkill||trigger.skill; player.removeSkill(skill); + const names=player.tempname&&player.tempname.filter(i=>lib.character[i][3].includes(skill)); + if(names) game.broadcastAll((player,names)=>player.tempname.removeArray(names),player,names); delete player.storage.pingjian_check[skill]; }, group:'pingjian_check2', @@ -8495,6 +8499,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return player.storage.pingjian_check[skill]==trigger; }); player.removeSkill(skills); + const names=player.tempname&&player.tempname.filter(i=>skills.some(skill=>lib.character[i][3].includes(skill))); + if(names) game.broadcastAll((player,names)=>player.tempname.removeArray(names),player,names); for(var skill of skills) delete player.storage.pingjian_check[skill]; }, }, diff --git a/game/game.js b/game/game.js index 4b4850fbd..00aedcd33 100644 --- a/game/game.js +++ b/game/game.js @@ -22446,6 +22446,7 @@ new Promise(resolve=>{ this.name=character; this.name1=character; + this.tempname=[]; this.sex=info[0]; this.group=info[1]; this.hp=hp1; @@ -37451,9 +37452,7 @@ new Promise(resolve=>{ else if(info.audioname2[player.name1]) audioInfo=info.audioname2[player.name1]; else if(info.audioname2[player.name2]) audioInfo=info.audioname2[player.name2]; else if(player.tempname){ - let tempname=player.tempname; - if(!Array.isArray(tempname)) tempname=[tempname]; - const name=tempname.find(i=>info.audioname2[i]); + const name=player.tempname.find(i=>info.audioname2[i]); if(name) audioInfo=info.audioname2[name]; } } @@ -37501,9 +37500,7 @@ new Promise(resolve=>{ else if(audioname.includes(player.name1)) _audioname=`_${player.name1}`; else if(audioname.includes(player.name2)) _audioname=`_${player.name2}`; else if(player.tempname){ - let tempname=player.tempname; - if(!Array.isArray(tempname)) tempname=[tempname]; - const name=tempname.find(i=>audioname.includes(i)); + const name=player.tempname.find(i=>audioname.includes(i)); if(name) _audioname=`_${name}`; }