英雄战力
parent
b183dd664b
commit
41a27bb260
|
@ -17,4 +17,8 @@ public interface GlobalsDef {
|
||||||
int RANKUP_PARA_TYPE =1;
|
int RANKUP_PARA_TYPE =1;
|
||||||
int BREAK_PARA_TYPE =2;
|
int BREAK_PARA_TYPE =2;
|
||||||
|
|
||||||
|
// 属性加成类型
|
||||||
|
int ABSOLUTE_TYPE =1; // 绝对值
|
||||||
|
int PERCENT_TYPE =2; // 百分比
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class Equip extends MongoBase {
|
||||||
this.secondValueByIdMap = getSecondValue(sEquipConfig.getPool(),secondValue);
|
this.secondValueByIdMap = getSecondValue(sEquipConfig.getPool(),secondValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer,Integer> getSecondValue(int poolId,int nums){
|
private Map<Integer,Integer> getSecondValue(int poolId,int nums){
|
||||||
Map<Integer,Integer> result = new HashMap<>();
|
Map<Integer,Integer> result = new HashMap<>();
|
||||||
List<SEquipPropertyPool> sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(poolId);
|
List<SEquipPropertyPool> sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(poolId);
|
||||||
int totalWeight = 0;
|
int totalWeight = 0;
|
||||||
|
@ -114,4 +114,12 @@ public class Equip extends MongoBase {
|
||||||
updateString("heroId",heroId);
|
updateString("heroId",heroId);
|
||||||
this.heroId = heroId;
|
this.heroId = heroId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<Integer, Integer> getPropertyValueByIdMap() {
|
||||||
|
return propertyValueByIdMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Integer, Integer> getSecondValueByIdMap() {
|
||||||
|
return secondValueByIdMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.hero;
|
||||||
import com.ljsd.GameApplication;
|
import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.config.*;
|
import com.ljsd.jieling.config.*;
|
||||||
import com.ljsd.jieling.core.GlobalsDef;
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
|
import com.ljsd.jieling.globals.Global;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
@ -448,20 +449,42 @@ public class HeroLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//todo 计算英雄战斗力 战斗力 = 生命*0.7 + (护甲 + 魔坑)*5 + 攻击 *10 + (暴击率 + 效果命中率 + 效果抵抗率 )*5 +(属性攻击率 + 属性防御率)*30
|
|
||||||
public int calHeoForce(User user, Hero hero){
|
public int calHeoForce(User user, Hero hero){
|
||||||
Map<Integer, Integer> heroAllAttribute = calHeroAllAttribute(hero);
|
Map<Integer, Integer> heroAllAttribute = calHeroAllAttribute(hero);
|
||||||
double heroBaseForce = heroAllAttribute.get(GlobalsDef.HP_TYPE) * 0.7 + (heroAllAttribute.get(GlobalsDef.PHYSICAL_DEFENCE_TYPE) + heroAllAttribute.get(GlobalsDef.MAGIC_DEFENCE_TYPE)) * 5 + heroAllAttribute.get(GlobalsDef.ATTACK_TYPE) * 10;
|
|
||||||
//todo 计算装备加成
|
|
||||||
Collection<String> values = hero.getEquipByPositionMap().values();
|
Collection<String> values = hero.getEquipByPositionMap().values();
|
||||||
EquipManager equipManager = user.getEquipManager();
|
EquipManager equipManager = user.getEquipManager();
|
||||||
for(String equipId:values){
|
for(String equipId:values){
|
||||||
Equip equip = equipManager.getEquipMap().get(equipId);
|
Equip equip = equipManager.getEquipMap().get(equipId);
|
||||||
|
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
|
||||||
|
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
|
||||||
|
combinedAttribute(propertyValueByIdMap,heroAllAttribute);
|
||||||
|
combinedAttribute(secondValueByIdMap,heroAllAttribute);
|
||||||
|
}
|
||||||
|
double result = 0;
|
||||||
|
for(Map.Entry<Integer, Integer> item : heroAllAttribute.entrySet()){
|
||||||
|
Integer propertyId = item.getKey();
|
||||||
|
Integer propertyValue = item.getValue();
|
||||||
|
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(propertyId);
|
||||||
|
int style = sPropertyConfig.getStyle();
|
||||||
|
float score = sPropertyConfig.getScore();
|
||||||
|
if(style == GlobalsDef.PERCENT_TYPE){
|
||||||
|
score = score/100;
|
||||||
|
}
|
||||||
|
result += propertyValue*score;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int)result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void combinedAttribute(Map<Integer, Integer> otherAttriMaop,Map<Integer,Integer> heroAttributeMap){
|
||||||
|
for(Map.Entry<Integer, Integer> item : otherAttriMaop.entrySet()){
|
||||||
|
Integer propertyId = item.getKey();
|
||||||
|
Integer propertyValue = item.getValue();
|
||||||
|
if(heroAttributeMap.containsKey(propertyId)){
|
||||||
|
propertyValue = heroAttributeMap.get(propertyId);
|
||||||
|
}
|
||||||
|
heroAttributeMap.put(propertyId,propertyValue);
|
||||||
}
|
}
|
||||||
float equipAddForce =0.0f;
|
|
||||||
int result = (int) (heroBaseForce + equipAddForce);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue