英雄属性加成计算规则
parent
c2ab44a181
commit
e103042663
|
@ -17,6 +17,8 @@ public class SPropertyConfig implements BaseConfig {
|
||||||
|
|
||||||
private float score;
|
private float score;
|
||||||
|
|
||||||
|
private int targetPropertyId;
|
||||||
|
|
||||||
|
|
||||||
private static Map<Integer,SPropertyConfig> sPropertyConfigByPIDMap;
|
private static Map<Integer,SPropertyConfig> sPropertyConfigByPIDMap;
|
||||||
|
|
||||||
|
@ -52,4 +54,8 @@ public class SPropertyConfig implements BaseConfig {
|
||||||
public float getScore() {
|
public float getScore() {
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTargetPropertyId() {
|
||||||
|
return targetPropertyId;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -753,9 +753,40 @@ public class HeroLogic {
|
||||||
combinedAttribute(secondValueByIdMap,heroAllAttribute);
|
combinedAttribute(secondValueByIdMap,heroAllAttribute);
|
||||||
}
|
}
|
||||||
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
|
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
|
||||||
|
calInteractAdd(heroAllAttribute);
|
||||||
return heroAllAttribute;
|
return heroAllAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void calInteractAdd(Map<Integer, Integer> heroAllAttribute){
|
||||||
|
Map<Integer,Integer> propertyPercentMap = new HashMap<>();
|
||||||
|
Iterator<Map.Entry<Integer, Integer>> iterator = heroAllAttribute.entrySet().iterator();
|
||||||
|
while (iterator.hasNext()){
|
||||||
|
Map.Entry<Integer, Integer> item = iterator.next();
|
||||||
|
Integer propertyId = item.getKey();
|
||||||
|
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(propertyId);
|
||||||
|
int targetPropertyId = sPropertyConfig.getTargetPropertyId();
|
||||||
|
if(targetPropertyId == 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int style = sPropertyConfig.getStyle();
|
||||||
|
Integer effectValue = item.getValue();
|
||||||
|
Integer targetValue = heroAllAttribute.get(targetPropertyId);
|
||||||
|
if(style == GlobalsDef.ABSOLUTE_TYPE){
|
||||||
|
effectValue += targetValue;
|
||||||
|
}else{
|
||||||
|
propertyPercentMap.put(targetPropertyId,100+effectValue);
|
||||||
|
}
|
||||||
|
heroAllAttribute.put(targetPropertyId,effectValue);
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Map.Entry<Integer,Integer> item : propertyPercentMap.entrySet()){
|
||||||
|
Integer propertyId = item.getKey();
|
||||||
|
Integer propertyValue = heroAllAttribute.get(propertyId);
|
||||||
|
heroAllAttribute.put(propertyId,propertyValue*item.getValue()/100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//获取英雄所有属性
|
//获取英雄所有属性
|
||||||
|
@ -764,13 +795,13 @@ public class HeroLogic {
|
||||||
//食物buffer加成
|
//食物buffer加成
|
||||||
Map<Integer, Integer> foodAddMap = CombatLogic.getInstance().attributeByEatFood(user,GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON);
|
Map<Integer, Integer> foodAddMap = CombatLogic.getInstance().attributeByEatFood(user,GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON);
|
||||||
combinedAttribute(foodAddMap,heroAllAttribute);
|
combinedAttribute(foodAddMap,heroAllAttribute);
|
||||||
|
calInteractAdd(heroAllAttribute);
|
||||||
return heroAllAttribute;
|
return heroAllAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int calHeoForce(User user, Hero hero){
|
public int calHeoForce(User user, Hero hero){
|
||||||
Map<Integer, Integer> heroAllAttribute = calHeroFinalAttributeWhenInMap(user, hero);
|
Map<Integer, Integer> heroAllAttribute = calHeroFinalAttributeWhenInMap(user, hero);
|
||||||
heroAllAttribute.remove(0);
|
|
||||||
double result = 0;
|
double result = 0;
|
||||||
for(Map.Entry<Integer, Integer> item : heroAllAttribute.entrySet()){
|
for(Map.Entry<Integer, Integer> item : heroAllAttribute.entrySet()){
|
||||||
Integer propertyId = item.getKey();
|
Integer propertyId = item.getKey();
|
||||||
|
|
Loading…
Reference in New Issue