大闹天宫优化
parent
0cf8bb430b
commit
92a1305eaf
|
@ -9,10 +9,7 @@ import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.util.KeyGenUtils;
|
import com.ljsd.jieling.util.KeyGenUtils;
|
||||||
import com.ljsd.jieling.util.UUIDEnum;
|
import com.ljsd.jieling.util.UUIDEnum;
|
||||||
import config.SCHero;
|
import config.*;
|
||||||
import config.SCHeroRankUpConfig;
|
|
||||||
import config.SEndlessHeroProp;
|
|
||||||
import config.SEquipConfig;
|
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -104,7 +101,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化英雄
|
* 初始化英雄,不入英雄背包
|
||||||
* @param uid
|
* @param uid
|
||||||
* @param heroTid
|
* @param heroTid
|
||||||
* @param level
|
* @param level
|
||||||
|
@ -124,6 +121,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
||||||
this.speed = hero.speed;
|
this.speed = hero.speed;
|
||||||
this.especialEquipLevel = hero.especialEquipLevel;
|
this.especialEquipLevel = hero.especialEquipLevel;
|
||||||
this.createType = 1;
|
this.createType = 1;
|
||||||
|
this.godSoulLv = Optional.ofNullable(STableManager.getConfig(SRobotProperty.class).get(level)).map(SRobotProperty::getSpirits).orElse(0);
|
||||||
// 这个参数需要到外边处理
|
// 这个参数需要到外边处理
|
||||||
this.jewelInfo = new HashSet<>(hero.getJewelInfo());
|
this.jewelInfo = new HashSet<>(hero.getJewelInfo());
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class BattleNode extends AbstractExpedition {
|
||||||
Map<Integer,Long> longAttribute = new HashMap<>();
|
Map<Integer,Long> longAttribute = new HashMap<>();
|
||||||
robotHeroAttribute.forEach((k,v)->longAttribute.put(k,(long)v));
|
robotHeroAttribute.forEach((k,v)->longAttribute.put(k,(long)v));
|
||||||
force+=HeroLogic.getInstance().calForce(longAttribute);
|
force+=HeroLogic.getInstance().calForce(longAttribute);
|
||||||
heroAllAttribute.put(id.toString(), new FamilyHeroInfo(id, property.getId(), property.getStar(), longAttribute,innerPosition++,0));
|
heroAllAttribute.put(id.toString(), new FamilyHeroInfo(id, property.getId(), property.getStar(), longAttribute,innerPosition++,property.getSpirits()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fightInfo.setForce(force);
|
fightInfo.setForce(force);
|
||||||
|
|
|
@ -186,22 +186,10 @@ public class ExpeditionLogic {
|
||||||
if (newlay != nodeInfo1.getLay() && nodeInfo1.getLay() != oldlay) {
|
if (newlay != nodeInfo1.getLay() && nodeInfo1.getLay() != oldlay) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if(passNode!=nodeInfo1.getSortId()&& !nextNodeId.contains(nodeInfo1.getSortId())){
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
int state = nodeInfo1.getLay() == oldlay ? (nodeInfo1.getSortId() == passNode ? ExpeditionLogic.NODESTATE_PASS : ExpeditionLogic.NODESTATE_OVER_PASS) : nextNodeId.contains(nodeInfo1.getSortId())?ExpeditionLogic.NODESTATE_NOT_PASS:ExpeditionLogic.NODESTATE_CLOSE;
|
int state = nodeInfo1.getLay() == oldlay ? (nodeInfo1.getSortId() == passNode ? ExpeditionLogic.NODESTATE_PASS : ExpeditionLogic.NODESTATE_OVER_PASS) : nextNodeId.contains(nodeInfo1.getSortId())?ExpeditionLogic.NODESTATE_NOT_PASS:ExpeditionLogic.NODESTATE_CLOSE;
|
||||||
nodeInfo1.setState(state);
|
nodeInfo1.setState(state);
|
||||||
|
|
||||||
// if(nodeInfo1.getType()==ExpeditionLogic.NODETYPE_SHOP&&newlay==nodeInfo1.getLay()){
|
|
||||||
// try {
|
|
||||||
// //更新商店
|
|
||||||
// StoreLogic.initOneStore(user, 56);
|
|
||||||
// }catch (Exception e){
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//最后的奖励节点 前端显示跳转入口用
|
//最后的奖励节点 前端显示跳转入口用
|
||||||
if( nodeInfo1.getLay() == oldlay&&nodeInfo1.getType()==ExpeditionLogic.NODETYPE_REWARD){
|
if( nodeInfo1.getLay() == oldlay&&nodeInfo1.getType()==ExpeditionLogic.NODETYPE_REWARD){
|
||||||
if(user.getExpeditionManager().getExpeditionLeve()<=2){
|
if(user.getExpeditionManager().getExpeditionLeve()<=2){
|
||||||
|
@ -442,6 +430,7 @@ public class ExpeditionLogic {
|
||||||
builder1.setStar(familyHeroInfo.getStar());
|
builder1.setStar(familyHeroInfo.getStar());
|
||||||
builder1.setRemainHp(heroHP.get(s));
|
builder1.setRemainHp(heroHP.get(s));
|
||||||
builder1.setPosition(familyHeroInfo.getPosition());
|
builder1.setPosition(familyHeroInfo.getPosition());
|
||||||
|
builder1.setGodSoulLev(familyHeroInfo.getGodSoulLv());
|
||||||
builders.add(builder1.build());
|
builders.add(builder1.build());
|
||||||
});
|
});
|
||||||
builder.addAllHero(builders);
|
builder.addAllHero(builders);
|
||||||
|
@ -606,9 +595,9 @@ public class ExpeditionLogic {
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"英雄表id不存在:"+heroTid);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL,"英雄表id不存在:"+heroTid);
|
||||||
}
|
}
|
||||||
// 最高等级
|
// 最高等级
|
||||||
level = level>scHero.getMaxLevel()?scHero.getMaxLevel():level;
|
level = Math.min(level, scHero.getMaxLevel());
|
||||||
// 最低20级
|
// 最低20级
|
||||||
level = level<20?20:level;
|
level = Math.max(level, 20);
|
||||||
//创建新的英雄
|
//创建新的英雄
|
||||||
Hero newHero = new Hero(hero,user.getId(),heroTid,level);
|
Hero newHero = new Hero(hero,user.getId(),heroTid,level);
|
||||||
// 魂宝灵宝,魂印需要走表
|
// 魂宝灵宝,魂印需要走表
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class SpecialNode extends AbstractExpedition {
|
||||||
int force = HeroLogic.getInstance().calForce(longAttribute);
|
int force = HeroLogic.getInstance().calForce(longAttribute);
|
||||||
fightInfo.setForce(force);
|
fightInfo.setForce(force);
|
||||||
//试炼节点 放到第二个位置上
|
//试炼节点 放到第二个位置上
|
||||||
heroAllAttribute.put(Integer.toString(heroId), new FamilyHeroInfo(heroId,level,robot.getStar(),longAttribute,2,0));
|
heroAllAttribute.put(Integer.toString(heroId), new FamilyHeroInfo(heroId,level,robot.getStar(),longAttribute,2,robot.getGodSoulLev()));
|
||||||
fightInfo.updateHeroSkill(String.valueOf(heroId),skills.substring(0,skills.length()-1));
|
fightInfo.updateHeroSkill(String.valueOf(heroId),skills.substring(0,skills.length()-1));
|
||||||
// 获取灵兽信息
|
// 获取灵兽信息
|
||||||
SRobotProperty property = STableManager.getConfig(SRobotProperty.class).get(level);
|
SRobotProperty property = STableManager.getConfig(SRobotProperty.class).get(level);
|
||||||
|
|
|
@ -642,6 +642,7 @@ public class FightUtil {
|
||||||
robotInfo.setRobotHeroAttribute(HeroLogic.getInstance().calRobotHeroAttribute(property));
|
robotInfo.setRobotHeroAttribute(HeroLogic.getInstance().calRobotHeroAttribute(property));
|
||||||
robotInfo.setSkill(SRobotSkill.getSkill(heroTid));
|
robotInfo.setSkill(SRobotSkill.getSkill(heroTid));
|
||||||
robotInfo.setPassiveSkill(SRobotSkill.getPassiveSkill(heroTid, property.getSkillPool() - 1));
|
robotInfo.setPassiveSkill(SRobotSkill.getPassiveSkill(heroTid, property.getSkillPool() - 1));
|
||||||
|
robotInfo.setGodSoulLev(property.getSpirits());
|
||||||
return robotInfo;
|
return robotInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,15 @@ public class RobotInfo {
|
||||||
private Map<Integer, Integer> robotHeroAttribute;
|
private Map<Integer, Integer> robotHeroAttribute;
|
||||||
private String skill;
|
private String skill;
|
||||||
private String passiveSkill;
|
private String passiveSkill;
|
||||||
|
private int godSoulLev;
|
||||||
|
|
||||||
|
public int getGodSoulLev() {
|
||||||
|
return godSoulLev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGodSoulLev(int godSoulLev) {
|
||||||
|
this.godSoulLev = godSoulLev;
|
||||||
|
}
|
||||||
|
|
||||||
public int getHeroTid() {
|
public int getHeroTid() {
|
||||||
return heroTid;
|
return heroTid;
|
||||||
|
|
|
@ -5688,15 +5688,13 @@ public class HeroLogic {
|
||||||
*/
|
*/
|
||||||
public int getAverageLevel(User user, int averageNum) throws ErrorCodeException {
|
public int getAverageLevel(User user, int averageNum) throws ErrorCodeException {
|
||||||
HeroManager heroManager = user.getHeroManager();
|
HeroManager heroManager = user.getHeroManager();
|
||||||
|
// 获取平均数量
|
||||||
int num = heroManager.getHeroMap().size() > averageNum ? averageNum : heroManager.getHeroMap().size();
|
int num = Math.min(heroManager.getHeroMap().size(), averageNum);
|
||||||
|
|
||||||
// 获取玩家全部英雄
|
// 获取玩家全部英雄
|
||||||
Collection<Hero> values = heroManager.getHeroMap().values();
|
List<Hero> heroes = heroManager.getHeroMap().values().stream()
|
||||||
List<Hero> heroes = new ArrayList<>(values);
|
.sorted(Comparator.comparing(v -> v.getLevel(heroManager), Comparator.reverseOrder()))
|
||||||
|
.collect(Collectors.toList())
|
||||||
// 玩家英雄背包按等级排
|
.subList(0, num);
|
||||||
Collections.sort(heroes);
|
|
||||||
// 等级相加
|
// 等级相加
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
|
|
|
@ -17,6 +17,8 @@ public class SRobotProperty implements BaseConfig {
|
||||||
private int skillPool;
|
private int skillPool;
|
||||||
|
|
||||||
private int[][] animal;
|
private int[][] animal;
|
||||||
|
|
||||||
|
private int spirits;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
|
@ -43,4 +45,8 @@ public class SRobotProperty implements BaseConfig {
|
||||||
public int[][] getAnimal() {
|
public int[][] getAnimal() {
|
||||||
return animal;
|
return animal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSpirits() {
|
||||||
|
return spirits;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue