tempname实装

This commit is contained in:
kuangshen04 2023-12-01 23:06:06 +08:00
parent 5721958458
commit aaa5bb65e7
5 changed files with 64 additions and 53 deletions

View File

@ -3130,7 +3130,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var keys=['filterTarget','selectTarget','ai2']; var keys=['filterTarget','selectTarget','ai2'];
for(var key of keys) delete next[key]; for(var key of keys) delete next[key];
for(var i in trigger){ 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.filterTargetx=trigger.filterTarget||(()=>false);
next.filterTarget=function(card,player,target){ 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; if(list.length>0) continue;
var info=get.info(skill); var info=get.info(skill);
if(info&&(!info.unique||info.gainable)){ 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); skills.add(skill);
} }
} }
@ -3744,6 +3744,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.addSkillBlocker('sbyingmen'); player.addSkillBlocker('sbyingmen');
game.log(player,'将','#y'+get.translation(characters),'加入了','#g“访客”'); game.log(player,'将','#y'+get.translation(characters),'加入了','#g“访客”');
game.broadcastAll(function(player,characters){ game.broadcastAll(function(player,characters){
player.tempname.addArray(characters);
player.$draw(characters.map(function(name){ player.$draw(characters.map(function(name){
var cardname='huashen_card_'+name; var cardname='huashen_card_'+name;
lib.card[cardname]={ lib.card[cardname]={
@ -3764,6 +3765,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var characters2=player.getStorage('sbyingmen').slice(0); var characters2=player.getStorage('sbyingmen').slice(0);
characters2.removeArray(characters); characters2.removeArray(characters);
skills.removeArray(lib.skill.sbyingmen.getSkills(characters2,player)); skills.removeArray(lib.skill.sbyingmen.getSkills(characters2,player));
game.broadcastAll((player,characters)=>player.tempname.removeArray(characters),player,characters);
player.unmarkAuto('sbyingmen',characters); player.unmarkAuto('sbyingmen',characters);
_status.characterlist.addArray(characters); _status.characterlist.addArray(characters);
player.removeInvisibleSkill(skills); player.removeInvisibleSkill(skills);

View File

@ -10563,10 +10563,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
if(event.control=='弃置化身') return; if(event.control=='弃置化身') return;
if(player.storage.rehuashen.current!=event.card){ if(player.storage.rehuashen.current!=event.card){
const old=player.storage.rehuashen.current;
player.storage.rehuashen.current=event.card; player.storage.rehuashen.current=event.card;
game.broadcastAll(function(player,sex){ game.broadcastAll(function(player,character,old){
player.sex=sex; player.tempname.remove(old);
},player,lib.character[event.card][0]); 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])+'性'); game.log(player,'将性别变为了','#y'+get.translation(lib.character[event.card][0])+'性');
player.changeGroup(lib.character[event.card][1]); 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.popup(link);
player.syncStorage('rehuashen'); player.syncStorage('rehuashen');
player.updateMarks('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){ init:function(player,skill){
@ -10695,42 +10698,42 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
return node; return node;
}, },
createAudio:(character,skillx,name)=>{ // createAudio:(character,skillx,name)=>{
var skills=game.expandSkills([skillx]); // var skills=game.expandSkills([skillx]);
skills=skills.filter(skill=>get.info(skill)); // skills=skills.filter(skill=>get.info(skill));
if(!skills.length) return; // if(!skills.length) return;
var skillss=skills.filter(skill=>get.info(skill).derivation); // var skillss=skills.filter(skill=>get.info(skill).derivation);
if(skillss.length){ // if(skillss.length){
skillss.forEach(skill=>{ // skillss.forEach(skill=>{
var derivationSkill=get.info(skill).derivation; // var derivationSkill=get.info(skill).derivation;
skills[Array.isArray(derivationSkill)?'addArray':'add'](derivationSkill); // skills[Array.isArray(derivationSkill)?'addArray':'add'](derivationSkill);
}); // });
} // }
skills.forEach(skill=>{ // skills.forEach(skill=>{
var info=lib.skill[skill]; // var info=lib.skill[skill];
if(info){ // if(info){
if(!info.audioname2) info.audioname2={}; // if(!info.audioname2) info.audioname2={};
if(info.audioname&&info.audioname.includes(character)){ // if(info.audioname&&info.audioname.includes(character)){
if(info.audio){ // if(info.audio){
if(typeof info.audio=='string') skill=info.audio; // if(typeof info.audio=='string') skill=info.audio;
if(Array.isArray(info.audio)) skill=info.audio[0]; // if(Array.isArray(info.audio)) skill=info.audio[0];
} // }
if(!lib.skill[skill+'_'+character]) lib.skill[skill+'_'+character]={audio:2}; // if(!lib.skill[skill+'_'+character]) lib.skill[skill+'_'+character]={audio:2};
info.audioname2[name]=(skill+'_'+character); // info.audioname2[name]=(skill+'_'+character);
} // }
else if(info.audioname2[character]){ // else if(info.audioname2[character]){
info.audioname2[name]=info.audioname2[character]; // info.audioname2[name]=info.audioname2[character];
} // }
else{ // else{
if(info.audio){ // if(info.audio){
if(typeof info.audio=='string') skill=info.audio; // if(typeof info.audio=='string') skill=info.audio;
if(Array.isArray(info.audio)) skill=info.audio[0]; // if(Array.isArray(info.audio)) skill=info.audio[0];
} // }
info.audioname2[name]=skill; // info.audioname2[name]=skill;
} // }
} // }
}); // });
}, // },
mark:true, mark:true,
intro:{ intro:{
onunmark:function(storage,player){ onunmark:function(storage,player){

View File

@ -4424,10 +4424,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!event.logged) player.logSkill('huashen'); if(!event.logged) player.logSkill('huashen');
var skill=map.skill,character=map.character; var skill=map.skill,character=map.character;
if(character!=player.storage.huashen.current){ if(character!=player.storage.huashen.current){
const old=player.storage.huashen.current;
player.storage.huashen.current=character; player.storage.huashen.current=character;
player.storage.huashen.shown.add(character); player.storage.huashen.shown.add(character);
player.markSkill('huashen'); 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.sex=lib.character[character][0];
//player.group=lib.character[character][1]; //player.group=lib.character[character][1];
//player.node.name.dataset.nature=get.groupnature(player.group); //player.node.name.dataset.nature=get.groupnature(player.group);
@ -4447,7 +4450,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},50); },50);
},200); },200);
} }
},character,player); },player,character,old);
game.log(player,'将性别变为了','#y'+get.translation(lib.character[character][0])+'性'); game.log(player,'将性别变为了','#y'+get.translation(lib.character[character][0])+'性');
player.changeGroup(lib.character[character][1]); player.changeGroup(lib.character[character][1]);
} }
@ -4459,7 +4462,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.popup(skill); player.popup(skill);
player.syncStorage('huashen'); player.syncStorage('huashen');
player.updateMarks('huashen'); player.updateMarks('huashen');
lib.skill.rehuashen.createAudio(character,skill,'zuoci'); // lib.skill.rehuashen.createAudio(character,skill,'zuoci');
} }
} }
} }

