装备评分日志

back_recharge
wangyuan 2019-05-08 15:40:25 +08:00
parent fdef8df986
commit aafb262d83
8 changed files with 46 additions and 48 deletions

View File

@ -1,43 +0,0 @@
package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import java.util.Map;
@Table(name ="ArenaConfig")
public class SArenaConfig implements BaseConfig {
private int id;
private String name;
private float[] position;
private float[] include;
@Override
public void init() throws Exception {
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public float[] getPosition() {
return position;
}
public float[] getInclude() {
return include;
}
}

View File

@ -34,6 +34,8 @@ public class SEquipConfig implements BaseConfig {
private int initialLevel;
private int score;
@Override
public void init() throws Exception {
@ -91,4 +93,8 @@ public class SEquipConfig implements BaseConfig {
public int getInitialLevel() {
return initialLevel;
}
public int getScore() {
return score;
}
}

View File

@ -32,6 +32,10 @@ public class SEquipPropertyPool implements BaseConfig {
Map<Integer, SEquipPropertyPool> config = STableManager.getConfig(SEquipPropertyPool.class);
for(SEquipPropertyPool sEquipPropertyPool : config.values()){
int poolNum = sEquipPropertyPool.getPoolNum();
int weight = sEquipPropertyPool.getWeight();
if(weight==0){
continue;
}
if(!sEquipPropertyPoolByIdMapTmp.containsKey(poolNum)){
sEquipPropertyPoolByIdMapTmp.put(poolNum,new ArrayList<>());
}

View File

@ -57,4 +57,9 @@ public interface GlobalsDef {
int MUST_BE = -1;
//竞技场奖励类型
int ARENA_DAILY_REWARD =1;
int ARENA_SEASON_REWARD =2;
}

View File

@ -22,7 +22,6 @@ import com.ljsd.jieling.util.MessageUtil;
import com.ljsd.jieling.util.TimeUtils;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import sun.misc.MessageUtils;
import java.io.IOException;
import java.text.SimpleDateFormat;

View File

@ -3,16 +3,19 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.config.*;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.handler.GameGM.GMRequestHandler;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.util.KeyGenUtils;
import com.ljsd.jieling.util.MathUtils;
import com.ljsd.jieling.util.UUIDEnum;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Equip extends MongoBase implements Cloneable{
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Equip.class);
private String id;
@ -148,6 +151,10 @@ public class Equip extends MongoBase implements Cloneable{
private Map<Integer,Integer> getSecondValue(int poolId,int nums,Map<Integer, Integer> promoteMap){
Map<Integer,Integer> result = new HashMap<>();
List<SEquipPropertyPool> sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(poolId);
if(sEquipPropertyPoolList.size()<nums){
LOGGER.error("the equip config is wrong,the equipTid={},the poolId={},the poolNum={},the requireNum={}",equipId,poolId,sEquipPropertyPoolList.size(),nums);
return result;
}
int totalWeight = 0;
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
int weight = sEquipPropertyPool.getWeight();
@ -168,7 +175,7 @@ public class Equip extends MongoBase implements Cloneable{
int randomWeight = MathUtils.randomInt(totalWeight) +1;
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
int weightTmp= sEquipPropertyPool.getWeight();
if(weightTmp<=0){
if(weightTmp<0){
continue;
}
weight+=weightTmp;

View File

@ -30,6 +30,7 @@ public enum HeroAttributeEnum {
LandDamageReduceFactor(110),
LightDamageReduceFactor(111),
DarkDamageReduceFactor(112),
EquipForce(9999),
;
private int propertyId;

View File

@ -748,16 +748,21 @@ public class HeroLogic {
combinedAttribute(sDifferDemonsComonpentsConfig.getBaseAttribute(),heroAllAttribute);
}
}
//装备总战力评分
int equipForce=0;
for(String equipId:values){
Equip equip = equipManager.getEquipMap().get(equipId);
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
combinedAttribute(propertyValueByIdMap,heroAllAttribute);
combinedAttribute(secondValueByIdMap,heroAllAttribute);
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equip.getEquipId());
equipForce+=sEquipConfig.getScore();
}
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
calInteractAdd(heroAllAttribute);
//装备战力保存
heroAllAttribute.put(HeroAttributeEnum.EquipForce.getPropertyId(),equipForce);
return heroAllAttribute;
}
@ -798,6 +803,9 @@ public class HeroLogic {
Map<Integer, Integer> heroAllAttribute = user.getMapManager().getHeroAllAttributeByHeroId(hero.getId());
//食物buffer加成
Map<Integer, Integer> foodAddMap = CombatLogic.getInstance().attributeByEatFood(user,GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON);
if(foodAddMap.isEmpty()){
return heroAllAttribute;
}
combinedAttribute(foodAddMap,heroAllAttribute);
calInteractAdd(heroAllAttribute);
return heroAllAttribute;
@ -806,10 +814,20 @@ public class HeroLogic {
public int calHeoForce(User user, Hero hero){
Map<Integer, Integer> heroAllAttribute = calHeroFinalAttributeWhenInMap(user, hero);
//战力保存
int force = calForce(heroAllAttribute);
return force + heroAllAttribute.get(HeroAttributeEnum.EquipForce.getPropertyId());
}
private int calForce( Map<Integer, Integer> heroAllAttribute ){
double result = 0;
for(Map.Entry<Integer, Integer> item : heroAllAttribute.entrySet()){
Integer propertyId = item.getKey();
Integer propertyValue = item.getValue();
if(propertyId == HeroAttributeEnum.EquipForce.getPropertyId()){
LOGGER.info("the equipScore={}",propertyValue);
continue;
}
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(propertyId);
float score = sPropertyConfig.getScore();
LOGGER.info("the value is ={},propertyValue={},score={}",propertyValue*score,propertyValue,score);
@ -883,8 +901,9 @@ public class HeroLogic {
}
hero.updateMutliEquipPositionMap(equipInfoTmp);
// LOGGER.info("the heroTid={},the force={}",hero.getTemplateId(),calHeoForce(user,hero));
Map<Integer, Integer> heroNotBufferAttribute = calHeroNotBufferAttribute(user, hero);
int force = calForce(heroNotBufferAttribute) + heroNotBufferAttribute.get(HeroAttributeEnum.EquipForce.getPropertyId());
LOGGER.info("the heroTid={},the force={}",hero.getTemplateId(),force);
//发送成功消息
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE_VALUE,null,true);