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'];
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);

View File

@ -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){

View File

@ -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');
}
}
}

View File

@ -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];
},
},

View File

@ -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}`;
}