优化护甲上限逻辑

优化护甲超出上限后的获得逻辑
This commit is contained in:
CatIgnore 2023-10-24 00:33:54 +08:00 committed by GitHub
parent 4b69a510c7
commit 81413bc494
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions

View File

@ -19548,9 +19548,9 @@
} }
} }
player.hujia+=num; player.hujia+=num;
/*if(player.hujia<0){ //if(player.hujia<0){
player.hujia=0; // player.hujia=0;
}*/ //}
player.update(); player.update();
}, },
dying:function(){ dying:function(){
@ -24793,6 +24793,10 @@
if(typeof num!='number'){ if(typeof num!='number'){
num=1; num=1;
} }
if(limit===true) limit=5;
if(typeof limit=='number'&&this.hujia+num>parseInt(limit)){
num=Math.max(0, parseInt(limit)-this.hujia);
}
if(typeof type!='string'){ if(typeof type!='string'){
if(num>0) type='gain'; if(num>0) type='gain';
else if(num<0) type='lose'; else if(num<0) type='lose';
@ -24802,12 +24806,6 @@
next.player=this; next.player=this;
next.type=type; next.type=type;
next.setContent('changeHujia'); next.setContent('changeHujia');
if(limit===true) limit=5;
if(typeof limit=='number'&&this.hujia+num>parseInt(limit)){
var numx=parseInt(limit)-this.hujia;
if(numx>0) next.num=numx;
else _status.event.next.remove(next);
}
return next; return next;
}, },
getBuff:function(){ getBuff:function(){