山河社稷图
parent
6677d92b45
commit
79ffc31fa8
|
@ -23,6 +23,7 @@ public enum FightType {
|
|||
Firend(17),//好友
|
||||
TowerMap(18),//森罗幻境
|
||||
TaSuiLingXiao(19),//踏碎凌霄
|
||||
HardStage(20),//山河社稷图
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
@ -98,6 +98,7 @@ public interface GlobalsDef {
|
|||
int DEATH_PATH_TEAM = 1201;//十绝阵
|
||||
int CHAMPION_TEAM = 1301; //巅峰赛
|
||||
int WORLD_TEAM_ARENA_DEFENSE =1601;//跨服竞技场防御编队
|
||||
int HARD_STAGE_TEAM = 1701;//山河社稷图队伍
|
||||
|
||||
//特权解锁类型
|
||||
int LEVEL_UNLOCK_PRIVILEGE = 1;
|
||||
|
|
|
@ -105,7 +105,7 @@ public class RedisKey {
|
|||
public static final String CHALLENGE_MONSTER_ATTACK = "CHALLENGE_MONSTER_ATTACK";
|
||||
public static final String CHALLENGE_EXPEDITION_INFO = "CHALLENGE_EXPEDITION_INFO";
|
||||
|
||||
|
||||
public static final String HARD_STAGE_BATTLE = "HARD_STAGE_BATTLE";
|
||||
|
||||
public static final String ARENA_RRECORD = "ARENA_RRECORD";
|
||||
|
||||
|
|
|
@ -329,4 +329,5 @@ public interface BIReason {
|
|||
int EQUIP_UPLEVEL_COST = 1092;//装备升星消耗
|
||||
int EQUIP_UPLEVEL_REWARD = 1093;//装备升星获得
|
||||
int TA_SUI_LING_XIAO = 1094;//踏碎凌霄
|
||||
int HARD_STAGE = 1095;
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package com.ljsd.jieling.handler.hardStage;
|
||||
|
||||
import com.ljsd.fight.CheckFight;
|
||||
import com.ljsd.fight.FightType;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.FightUtil;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.hardStage.HardStageChapter;
|
||||
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.FightDataUtil;
|
||||
import com.ljsd.jieling.util.MonsterUtil;
|
||||
import config.SHardStage;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.Expedition;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.HardStageFightRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.HARD_STAGE_FIGHT_START_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.HardStageFightRequest proto) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
int nodeId = proto.getNodeId();
|
||||
int teamId = proto.getTeamId();
|
||||
SHardStage nodeConfig = SHardStage.getConfigMap().get(nodeId);
|
||||
Map<Integer, HardStageChapter> chapterMap = user.getHardStageManager().getChapterMap();
|
||||
if(!chapterMap.containsKey(nodeConfig.getChapter()) || chapterMap.get(nodeConfig.getChapter()).getNode(nodeId) == null){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点不存在或未开启"));
|
||||
}
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("阵容有误!!"));
|
||||
}
|
||||
int seed = (int)(System.currentTimeMillis()/1000);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = HardStageLogic.getFightTeamInfo(user,teamId,nodeConfig);
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterfightTeamInfos = MonsterUtil.getHardStageMonsterByGroup(nodeConfig);
|
||||
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(nodeConfig.getMonsterGroup());
|
||||
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(monsterfightTeamInfos,monsterPokemonByGroup, Global.MONSTER_1);
|
||||
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(user.getId()+"");
|
||||
long[] fightResult = CheckFight.getInstance().checkFight(seed, 20, getFightData, getOptionData, FightType.HardStage);
|
||||
|
||||
int resultCode = (int) fightResult[0];
|
||||
if (resultCode == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
}
|
||||
|
||||
if(resultCode == 1){//通过
|
||||
HardStageLogic.passNode(iSession,nodeConfig,0);
|
||||
}else{
|
||||
HardStageLogic.passNode(iSession,nodeConfig,0);
|
||||
}
|
||||
|
||||
|
||||
String fightInfo = nodeId + "#" +seed+ "#" + teamId;
|
||||
String key = RedisKey.getKey(RedisKey.HARD_STAGE_BATTLE, String.valueOf(iSession.getUid()), false);
|
||||
RedisUtil.getInstence().set(key, fightInfo, -1);
|
||||
|
||||
FightResult.Builder builder = FightResult.newBuilder();
|
||||
builder.setCheckResult(fightResult);
|
||||
builder.setSeed(seed);
|
||||
builder.setFightTeamInfo(fightTeamInfo);
|
||||
builder.setMonsterTeamList(monsterGroupList);
|
||||
String fightId = FightUtil.getFightId(user.getId(),FightType.HardStage.getType());
|
||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||
.setFightType(FightType.HardStage.getType())
|
||||
.setHeroFightInfos(fightTeamInfo)
|
||||
.addAllMonsterList(monsterGroupList)
|
||||
.setFightSeed(seed)
|
||||
.setFightMaxTime(20)
|
||||
.setFightId(fightId)
|
||||
.build();
|
||||
builder.setFightData(fightData);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.logic.hardStage.HardStageChapter;
|
||||
import com.ljsd.jieling.logic.hardStage.HardStageNode;
|
||||
import config.SHardStage;
|
||||
import config.SHardStageReward;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class HardStageManager extends MongoBase {
|
||||
|
||||
private Map<Integer, HardStageChapter> chapterMap ;//山河玩家信息
|
||||
|
||||
|
||||
public Map<Integer, HardStageChapter> getChapterMap() {
|
||||
if(null == chapterMap){
|
||||
Map<Integer, HardStageChapter> map = initChapterMap();
|
||||
chapterMap = map;
|
||||
}
|
||||
return chapterMap;
|
||||
}
|
||||
|
||||
private Map<Integer, HardStageChapter> initChapterMap(){
|
||||
Map<Integer, HardStageChapter> map = new HashMap<>();
|
||||
SHardStage nodeOne = SHardStage.getConfigMap().get(1);//第一个节点
|
||||
HardStageNode node = initNode(nodeOne);
|
||||
HardStageChapter chapter = initChapter(nodeOne.getChapter());
|
||||
chapter.init(this.getRootId(), getMongoKey() + ".chapterMap." + chapter.getChapterId());
|
||||
updateString("chapterMap." + chapter.getChapterId(), chapter);
|
||||
chapter.addNodeList(node);
|
||||
return map;
|
||||
}
|
||||
|
||||
private HardStageNode initNode(SHardStage config){
|
||||
HardStageNode node = new HardStageNode();
|
||||
node.setId(config.getId());
|
||||
node.setType(config.getStageType());
|
||||
if(node.getType() == 1){
|
||||
node.getRewardMap().put(config.getReward1()[0],Boolean.FALSE);
|
||||
node.getRewardMap().put(config.getReward1()[1],Boolean.FALSE);
|
||||
node.getRewardMap().put(config.getReward1()[2],Boolean.FALSE);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
private HardStageChapter initChapter(int chapterId){
|
||||
HardStageChapter chapter = new HardStageChapter();
|
||||
chapter.setChapterId(chapterId);
|
||||
List<SHardStageReward> reward = SHardStageReward.getChapterConfigMap().get(chapterId);
|
||||
for(SHardStageReward config : reward){
|
||||
chapter.getRewardMap().put(config.getStarReward(),Boolean.FALSE);
|
||||
}
|
||||
return chapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 满足条件开启新节点
|
||||
* @param config
|
||||
*/
|
||||
public void openNewNode(SHardStage config){
|
||||
HardStageChapter chapter ;
|
||||
if(chapterMap.containsKey(config.getChapter())){
|
||||
chapter = chapterMap.get(config.getChapter());
|
||||
HardStageNode node = initNode(config);
|
||||
chapter.addNodeList(node);
|
||||
}else{
|
||||
chapter = initChapter(config.getChapter());
|
||||
chapter.init(this.getRootId(), getMongoKey() + ".chapterMap." + chapter.getChapterId());
|
||||
updateString("chapterMap." + chapter.getChapterId(), chapter);
|
||||
HardStageNode node = initNode(config);
|
||||
chapter.addNodeList(node);
|
||||
chapterMap.put(config.getChapter(),chapter);
|
||||
}
|
||||
updateString("chapterMap." + chapter.getChapterId(), chapter);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -77,6 +77,7 @@ public class User {
|
|||
this.bloodyInfo = new BloodyInfo();
|
||||
this.mainLevelManager = new MainLevelManager();
|
||||
this.expeditionManager = new ExpeditionManager();
|
||||
this.hardStageManager = new HardStageManager();
|
||||
|
||||
//綁定关系
|
||||
|
||||
|
@ -100,7 +101,7 @@ public class User {
|
|||
this.bloodyInfo.init(id,MongoKey.bloodyInfo);
|
||||
this.mainLevelManager.init(id,MongoKey.mainLevelManager);
|
||||
this.expeditionManager.init(id,MongoKey.expeditionManager);
|
||||
// this.hardStageManager.init(id,MongoKey.hardStageManager);
|
||||
this.hardStageManager.init(id,MongoKey.hardStageManager);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
|
|
|
@ -0,0 +1,142 @@
|
|||
package com.ljsd.jieling.logic.hardStage;
|
||||
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.specialparm.SpecialForTeamBuildEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemMap;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class HardStageLogic {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HardStageLogic.class);
|
||||
|
||||
private static Map<Integer, List<Integer>> reportRecord;//全服第一次三星通过,最快速度三星通过
|
||||
|
||||
|
||||
/**
|
||||
* 获取山河社稷图信息
|
||||
*/
|
||||
public static CommonProto.HardStageInfo.Builder getInfo(User user){
|
||||
CommonProto.HardStageInfo.Builder builder = CommonProto.HardStageInfo.newBuilder();
|
||||
return builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加战斗规则
|
||||
*/
|
||||
public static void fight(ISession session, int teamId, int nodeId){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取章节奖励
|
||||
*/
|
||||
public static void getChapterReward(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 回放
|
||||
*/
|
||||
public static void getHSReport(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断奖励
|
||||
*/
|
||||
public static String passReward(){
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取己方teamfight
|
||||
*/
|
||||
public static CommonProto.FightTeamInfo getFightTeamInfo(User user, int teamId,SHardStage nodeConfig) {
|
||||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||
Hero hero;
|
||||
|
||||
hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||
if (hero == null) {
|
||||
continue;
|
||||
}
|
||||
Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
||||
StringBuilder skillSb = new StringBuilder();
|
||||
StringBuilder propertySb = new StringBuilder();
|
||||
HeroLogic.getInstance().getHeroSkills(user,hero,skillSb);
|
||||
|
||||
if(nodeConfig.getHardStageBuff() != 0){
|
||||
SHardStageBuff buff = SHardStageBuff.getConfigMap().get(nodeConfig.getHardStageBuff());
|
||||
skillSb.append(buff.getPassiveSkillLogic()).append("#");
|
||||
}
|
||||
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getTemplateId(),hero.getLevel(user.getHeroManager()), heroAttributeMap).toString();
|
||||
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
|
||||
.newBuilder()
|
||||
.setUnitId(Integer.toString(hero.getTemplateId()))
|
||||
.setUnitSkillIds(skillSb.substring(0,skillSb.length()-1))
|
||||
.setProperty(property.substring(0, property.length()-1))
|
||||
.setPosition(teamPosHeroInfo.getPosition())
|
||||
.setStar(hero.getStar())
|
||||
.setSkinId(hero.getSkin())
|
||||
.build();
|
||||
heroFightInfos.add(heroFightInfo);
|
||||
}
|
||||
|
||||
//TOO 添加被动技能
|
||||
String pokenmonPassiveSkills = HeroLogic.getInstance().getPokenmonPassiveSkills(user, teamId);
|
||||
|
||||
return CommonProto.FightTeamInfo.
|
||||
newBuilder()
|
||||
.addAllFightUnitList(heroFightInfos)
|
||||
.addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
|
||||
.setTeamPassiveList(pokenmonPassiveSkills)
|
||||
.setSpecialPassive(SpecialForTeamBuildEnum.toParm(teamId,user))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过节点
|
||||
*/
|
||||
public static void passNode(ISession iSession, SHardStage nodeConfig, int resultNum) throws Exception{
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
Map<Integer, HardStageChapter> chapterMap = user.getHardStageManager().getChapterMap();
|
||||
HardStageNode node = chapterMap.get(nodeConfig.getChapter()).getNode(nodeConfig.getId());
|
||||
if(node.getType() == 1){
|
||||
|
||||
}else{
|
||||
if(node.isHasPass()){
|
||||
return;
|
||||
}
|
||||
CommonProto.Drop.Builder drop = getFirstPassReward(user,nodeConfig);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 首通奖励
|
||||
*/
|
||||
public static CommonProto.Drop.Builder getFirstPassReward(User user,SHardStage nodeConfig) throws Exception{
|
||||
SRewardGroup rewardGroup = SRewardGroup.getsRewardItemMap().get(nodeConfig.getPassReward());
|
||||
ItemMap itemObj = new ItemMap();
|
||||
int[] dropList = rewardGroup.getRewardItem();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropList,1,0, BIReason.HARD_STAGE);
|
||||
return drop;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.ljsd.jieling.logic.hardStage;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class HardStageNode extends MongoBase {
|
||||
|
||||
private int id;
|
||||
private int type;
|
||||
private int state;
|
||||
private Map<Integer,Boolean> rewardMap;//三星奖励情况
|
||||
private boolean hasPass;//是否通过
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Map<Integer, Boolean> getRewardMap() {
|
||||
return rewardMap;
|
||||
}
|
||||
|
||||
public void setRewardMap(Map<Integer, Boolean> rewardMap) {
|
||||
this.rewardMap = rewardMap;
|
||||
}
|
||||
|
||||
public boolean isHasPass() {
|
||||
return hasPass;
|
||||
}
|
||||
|
||||
public void setHasPass(boolean hasPass) {
|
||||
this.hasPass = hasPass;
|
||||
}
|
||||
}
|
|
@ -14,10 +14,7 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
import config.SGuildLevelConfig;
|
||||
import config.SMainLevelConfig;
|
||||
import config.SMonsterConfig;
|
||||
import config.SSpecialConfig;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import rpc.protocols.*;
|
||||
import util.StringUtil;
|
||||
|
@ -394,6 +391,69 @@ public class CBean2Proto {
|
|||
return monsterBuilder;
|
||||
}
|
||||
|
||||
public static CommonProto.FightUnitInfo.Builder getMonster(SMonsterConfig sMonsterConfig, SHardStage nodeConfig) {
|
||||
StringBuilder monsterPropertyList = new StringBuilder();
|
||||
StringBuilder monsterSkillList = new StringBuilder(); //火风水地光暗
|
||||
float[] damageReduceFactor = sMonsterConfig.getElementDamageReduceFactor();
|
||||
monsterPropertyList.append(sMonsterConfig.getLevel()).append("#"); //等级
|
||||
monsterPropertyList.append(sMonsterConfig.getHp()).append("#"); //生命
|
||||
monsterPropertyList.append(sMonsterConfig.getHp()).append("#"); //最大生命
|
||||
monsterPropertyList.append(sMonsterConfig.getAttack()).append("#");//攻击力
|
||||
monsterPropertyList.append(sMonsterConfig.getPhysicalDefence()).append("#"); //护甲
|
||||
monsterPropertyList.append(sMonsterConfig.getMagicDefence()).append("#"); //魔抗
|
||||
monsterPropertyList.append(sMonsterConfig.getSpeed()).append("#"); //速度
|
||||
monsterPropertyList.append(sMonsterConfig.getDamageBocusFactor()).append("#"); //伤害加成系数
|
||||
monsterPropertyList.append(sMonsterConfig.getDamageReduceFactor()).append("#"); //伤害减免系数
|
||||
monsterPropertyList.append(sMonsterConfig.getHit()).append("#"); //命中率
|
||||
monsterPropertyList.append(sMonsterConfig.getDodge()).append("#"); //闪避率
|
||||
monsterPropertyList.append(sMonsterConfig.getCritFactor()).append("#"); //暴击率
|
||||
monsterPropertyList.append(sMonsterConfig.getCritDamageFactor()).append("#"); //暴击伤害系数
|
||||
monsterPropertyList.append(sMonsterConfig.getAntiCritDamageFactor()).append("#"); //抗暴率系数
|
||||
monsterPropertyList.append(sMonsterConfig.getTreatFacter()).append("#"); //治疗加成系数
|
||||
monsterPropertyList.append(sMonsterConfig.getCureFacter()).append("#"); //受到治疗加成系数
|
||||
monsterPropertyList.append(sMonsterConfig.getDifferDemonsBocusFactor()).append("#"); //异妖伤害加成系数
|
||||
monsterPropertyList.append(sMonsterConfig.getDifferDemonsReduceFactor()).append("#"); //异妖伤害减免系数
|
||||
monsterPropertyList.append(damageReduceFactor[0]).append("#"); //火系伤害减免系数
|
||||
monsterPropertyList.append(damageReduceFactor[1]).append("#"); //冰系伤害减免系数
|
||||
monsterPropertyList.append(damageReduceFactor[2]).append("#"); //雷系伤害减免系数
|
||||
monsterPropertyList.append(damageReduceFactor[3]).append("#"); //风系伤害减免系数
|
||||
monsterPropertyList.append(damageReduceFactor[4]).append("#"); //地系伤害减免系数
|
||||
monsterPropertyList.append(damageReduceFactor[5]).append("#"); //暗系伤害减免系数
|
||||
monsterPropertyList.append(sMonsterConfig.getElementDamageBonusFactor()); //属性值加成
|
||||
|
||||
if (sMonsterConfig.getSkillList()!=null){
|
||||
for (Integer i : sMonsterConfig.getSkillList()){
|
||||
monsterSkillList.append(i).append("#");
|
||||
}
|
||||
}
|
||||
if (sMonsterConfig.getPassiveSkillList()!=null && sMonsterConfig.getPassiveSkillList().length >0){
|
||||
int length = monsterSkillList.length();
|
||||
while(2-length>0){
|
||||
monsterSkillList.append(0).append("#");
|
||||
length++;
|
||||
}
|
||||
for (Integer i : sMonsterConfig.getPassiveSkillList()){
|
||||
if(i==0){
|
||||
continue;
|
||||
}
|
||||
monsterSkillList.append(i).append("#");
|
||||
}
|
||||
}
|
||||
|
||||
if(nodeConfig.getHardStageBuff() != 0){
|
||||
SHardStageBuff buff = SHardStageBuff.getConfigMap().get(nodeConfig.getHardStageBuff());
|
||||
monsterSkillList.append(buff.getPassiveSkillLogic()).append("#");
|
||||
}
|
||||
|
||||
CommonProto.FightUnitInfo.Builder monsterBuilder = CommonProto.FightUnitInfo.newBuilder();
|
||||
monsterBuilder.setProperty(monsterPropertyList.toString());
|
||||
monsterBuilder.setUnitSkillIds(monsterSkillList.toString());
|
||||
monsterBuilder.setUnitId(String.valueOf(sMonsterConfig.getId()));
|
||||
monsterBuilder.setSkinId(sMonsterConfig.getSkinId());
|
||||
monsterBuilder.setStar(sMonsterConfig.getStar());
|
||||
return monsterBuilder;
|
||||
}
|
||||
|
||||
public static CommonProto.FoodBuffer getFoodBuffer(int buffId, int leftStep) {
|
||||
return CommonProto.FoodBuffer
|
||||
.newBuilder()
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.util;
|
|||
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import config.SHardStage;
|
||||
import rpc.protocols.CommonProto;
|
||||
import config.SMonsterConfig;
|
||||
import config.SMonsterGroup;
|
||||
|
@ -118,6 +119,36 @@ public class MonsterUtil {
|
|||
return map;
|
||||
}
|
||||
|
||||
public static Map<Integer, List<CommonProto.FightUnitInfo>> getHardStageMonsterByGroup(SHardStage nodeConfig){
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(nodeConfig.getMonsterGroup());
|
||||
int[][] groupIds = sMonsterGroup.getContents();
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> map = new ConcurrentHashMap<>();
|
||||
Map<Integer, CommonProto.FightUnitInfo.Builder> monsterMap =STableManager.getFigureConfig(MapStaticConfig.class).getMonsterMap();
|
||||
for (int i = 0; i < groupIds.length; i++) {
|
||||
int[] monsterIds = groupIds[i];
|
||||
List<CommonProto.FightUnitInfo> monsterList = new ArrayList<>();
|
||||
int position=1;
|
||||
for (int monsterId : monsterIds) {
|
||||
if(monsterId!=0){
|
||||
SMonsterConfig sMonsterConfig = STableManager.getConfig(SMonsterConfig.class).get(monsterId);
|
||||
monsterList.add( CBean2Proto.getMonster(sMonsterConfig, nodeConfig).setPosition(position++).build());
|
||||
}else{
|
||||
position++;
|
||||
}
|
||||
|
||||
}
|
||||
for (int monsterId : monsterIds) {
|
||||
if(monsterId!=0){
|
||||
monsterList.add(monsterMap.get(monsterId).setPosition(position++).build());
|
||||
}else{
|
||||
position++;
|
||||
}
|
||||
|
||||
}
|
||||
map.put(i,monsterList);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Map<Integer,List<Long>> getMonsterHpByGroup(int groupId){
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="HardStage")
|
||||
public class SHardStage implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int chapter;
|
||||
|
||||
private int section;
|
||||
|
||||
private int picture ;
|
||||
|
||||
private int repeat ;
|
||||
|
||||
private int nextLevel;
|
||||
|
||||
private int levelLimit;
|
||||
|
||||
private int star ;
|
||||
|
||||
private int monsterGroup;
|
||||
|
||||
private int hardStageBuff;
|
||||
|
||||
private int recommendFightAbility;
|
||||
|
||||
private int[] passReward;
|
||||
|
||||
private int stageType;
|
||||
|
||||
private int[] conditionValue;
|
||||
|
||||
private int[] reward1;
|
||||
|
||||
private static Map<Integer,SHardStage> configMap ;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SHardStage> tempConfig = STableManager.getConfig(SHardStage.class);
|
||||
if(null == configMap){
|
||||
configMap = tempConfig;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getChapter() {
|
||||
return chapter;
|
||||
}
|
||||
|
||||
public int getSection() {
|
||||
return section;
|
||||
}
|
||||
|
||||
public int getPicture () {
|
||||
return picture ;
|
||||
}
|
||||
|
||||
public int getRepeat () {
|
||||
return repeat ;
|
||||
}
|
||||
|
||||
public int getNextLevel() {
|
||||
return nextLevel;
|
||||
}
|
||||
|
||||
public int getLevelLimit() {
|
||||
return levelLimit;
|
||||
}
|
||||
|
||||
public int getStar () {
|
||||
return star ;
|
||||
}
|
||||
|
||||
public int getMonsterGroup() {
|
||||
return monsterGroup;
|
||||
}
|
||||
|
||||
public int getHardStageBuff() {
|
||||
return hardStageBuff;
|
||||
}
|
||||
|
||||
public int getRecommendFightAbility() {
|
||||
return recommendFightAbility;
|
||||
}
|
||||
|
||||
public int[] getPassReward() {
|
||||
return passReward;
|
||||
}
|
||||
|
||||
public int getStageType() {
|
||||
return stageType;
|
||||
}
|
||||
|
||||
public int[] getConditionValue() {
|
||||
return conditionValue;
|
||||
}
|
||||
|
||||
public int[] getReward1() {
|
||||
return reward1;
|
||||
}
|
||||
|
||||
public static Map<Integer, SHardStage> getConfigMap() {
|
||||
return configMap;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="SHardStageBuff")
|
||||
public class SHardStageBuff implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
private int type;
|
||||
private int passiveSkillLogic;
|
||||
|
||||
private static Map<Integer,SHardStageBuff> configMap ;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SHardStageBuff> tempConfig = STableManager.getConfig(SHardStageBuff.class);
|
||||
if(null == configMap){
|
||||
configMap = tempConfig;
|
||||
}
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getPassiveSkillLogic() {
|
||||
return passiveSkillLogic;
|
||||
}
|
||||
|
||||
public void setPassiveSkillLogic(int passiveSkillLogic) {
|
||||
this.passiveSkillLogic = passiveSkillLogic;
|
||||
}
|
||||
|
||||
public static Map<Integer, SHardStageBuff> getConfigMap() {
|
||||
return configMap;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="HardStageReward")
|
||||
public class SHardStageReward implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int chapter;
|
||||
|
||||
private int star ;
|
||||
|
||||
private int starReward;
|
||||
|
||||
private int rewardIcon;
|
||||
|
||||
private static Map<Integer, List<SHardStageReward>> chapterConfigMap;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SHardStageReward> tempConfig = STableManager.getConfig(SHardStageReward.class);
|
||||
Map<Integer, List<SHardStageReward>> tempChapterConfigMap = new HashMap<>();
|
||||
for(SHardStageReward config : tempConfig.values()){
|
||||
if(tempChapterConfigMap.containsKey(config.getChapter())){
|
||||
tempChapterConfigMap.get(config.getChapter()).add(config);
|
||||
}else{
|
||||
List<SHardStageReward> list = new ArrayList<>();
|
||||
list.add(config);
|
||||
tempChapterConfigMap.put(config.getChapter(),list);
|
||||
}
|
||||
}
|
||||
if(null == chapterConfigMap){
|
||||
chapterConfigMap = tempChapterConfigMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getChapter() {
|
||||
return chapter;
|
||||
}
|
||||
|
||||
public int getStar () {
|
||||
return star ;
|
||||
}
|
||||
|
||||
public int getStarReward() {
|
||||
return starReward;
|
||||
}
|
||||
|
||||
public int getRewardIcon() {
|
||||
return rewardIcon;
|
||||
}
|
||||
|
||||
public static Map<Integer, List<SHardStageReward>> getChapterConfigMap() {
|
||||
return chapterConfigMap;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue