逻辑优化
parent
e98ff31de5
commit
2a24bf37df
|
@ -121,7 +121,7 @@ public class CombatLogic {
|
|||
}
|
||||
return value;
|
||||
}
|
||||
public Map<String, Map<Integer, Long>> bufferAddByEatFoodOrEventTrigger(int foodIdOrEventId, Map<String, Map<Integer, Long>> heroAllAttributeMap ) throws Exception {
|
||||
public Map<String, Map<Integer, Long>> bufferAddByEatFoodOrEventTrigger(int foodIdOrEventId, Map<String, Map<Integer, Long>> heroAllAttributeMap ) {
|
||||
SFoodsConfig sFoodsConfig = STableManager.getConfig(SFoodsConfig.class).get(foodIdOrEventId);
|
||||
int typeTmp = sFoodsConfig.getType();
|
||||
int targetTmp = sFoodsConfig.getTarget();
|
||||
|
@ -151,7 +151,7 @@ public class CombatLogic {
|
|||
mapManager.eatFood(foodIdOrEventId,contiue);
|
||||
}
|
||||
|
||||
public void updateHeroAttributeJustOne(User user,List<TeamPosHeroInfo> teamPosHeroInfoList,SFoodsConfig sFoodsConfig, Map<String, Map<Integer, Long>> heroAllAttributeMap,boolean isRecory){
|
||||
// public void updateHeroAttributeJustOne(User user,List<TeamPosHeroInfo> teamPosHeroInfoList,SFoodsConfig sFoodsConfig, Map<String, Map<Integer, Long>> heroAllAttributeMap,boolean isRecory){
|
||||
// Map<Integer,Long> foodAddMap = new HashMap<>();
|
||||
// getFoodAttributeAdd(GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON, foodAddMap, sFoodsConfig);
|
||||
// for (TeamPosHeroInfo heroInfo : teamPosHeroInfoList) {
|
||||
|
@ -173,7 +173,7 @@ public class CombatLogic {
|
|||
// heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
||||
// }
|
||||
// user.getMapManager().setHeroAllAttributeMap(heroAllAttributeMap);
|
||||
}
|
||||
// }
|
||||
|
||||
public Map<Integer,Long> attributeByEatFood( User user,int type,int target){
|
||||
Map<Integer,Long> foddAddResult = new HashMap<>();
|
||||
|
@ -214,7 +214,7 @@ public class CombatLogic {
|
|||
public void takeNewAdventureReward(ISession session,int type,int position) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
Map<Integer, CommonProto.Drop> adventureFastReward =null;
|
||||
Map<Integer, CommonProto.Drop> adventureFastReward;
|
||||
if(type == 2){
|
||||
adventureFastReward = getNewAdventureReward(user,false,(int)(TimeUtils.now()/1000));
|
||||
if(adventureFastReward.get(1).getItemlistCount()==0){
|
||||
|
@ -582,7 +582,7 @@ public class CombatLogic {
|
|||
break;
|
||||
}
|
||||
hps.put(0,adventureBoss.getRemainHps());
|
||||
monsterByGroup = MonsterUtil.getMonsterByGroup(bossGroupId,hps);
|
||||
MonsterUtil.getMonsterByGroup(bossGroupId, hps);
|
||||
// monsterGroupList = BehaviorUtil.getFightTeamInfos(bossGroupId,monsterByGroup, Global.MONSTER_1);
|
||||
//设置战斗随机种子
|
||||
seed = (int)(System.currentTimeMillis()/1000);
|
||||
|
@ -608,7 +608,7 @@ public class CombatLogic {
|
|||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_RESPONSE_VALUE,build,true);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.PlAY_STORY,999,i);
|
||||
}catch (Exception e){
|
||||
LOGGER.error("the exception={}",e);
|
||||
LOGGER.error("the exception=",e);
|
||||
}finally {
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,KTGameType.CHALLENGE_SECURE.getIndex(),bossGroupId);
|
||||
RedisUtil.getInstence().releaseDistributedLock(RedisKey.ADVENTRUEN_BOSS_CHALLENGE_LOCK_KEY,bossId, Integer.toString(uid));
|
||||
|
@ -662,7 +662,7 @@ public class CombatLogic {
|
|||
}
|
||||
List<Long> result = fight.getRemainHp();
|
||||
for (int i = 0; i < oldRemainHp.size(); i++) {
|
||||
hurt += (oldRemainHp.get(i) - result.get(i));
|
||||
hurt += (int) (oldRemainHp.get(i) - result.get(i));
|
||||
}
|
||||
adventureBoss.setRemainHp(adventureBoss.getRemainHp() - hurt);
|
||||
adventureBoss.setRemainHps(result);
|
||||
|
@ -710,7 +710,6 @@ public class CombatLogic {
|
|||
|
||||
/**
|
||||
* 发送结算奖励
|
||||
* @throws Exception
|
||||
*/
|
||||
public void sendReward() throws Exception {
|
||||
String title=SErrorCodeEerverConfig.getI18NMessage("adventure_boss_reward_title");
|
||||
|
@ -885,13 +884,13 @@ public class CombatLogic {
|
|||
|
||||
public static <K, V extends Comparable<? super V>> Map<K, V> sortByValueDescending(Map<K, V> map)
|
||||
{
|
||||
List<Map.Entry<K, V>> list = new LinkedList<Map.Entry<K, V>>(map.entrySet());
|
||||
List<Map.Entry<K, V>> list = new LinkedList<>(map.entrySet());
|
||||
list.sort((o1, o2) -> {
|
||||
int compare = (o1.getValue()).compareTo(o2.getValue());
|
||||
return -compare;
|
||||
});
|
||||
|
||||
Map<K, V> result = new LinkedHashMap<K, V>();
|
||||
Map<K, V> result = new LinkedHashMap<>();
|
||||
for (Map.Entry<K, V> entry : list) {
|
||||
result.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
@ -985,7 +984,7 @@ public class CombatLogic {
|
|||
String randomReward = ItemUtil.getReward(itemRandom);
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("adventuren_reward_of_viplevel_content",new Object[]{vipLevel},new int[0],"#");
|
||||
|
||||
if(randomReward.length()!=0){
|
||||
if(!randomReward.isEmpty()){
|
||||
reward = reward + "|" + randomReward;
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,time, Global.MAIL_EFFECTIVE_TIME);
|
||||
mainLevelManager.afterTakeStateReward(true,0,time);
|
||||
|
@ -1006,7 +1005,7 @@ public class CombatLogic {
|
|||
|
||||
private static void removeNoUseItem(User user,Map<Integer,Long> itemMap){
|
||||
Map<Integer, SExchangeActivityConfig> config = STableManager.getConfig(SExchangeActivityConfig.class);
|
||||
if(config.size()<1){
|
||||
if(config.isEmpty()){
|
||||
return;
|
||||
}
|
||||
Set<Integer> removeItem = new HashSet<>();
|
||||
|
@ -1034,45 +1033,39 @@ public class CombatLogic {
|
|||
|
||||
/**
|
||||
* 将挂机和急速探索的装备合成起来
|
||||
* @param equipMap
|
||||
* @return
|
||||
*/
|
||||
private static Map<Integer,Integer> equipAutoCombine(Map<Integer,Integer> equipMap){
|
||||
if(equipMap.isEmpty())
|
||||
return equipMap;
|
||||
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
|
||||
Map<Integer,Integer> tempMap = new ConcurrentHashMap<>();
|
||||
for(Map.Entry<Integer,Integer> entry:equipMap.entrySet()) {
|
||||
tempMap.put(entry.getKey(),entry.getValue());
|
||||
}
|
||||
tempMap.putAll(equipMap);
|
||||
boolean isOver;
|
||||
int count = 0;
|
||||
do {
|
||||
isOver = true;
|
||||
Iterator<Map.Entry<Integer, Integer>> it = tempMap.entrySet().iterator();
|
||||
while(it.hasNext()){
|
||||
Map.Entry<Integer, Integer> entry = it.next();
|
||||
for (Map.Entry<Integer, Integer> entry : tempMap.entrySet()) {
|
||||
int key = entry.getKey();
|
||||
int value = entry.getValue();
|
||||
SEquipConfig sEquipConfig = config.get(key);
|
||||
if(sEquipConfig==null)
|
||||
if (sEquipConfig == null)
|
||||
continue;
|
||||
int star = sEquipConfig.getStar();
|
||||
SEquipStarsConfig sEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(star);
|
||||
int createCount = value / sEquipStarsConfig.getRankupCount();
|
||||
if(createCount==0){
|
||||
if (createCount == 0) {
|
||||
continue;
|
||||
}
|
||||
int position = sEquipConfig.getPosition();
|
||||
tempMap.put(key, value%sEquipStarsConfig.getRankupCount());
|
||||
tempMap.put(key, value % sEquipStarsConfig.getRankupCount());
|
||||
SEquipConfig createConfig = SEquipConfig.positionStarMap.get(position).get(star + 1);
|
||||
|
||||
if(createConfig==null)
|
||||
if (createConfig == null)
|
||||
continue;
|
||||
|
||||
int createId = createConfig.getId();
|
||||
|
||||
tempMap.put(createId,tempMap.getOrDefault(createId, 0)+createCount);
|
||||
tempMap.put(createId, tempMap.getOrDefault(createId, 0) + createCount);
|
||||
isOver = false;
|
||||
}
|
||||
count++;
|
||||
|
|
|
@ -3465,6 +3465,7 @@ public class HeroLogic {
|
|||
public int calForce(Map<Integer, Long> heroAllAttribute) {
|
||||
double forceNum = 0;//基础值
|
||||
double forceAdd = 0;//加成值
|
||||
// LOGGER.error("总属性=============> {}",heroAllAttribute);
|
||||
//战力计算
|
||||
for(Map.Entry<Integer, Long> item : heroAllAttribute.entrySet()){
|
||||
Integer propertyId = item.getKey();
|
||||
|
@ -3487,7 +3488,7 @@ public class HeroLogic {
|
|||
// BigDecimal bg = new BigDecimal(forceAdd).setScale(4, RoundingMode.UP);
|
||||
// float v = bg.floatValue();
|
||||
double result = (forceAdd + 1) * forceNum;
|
||||
// LOGGER.info("战力总结果==============={},{},{}",forceNum,forceAdd,result);
|
||||
// LOGGER.error("战力总结果==============={},{},{}",forceNum,forceAdd,result);
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue