山河社稷图优化

back_recharge
xuexinpeng 2021-05-18 13:57:07 +08:00
parent 9cb30eb9da
commit 30ebef6856
2 changed files with 15 additions and 37 deletions

View File

@ -36,19 +36,17 @@ public class HardStageManager extends MongoBase {
return map;
}
//初始化第一章第一节
HardStageChapter chapter = initChapter(nodeOne.getChapter());
HardStageNode node = initNode(nodeOne, chapter.getChapterId());
//chapter.init(this.getRootId(), getMongoKey() + ".chapterMap." + chapter.getChapterId());
HardStageNode node = initNode(nodeOne);
chapter.addNodeList(node);
setCurNode(node.getId());
//setCurNode(node.getId());
map.put(chapter.getChapterId(), chapter);
setCurChapter(chapter.getChapterId());
updateString("chapterMap." + chapter.getChapterId(), chapter);
return map;
}
private HardStageNode initNode(SHardStage config, int chapterId) {
private HardStageNode initNode(SHardStage config) {
HardStageNode node = new HardStageNode();
//node.init(this.getRootId(),getMongoKey()+".chapterMap."+chapterId+".nodeList");
node.setId(config.getId());
@ -73,11 +71,6 @@ public class HardStageManager extends MongoBase {
chapter.updateRewardMap();
});
}
/* for (SHardStageReward config : reward) {
chapter.getRewardMap().put(config.getId(), Boolean.FALSE);
chapter.updateRewardMap();
}*/
setCurChapter(chapterId);
return chapter;
}
@ -93,7 +86,7 @@ public class HardStageManager extends MongoBase {
}
HardStageChapter chapter;
chapter = chapterMap.computeIfAbsent(config.getChapter(), k -> initChapter(config.getChapter()));
HardStageNode node = initNode(config, chapter.getChapterId());
HardStageNode node = initNode(config);
chapter.addNodeList(node);
/*if(chapterMap.containsKey(config.getChapter())){
chapter = chapterMap.get(config.getChapter());
@ -110,7 +103,7 @@ public class HardStageManager extends MongoBase {
chapterMap.put(config.getChapter(),chapter);
setCurChapter(chapter.getChapterId());
}*/
updateString("chapterMap." + chapter.getChapterId(), chapterMap.get(chapter.getChapterId()));
//updateString("chapterMap." + chapter.getChapterId(), chapterMap.get(chapter.getChapterId()));
}
public int getCurChapter() {

View File

@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Arrays;
import java.util.stream.Stream;
public class HardStageLogic {
@ -41,7 +42,6 @@ public class HardStageLogic {
public static CommonProto.HardStageInfo.Builder getInfo(User user) throws Exception {
Map<Integer, HardStageChapter> map = user.getHardStageManager().getChapterMap(user);
CommonProto.HardStageInfo.Builder builder = CommonProto.HardStageInfo.newBuilder();
for (Map.Entry<Integer, HardStageChapter> entry : map.entrySet()) {
//章节信息
CommonProto.HardStageChapter.Builder chapterBuilder = CommonProto.HardStageChapter.newBuilder();
@ -106,7 +106,6 @@ public class HardStageLogic {
//当前战斗的星星状态
StringBuffer currenState = StringUtil.intArrToStringArr(num);
;
//已存在的星星状态
StringBuffer existState = reformatBinary(currentStar);
//荣耀三星
@ -156,11 +155,13 @@ public class HardStageLogic {
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
//只能使用一个神将 复制为6个神将 6是否需要写死
SHardStageBuff buff = SHardStageBuff.getConfigMap().get(nodeConfig.getHardStageBuff());
if (buff.getType() == hardStageBuffCopy && teamPosHeroInfos.size() == 1) {
int position = teamPosHeroInfos.get(0).getPosition();
for (int i = 1; i <= 6; i++) {
if (position != i) {
teamPosHeroInfos.add(new TeamPosHeroInfo(teamPosHeroInfos.get(0).getHeroId(), i));
if(buff != null){
if (buff.getType() == hardStageBuffCopy && teamPosHeroInfos.size() == 1) {
int position = teamPosHeroInfos.get(0).getPosition();
for (int i = 1; i <= 6; i++) {
if (position != i) {
teamPosHeroInfos.add(new TeamPosHeroInfo(teamPosHeroInfos.get(0).getHeroId(), i));
}
}
}
}
@ -207,7 +208,6 @@ public class HardStageLogic {
//TOO 添加被动技能
String pokenmonPassiveSkills = HeroLogic.getInstance().getPokenmonPassiveSkills(user, teamId);
return CommonProto.FightTeamInfo.
newBuilder()
.addAllFightUnitList(heroFightInfos)
@ -230,7 +230,6 @@ public class HardStageLogic {
if (node.getType() == 1) {//大节点
int star = passReward(user, node, resultNum, dropList);//星级通关奖励
chapterMap.get(nodeConfig.getChapter()).addStars(star);
if (!node.isHasPass()) {
node.setHasPass(true);
dropList.addAll(getFirstRewards(user, nodeConfig));//关卡通过奖励
@ -250,16 +249,8 @@ public class HardStageLogic {
node.setState(1);
dropList.addAll(getFirstRewards(user, nodeConfig));//关卡通过奖励
user.getHardStageManager().updateString("chapterMap." + nodeConfig.getChapter(), chapterMap.get(nodeConfig.getChapter()));
//return;
}
//node.setHasPass(true);
//dropList.addAll(getFirstRewards(user,nodeConfig));
}
/* List<SHardStage> openList = SHardStage.getPreList(nodeConfig.getId());
for(SHardStage stage : openList){
user.getHardStageManager().openNewNode(user,stage);
}*/
sendHardStageIndication(user);
}
@ -278,7 +269,6 @@ public class HardStageLogic {
*
*/
public static CommonProto.Drop.Builder getReward(User user, int rewardId) throws Exception {
//ItemMap itemObj = new ItemMap();
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{rewardId}, 1, 0, BIReason.HARD_STAGE_GET);
return drop;
}
@ -306,14 +296,9 @@ public class HardStageLogic {
*/
public static void refreshInfoByLevel(User user) throws Exception {
int curNodeId = user.getHardStageManager().getCurNode();
if (curNodeId == 0) {
int chapterId = user.getHardStageManager().getCurChapter();
if (curNodeId == 0 && chapterId == 0) {
user.getHardStageManager().getChapterMap(user);
} else {
/*SHardStage nodeConfig = SHardStage.getConfigMap().get(curNodeId);
List<SHardStage> openList = SHardStage.getPreList(nodeConfig.getId());
for(SHardStage stage : openList){
user.getHardStageManager().openNewNode(user,stage);
}*/
}
sendHardStageIndication(user);
}