From 644a534b4ee19810a391bd5284267a63346139d3 Mon Sep 17 00:00:00 2001 From: CatIgnore <137709037+CatIgnore@users.noreply.github.com> Date: Sun, 22 Oct 2023 00:34:21 +0800 Subject: [PATCH] Update changeHujia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改changeHujia函数,增加失去护甲的log,将护甲抵挡伤害的log移动至该函数 对应谋曹仁(及可能出现的谋关羽)等武将的不因伤害而失去护甲的机制 --- game/game.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/game/game.js b/game/game.js index 583cc86ae..6df8eb5b4 100644 --- a/game/game.js +++ b/game/game.js @@ -19504,7 +19504,6 @@ event.hujia=Math.min(-num,player.hujia); event.getParent().hujia=event.hujia; event.num+=event.hujia; - game.log(player,'的护甲抵挡了'+get.cnNumber(event.hujia)+'点伤害'); player.changeHujia(-event.hujia).type='damage'; } //old part @@ -19529,12 +19528,26 @@ event.trigger('changeHp'); }, changeHujia:function(){ + if(-num>player.hujia){ + num=-player.hujia; + event.num=num; + } player.hujia+=num; if(num>0){ game.log(player,'获得了'+get.cnNumber(num)+'点护甲'); } - if(player.hujia<0){ - player.hujia=0; + // if(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(); }, @@ -24778,9 +24791,13 @@ if(typeof num!='number'){ num=1; } + if(typeof type!='string'){ + if(num>=0) type='gain'; + else type='lose'; + } next.num=num; next.player=this; - if(type) next.type=type; + next.type=type; next.setContent('changeHujia'); if(limit===true) limit=5; if(typeof limit=='number'&&this.hujia+num>parseInt(limit)){