大闹天宫优化

back_recharge
duhui 2021-12-06 15:35:18 +08:00
parent 0cf8bb430b
commit 92a1305eaf
8 changed files with 30 additions and 29 deletions

View File

@ -9,10 +9,7 @@ import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.util.KeyGenUtils;
import com.ljsd.jieling.util.UUIDEnum;
import config.SCHero;
import config.SCHeroRankUpConfig;
import config.SEndlessHeroProp;
import config.SEquipConfig;
import config.*;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -104,7 +101,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
}
/**
*
* ,
* @param uid
* @param heroTid
* @param level
@ -124,6 +121,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
this.speed = hero.speed;
this.especialEquipLevel = hero.especialEquipLevel;
this.createType = 1;
this.godSoulLv = Optional.ofNullable(STableManager.getConfig(SRobotProperty.class).get(level)).map(SRobotProperty::getSpirits).orElse(0);
// 这个参数需要到外边处理
this.jewelInfo = new HashSet<>(hero.getJewelInfo());
}

View File

@ -200,7 +200,7 @@ public class BattleNode extends AbstractExpedition {
Map<Integer,Long> longAttribute = new HashMap<>();
robotHeroAttribute.forEach((k,v)->longAttribute.put(k,(long)v));
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);

View File

@ -186,22 +186,10 @@ public class ExpeditionLogic {
if (newlay != nodeInfo1.getLay() && nodeInfo1.getLay() != oldlay) {
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;
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(user.getExpeditionManager().getExpeditionLeve()<=2){
@ -442,6 +430,7 @@ public class ExpeditionLogic {
builder1.setStar(familyHeroInfo.getStar());
builder1.setRemainHp(heroHP.get(s));
builder1.setPosition(familyHeroInfo.getPosition());
builder1.setGodSoulLev(familyHeroInfo.getGodSoulLv());
builders.add(builder1.build());
});
builder.addAllHero(builders);
@ -606,9 +595,9 @@ public class ExpeditionLogic {
throw new ErrorCodeException(ErrorCode.CFG_NULL,"英雄表id不存在:"+heroTid);
}
// 最高等级
level = level>scHero.getMaxLevel()?scHero.getMaxLevel():level;
level = Math.min(level, scHero.getMaxLevel());
// 最低20级
level = level<20?20:level;
level = Math.max(level, 20);
//创建新的英雄
Hero newHero = new Hero(hero,user.getId(),heroTid,level);
// 魂宝灵宝,魂印需要走表

View File

@ -70,7 +70,7 @@ public class SpecialNode extends AbstractExpedition {
int force = HeroLogic.getInstance().calForce(longAttribute);
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));
// 获取灵兽信息
SRobotProperty property = STableManager.getConfig(SRobotProperty.class).get(level);

View File

@ -642,6 +642,7 @@ public class FightUtil {
robotInfo.setRobotHeroAttribute(HeroLogic.getInstance().calRobotHeroAttribute(property));
robotInfo.setSkill(SRobotSkill.getSkill(heroTid));
robotInfo.setPassiveSkill(SRobotSkill.getPassiveSkill(heroTid, property.getSkillPool() - 1));
robotInfo.setGodSoulLev(property.getSpirits());
return robotInfo;
}

View File

@ -17,6 +17,15 @@ public class RobotInfo {
private Map<Integer, Integer> robotHeroAttribute;
private String skill;
private String passiveSkill;
private int godSoulLev;
public int getGodSoulLev() {
return godSoulLev;
}
public void setGodSoulLev(int godSoulLev) {
this.godSoulLev = godSoulLev;
}
public int getHeroTid() {
return heroTid;

View File

@ -5688,15 +5688,13 @@ public class HeroLogic {
*/
public int getAverageLevel(User user, int averageNum) throws ErrorCodeException {
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 = new ArrayList<>(values);
// 玩家英雄背包按等级排
Collections.sort(heroes);
List<Hero> heroes = heroManager.getHeroMap().values().stream()
.sorted(Comparator.comparing(v -> v.getLevel(heroManager), Comparator.reverseOrder()))
.collect(Collectors.toList())
.subList(0, num);
// 等级相加
int count = 0;
for (int i = 0; i < num; i++) {

View File

@ -17,6 +17,8 @@ public class SRobotProperty implements BaseConfig {
private int skillPool;
private int[][] animal;
private int spirits;
@Override
public void init() throws Exception {
@ -43,4 +45,8 @@ public class SRobotProperty implements BaseConfig {
public int[][] getAnimal() {
return animal;
}
public int getSpirits() {
return spirits;
}
}