tempSkills参数归一化

This commit is contained in:
kuangshen04 2023-11-14 16:50:26 +08:00
parent 42147bc131
commit 943c0a3b7c
2 changed files with 25 additions and 45 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@
.Trashes .Trashes
ehthumbs.db ehthumbs.db
Thumbs.db Thumbs.db
localStorage.json localStorage.json
.vscode

View File

@ -27725,39 +27725,16 @@
if(this.hasSkill(skill)&&this.tempSkills[skill]==undefined) return; if(this.hasSkill(skill)&&this.tempSkills[skill]==undefined) return;
this.addSkill(skill,checkConflict,true,true); this.addSkill(skill,checkConflict,true,true);
if(!expire){ if(!expire) expire={global:['phaseAfter','phaseBeforeStart']};
expire=['phaseAfter','phaseBeforeStart']; else if(typeof expire=='string'||Array.isArray(expire)) expire={global:expire};
}
this.tempSkills[skill]=expire; this.tempSkills[skill]=expire;
if(typeof expire=='string'){ if(get.objtype(expire)=='object'){
lib.hookmap[expire]=true; const roles=['player','source','target','global'];
} for(const i of roles){
else if(Array.isArray(expire)){ if(typeof expire[i]=='string') lib.hookmap[expire[i]]=true;
for(var i=0;i<expire.length;i++){ else if(Array.isArray(expire[i])){
lib.hookmap[expire[i]]=true; expire[i].forEach(trigger=>lib.hookmap[trigger]=true);
}
}
else if(get.objtype(expire)=='object'){
var roles=['player','source','target'];
for(var i=0;i<roles.length;i++){
if(typeof expire[roles[i]]=='string'){
lib.hookmap[expire[roles[i]]]=true;
}
else if(Array.isArray(expire[roles[i]])){
for(var j=0;j<expire[roles[i]].length;j++){
lib.hookmap[expire[roles[i]][j]]=true;
}
}
}
if(expire.global){
if(typeof expire.global=='string'){
lib.hookmap[expire.global]=true;
}
else if(Array.isArray(expire.global)){
for(var i=0;i<expire.global.length;i++){
lib.hookmap[expire.global[i]]=true;
}
} }
} }
} }
@ -31841,21 +31818,23 @@
for(var j in player.additionalSkills){ for(var j in player.additionalSkills){
if(!j.startsWith('hidden:')) notemp.addArray(player.additionalSkills[j]); if(!j.startsWith('hidden:')) notemp.addArray(player.additionalSkills[j]);
} }
for(var j in player.tempSkills){ for(const skill in player.tempSkills){
if(notemp.contains(j)) continue; if(notemp.contains(skill)) continue;
var expire=player.tempSkills[j]; const expire=player.tempSkills[skill];
if(expire===name|| if(typeof expire==='function'&&expire(event,player,name)){
(Array.isArray(expire)&&expire.contains(name))|| delete player.tempSkills[skill];
(typeof expire==='function'&&expire(event,player,name))){ player.removeSkill(skill);
delete player.tempSkills[j];
player.removeSkill(j);
} }
else if(get.objtype(expire)==='object'){ else if(get.objtype(expire)==='object'){
for(var i=0;i<roles.length;i++){ if(expire.global===name||(Array.isArray(expire.global)&&expire.global.contains(name))){
if(expire[roles[i]]&&player===event[roles[i]]&& delete player.tempSkills[skill];
(expire[roles[i]]===name||(Array.isArray(expire[roles[i]])&&expire[roles[i]].contains(name)))){ player.removeSkill(skill);
delete player.tempSkills[j]; }
player.removeSkill(j); else for(const i of roles){
if(player!==event[i]) continue;
if(expire[i]===name||(Array.isArray(expire[i])&&expire[i].contains(name))){
delete player.tempSkills[skill];
player.removeSkill(skill);
} }
} }
} }