添加关卡附加条件功能提交

back_recharge
yuanshuai 2021-12-10 18:43:49 +08:00
parent 9a7a6f71f5
commit 8a77b7c2d5
2 changed files with 79 additions and 0 deletions

View File

@ -34,8 +34,10 @@ import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.*;
import com.ljsd.jieling.logic.fight.result.FightResult;
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
@ -2102,6 +2104,11 @@ public class MapLogic {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
boolean isOpenRule=CheckFigthLevelOpen(user,sMainLevelConfig.getOpenRule());
if (!isOpenRule){
LOGGER.info("startMainLevelFight==> uid={},fightId={}, levelDifficulty is not allow ", uid, fightId);
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
}
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
@ -2123,6 +2130,71 @@ public class MapLogic {
}
/**
*
* 0
* 13-20
* 23-10
* 3鸿6-15
* 4
* 55-10
* @param user
* @param openRule
* @return
* @throws Exception
*/
private boolean CheckFigthLevelOpen(User user,int[][] openRule) throws Exception {
boolean isOpen = true;
for (int[] ints : openRule) {
int type = ints[0];
if (type == 0) {
break;
}
switch (type) {
case 1:{
if (ints[1]> HardStageLogic.getHardStageStarsSum(user)) {
return false;
}
break;
}
case 2: {
if (ints[1]> user.getMapManager().getLastMonsterAttack()-1) {
return false;
}
break;
}
case 3:{
HongMengAddAttribute hongMengAddAttribute = user.getHeroManager().getResonanceAddition().get(HongMengAttributeEnum.LEVEL);
if (hongMengAddAttribute==null||ints[1]> hongMengAddAttribute.value) {
return false;
}
break;
}
case 4:{
int num=0;
Map<Integer,SEquipConfig>equipConfig=STableManager.getConfig(SEquipConfig.class);
for (Map.Entry<Integer, Long> entry : user.getItemManager().getEquipBookMap().entrySet()) {
if (equipConfig.get(entry.getKey()).getStar()>=ints[1]) {
num++;
}
}
if (ints[2]>num) {
return false;
}
break;
}
case 5:{
if (ints[1]> user.getHeroManager().GetAllLikableLv()) {
return false;
}
break;
}
}
}
return isOpen;
}
public void endMainLevelFight(ISession session, String frames, int fightId, MessageTypeProto.MessageType messageType) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);

View File

@ -15,6 +15,8 @@ public class SMainLevelConfig implements BaseConfig {
private int levelLimit;
private int[][] openRule;//附加关卡解锁条件
private int monsterGroup;
private int[] reward;
@ -31,6 +33,7 @@ public class SMainLevelConfig implements BaseConfig {
private int[][] invasionBossReward;
private int invasionBossTime;
private int invasionBossRefresh;
@ -143,4 +146,8 @@ public class SMainLevelConfig implements BaseConfig {
public int getPlotId() {
return storyId;
}
public int[][] getOpenRule() {
return openRule;
}
}