From 2d28e51301f9f05a78576f0303ca98a17f80d3a0 Mon Sep 17 00:00:00 2001 From: lvxinran Date: Fri, 30 Oct 2020 11:15:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E6=98=A5=E6=95=A3=E5=8A=A0=E8=A1=80?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ljsd/jieling/handler/map/MapLogic.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java index 108e8e75a..6cef2ddb8 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java @@ -2564,18 +2564,18 @@ public class MapLogic { if(trialInfo.getAddHpCount()>=healing[1]){ throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); } - boolean itemCost = ItemUtil.itemCost(user, new int[][]{{healing[0],1}}, BIReason.TRIAL_ADD_HP_CONSUME, 1); - if(!itemCost){ - throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); - } Map propertyMap = heroInfo.get(heroId).getProperty(); int curHp = propertyMap.get(HeroAttributeEnum.CurHP.getPropertyId()); if(curHp==0){ throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); }else{ + boolean itemCost = ItemUtil.itemCost(user, new int[][]{{healing[0],1}}, BIReason.TRIAL_ADD_HP_CONSUME, 1); + if(!itemCost){ + throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); + } //todo 加血逻辑 int maxHp = propertyMap.get(HeroAttributeEnum.Hp.getPropertyId()); - int resultHp = Math.min(curHp+maxHp*5000/10000,maxHp); + int resultHp = Math.min(curHp+maxHp/2,maxHp); propertyMap.put(HeroAttributeEnum.CurHP.getPropertyId(),resultHp); trialInfo.getHeroInfo().get(heroId).setProperty(propertyMap); mapManager.updateTrialAddHpCount(1);