Update changeHujia

修改changeHujia函数,增加失去护甲的log,将护甲抵挡伤害的log移动至该函数
对应谋曹仁(及可能出现的谋关羽)等武将的不因伤害而失去护甲的机制
This commit is contained in:
CatIgnore 2023-10-22 00:34:21 +08:00 committed by GitHub
parent 42983613a1
commit 644a534b4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 4 deletions

View File

@ -19504,7 +19504,6 @@
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)+'点伤害');
player.changeHujia(-event.hujia).type='damage'; player.changeHujia(-event.hujia).type='damage';
} }
//old part //old part
@ -19529,12 +19528,26 @@
event.trigger('changeHp'); event.trigger('changeHp');
}, },
changeHujia:function(){ changeHujia:function(){
if(-num>player.hujia){
num=-player.hujia;
event.num=num;
}
player.hujia+=num; 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){ // if(player.hujia<0){
player.hujia=0; // player.hujia=0;
// }
if(num<0){
switch(type){
case 'damage':
game.log(player,'的护甲抵挡了'+get.cnNumber(-num)+'点伤害');
break;
case 'lose':
game.log(player,'失去了'+get.cnNumber(-num)+'点护甲');
break;
}
} }
player.update(); player.update();
}, },
@ -24778,9 +24791,13 @@
if(typeof num!='number'){ if(typeof num!='number'){
num=1; num=1;
} }
if(typeof type!='string'){
if(num>=0) type='gain';
else type='lose';
}
next.num=num; next.num=num;
next.player=this; next.player=this;
if(type) next.type=type; next.type=type;
next.setContent('changeHujia'); 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)){