回春散加血修改
parent
6991d23e69
commit
2d28e51301
|
@ -2564,18 +2564,18 @@ public class MapLogic {
|
||||||
if(trialInfo.getAddHpCount()>=healing[1]){
|
if(trialInfo.getAddHpCount()>=healing[1]){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
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<Integer, Integer> propertyMap = heroInfo.get(heroId).getProperty();
|
Map<Integer, Integer> propertyMap = heroInfo.get(heroId).getProperty();
|
||||||
int curHp = propertyMap.get(HeroAttributeEnum.CurHP.getPropertyId());
|
int curHp = propertyMap.get(HeroAttributeEnum.CurHP.getPropertyId());
|
||||||
if(curHp==0){
|
if(curHp==0){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}else{
|
}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 加血逻辑
|
//todo 加血逻辑
|
||||||
int maxHp = propertyMap.get(HeroAttributeEnum.Hp.getPropertyId());
|
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);
|
propertyMap.put(HeroAttributeEnum.CurHP.getPropertyId(),resultHp);
|
||||||
trialInfo.getHeroInfo().get(heroId).setProperty(propertyMap);
|
trialInfo.getHeroInfo().get(heroId).setProperty(propertyMap);
|
||||||
mapManager.updateTrialAddHpCount(1);
|
mapManager.updateTrialAddHpCount(1);
|
||||||
|
|
Loading…
Reference in New Issue