Merge pull request #574 from CatIgnore/update-changeHujia

完善护甲机制,修复护甲失效时damagepop不正确的bug
This commit is contained in:
Spmario233 2023-10-24 12:28:42 +08:00 committed by GitHub
commit 52ee2958e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 12 deletions

View File

@ -19909,7 +19909,7 @@
} }
} }
},natures,player); },natures,player);
var numx=Math.max(0,num-player.hujia); var numx=player.hasSkillTag('nohujia')?num:Math.max(0,num-player.hujia);
player.$damagepop(-numx,natures[0]); player.$damagepop(-numx,natures[0]);
} }
if(event.unreal) event.goto(6) if(event.unreal) event.goto(6)
@ -20047,7 +20047,8 @@
event.hujia=Math.min(-num,player.hujia); event.hujia=Math.min(-num,player.hujia);
event.getParent().hujia=event.hujia; event.getParent().hujia=event.hujia;
event.num+=event.hujia; event.num+=event.hujia;
game.log(player,'的护甲抵挡了'+get.cnNumber(event.hujia)+'点伤害'); //log moved to changeHujia
//game.log(player,'的护甲抵挡了'+get.cnNumber(event.hujia)+'点伤害');
player.changeHujia(-event.hujia).type='damage'; player.changeHujia(-event.hujia).type='damage';
} }
//old part //old part
@ -20072,13 +20073,27 @@
event.trigger('changeHp'); event.trigger('changeHp');
}, },
changeHujia:function(){ changeHujia:function(){
player.hujia+=num;
if(num>0){ if(num>0){
game.log(player,'获得了'+get.cnNumber(num)+'点护甲'); game.log(player,'获得了'+get.cnNumber(num)+'点护甲');
} }
if(player.hujia<0){ else if(num<0){
player.hujia=0; if(-num>player.hujia){
num=-player.hujia;
event.num=num;
}
switch(event.type){ //log moved here
case 'damage':
game.log(player,'的护甲抵挡了'+get.cnNumber(-num)+'点伤害');
break;
case 'lose':
game.log(player,'失去了'+get.cnNumber(-num)+'点护甲');
break;
}
} }
player.hujia+=num;
//if(player.hujia<0){
// player.hujia=0;
//}
player.update(); player.update();
}, },
dying:function(){ dying:function(){
@ -25501,16 +25516,19 @@
if(typeof num!='number'){ if(typeof num!='number'){
num=1; num=1;
} }
next.num=num;
next.player=this;
if(type) next.type=type;
next.setContent('changeHujia');
if(limit===true) limit=5; if(limit===true) limit=5;
if(typeof limit=='number'&&this.hujia+num>parseInt(limit)){ if(typeof limit=='number'&&this.hujia+num>parseInt(limit)){
var numx=parseInt(limit)-this.hujia; num=Math.max(0, parseInt(limit)-this.hujia);
if(numx>0) next.num=numx;
else _status.event.next.remove(next);
} }
if(typeof type!='string'){
if(num>0) type='gain';
else if(num<0) type='lose';
else type='null';
}
next.num=num;
next.player=this;
next.type=type;
next.setContent('changeHujia');
return next; return next;
} }
getBuff(){ getBuff(){