View File

@ -8366,7 +8366,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.addTempSkill(result.control); player.addTempSkill(result.control);
player.storage.pingjian_check[result.control]=(trigger.name=='damage'?trigger:'phaseJieshu'); player.storage.pingjian_check[result.control]=(trigger.name=='damage'?trigger:'phaseJieshu');
var name=event.list.find(name=>lib.character[name][3].includes(result.control)); 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', group:'pingjian_use',
phaseUse_special:[], phaseUse_special:[],
@ -8454,7 +8455,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.addTempSkill(result.control); player.addTempSkill(result.control);
player.storage.pingjian_check[result.control]='phaseUse'; player.storage.pingjian_check[result.control]='phaseUse';
var name=event.list.find(name=>lib.character[name][3].includes(result.control)); 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}}, ai:{order:12,result:{player:1}},
}, },
@ -8473,6 +8475,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){ content:function(){
var skill=trigger.sourceSkill||trigger.skill; var skill=trigger.sourceSkill||trigger.skill;
player.removeSkill(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]; delete player.storage.pingjian_check[skill];
}, },
group:'pingjian_check2', group:'pingjian_check2',
@ -8495,6 +8499,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return player.storage.pingjian_check[skill]==trigger; return player.storage.pingjian_check[skill]==trigger;
}); });
player.removeSkill(skills); 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]; for(var skill of skills) delete player.storage.pingjian_check[skill];
}, },
}, },

View File

@ -22446,6 +22446,7 @@ new Promise(resolve=>{
this.name=character; this.name=character;
this.name1=character; this.name1=character;
this.tempname=[];
this.sex=info[0]; this.sex=info[0];
this.group=info[1]; this.group=info[1];
this.hp=hp1; 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.name1]) audioInfo=info.audioname2[player.name1];
else if(info.audioname2[player.name2]) audioInfo=info.audioname2[player.name2]; else if(info.audioname2[player.name2]) audioInfo=info.audioname2[player.name2];
else if(player.tempname){ else if(player.tempname){
let tempname=player.tempname; const name=player.tempname.find(i=>info.audioname2[i]);
if(!Array.isArray(tempname)) tempname=[tempname];
const name=tempname.find(i=>info.audioname2[i]);
if(name) audioInfo=info.audioname2[name]; 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.name1)) _audioname=`_${player.name1}`;
else if(audioname.includes(player.name2)) _audioname=`_${player.name2}`; else if(audioname.includes(player.name2)) _audioname=`_${player.name2}`;
else if(player.tempname){ else if(player.tempname){
let tempname=player.tempname; const name=player.tempname.find(i=>audioname.includes(i));
if(!Array.isArray(tempname)) tempname=[tempname];
const name=tempname.find(i=>audioname.includes(i));
if(name) _audioname=`_${name}`; if(name) _audioname=`_${name}`;
} }