伤害副本修改

back_recharge
duhui 2022-11-11 15:39:48 +08:00
parent 6fd68e9a00
commit 3aad1ca72e
1 changed files with 48 additions and 63 deletions

View File

@ -18,8 +18,6 @@ import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import config.SChallengeStage;
import config.SMonsterConfig;
import config.SMonsterGroup;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -71,8 +69,9 @@ public class ChallengeLogic {
}
LOGGER.info("baodi reward");
}
//总奖励
if (model == 2 || (model == 1 && win == 1)) {
//总奖励 扫荡/挑战赢
if (model == 2 || win == 1) {
//扫荡
for (int[] fix : sChallengeConfig.getPassReward()) {
if (comDropMap.containsKey(fix[0])) {
@ -84,8 +83,9 @@ public class ChallengeLogic {
LOGGER.info("zong reward");
builder.setPercentReward(10000);
}
//首通奖励,挑战赢了
if (model == 1 && win == 1) {
//打过
for (int[] fix : sChallengeConfig.getVictoryReward()) {
if (comDropMap.containsKey(fix[0])) {
comDropMap.put(fix[0], comDropMap.get(fix[0]) + fix[1]);
@ -93,67 +93,42 @@ public class ChallengeLogic {
comDropMap.put(fix[0], fix[1]);
}
}
LOGGER.info("tongguan reward");
//todo 2022-11-11 策划需求全部返回回合书 回合副本
builder.setPercentReward(10000);
builder.setLossBloodOrTimes(bout);
LOGGER.info("tongguan reward win times 回合数:"+bout);
}
if(type ==1){
//回合副本
builder.setPercentReward(10000);
builder.setLossBloodOrTimes(bout);
LOGGER.info("win times 回合数:"+bout);
}else if(type ==2){
//伤害副本
double bossBlood =SMonsterGroup.getInitHp(sChallengeConfig.getMonsterGroup()); //怪物初始化血量
builder.setPercentReward(10000);
builder.setLossBloodOrTimes((long)bossBlood);
LOGGER.info("win times 伤害:"+result[1]);
}
} else if (model == 1 && win == 0) {
//没打过
//没打过
if (model == 1 && win == 0) {
int[][] reward1 = sChallengeConfig.getReward1();
double ratio = 0;
if (type == 1) {//回合数
long times = bout;
for (int[] percent : reward1) {
if (percent[0] > times) {
if (percent[0] > bout) {
break;
}
ratio = percent[1];
LOGGER.info("输了 回合数 percent[0]:"+percent[0]);
}
builder.setLossBloodOrTimes(times);
LOGGER.info("输了 回合数 times :=>{} id=>{}",times,sChallengeConfig.getId());
} else if (type == 2) { //血量
double bossBlood =SMonsterGroup.getInitHp(sChallengeConfig.getMonsterGroup()); //怪物初始化血量
double leaveHp = result[2] + result[3] + result[4]
+ result[5] + result[6];
double lossBlood = bossBlood - leaveHp;
LOGGER.info("lossBlood=>{} bossBlood=>{} lossBlood/bossBlood=>{}",lossBlood,bossBlood,lossBlood/bossBlood);
for (int[] percent : reward1) {
if (percent[0]/(double)10000 > lossBlood/bossBlood) {
break;
}
ratio = percent[1];
LOGGER.info("输了 血量 percent[0]:"+percent[0]);
}
LOGGER.info("输了 lossBlood:=>{} id=>{}",lossBlood,sChallengeConfig.getId());
builder.setLossBloodOrTimes((long)lossBlood);
builder.setLossBloodOrTimes(bout);
LOGGER.info("输了 回合数 times :=>{} id=>{}", bout,sChallengeConfig.getId());
}
if (type == 2) { //血量
ratio = 0;
builder.setLossBloodOrTimes(20);
LOGGER.info("输了2 回合数 times :=>{} id=>{}",20,sChallengeConfig.getId());
}
LOGGER.info("challengeHandler ====>id:{},ratio:{}", sChallengeConfig.getId(), ratio);
for (int[] fix : sChallengeConfig.getPassReward()) {
if (comDropMap.containsKey(fix[0])) {
comDropMap.put(fix[0], comDropMap.get(fix[0]) + (int) (fix[1] * (ratio / 10000)));
} else {
comDropMap.put(fix[0], (int) (fix[1] * (ratio / 10000)));
}
Integer num = comDropMap.getOrDefault(fix[0], 0);
num = num + fix[1] + (int) (fix[1] * (ratio / 10000));
comDropMap.put(fix[0], num);
}
LOGGER.info("no pass reward percent");
builder.setPercentReward((int)ratio);
}
return comDropMap;
}
/**
@ -189,7 +164,6 @@ public class ChallengeLogic {
builder.addInfo(info.build());
}
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.CHALLENGE_INFO_INDICATION_VALUE, builder.build(), true);
}
public void ChallengeHandler(ISession iSession, PlayerInfoProto.ChallengeRequest proto) throws Exception {
@ -198,8 +172,10 @@ public class ChallengeLogic {
return;
}
PlayerInfoProto.ChallengeResponse.Builder builder = PlayerInfoProto.ChallengeResponse.newBuilder();
int type = proto.getType(); //1回合挑战 2伤害挑战
int model = proto.getModel(); //1为挑战 2为扫荡
//1 回合挑战 2 伤害挑战
int type = proto.getType();
//1 为挑战 2 为扫荡
int model = proto.getModel();
int id = proto.getId();
SChallengeStage sChallengeConfig = STableManager.getConfig(SChallengeStage.class).get(id);
if (sChallengeConfig == null) {
@ -213,8 +189,8 @@ public class ChallengeLogic {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
Map<Integer, Integer> comDropMap = new HashMap<>();
//扫荡
if (model == 2) {
//扫荡
switch (type) {
case 1: // 回合
if (!limit(endlessNewReplicaLexel, id)) {
@ -231,14 +207,18 @@ public class ChallengeLogic {
}
//扫荡 = 保底 +总奖励
comDropMap = dropMap(sChallengeConfig, model, type, 1, null,0,builder);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, comDropMap.entrySet().stream().map(n ->
new int[]{n.getKey(), n.getValue()}).toArray(int[][]::new), BIReason.EXPLORE_MAP_COST_RETURN);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, comDropMap.entrySet().stream()
.map(n -> new int[]{n.getKey(), n.getValue()}).toArray(int[][]::new), BIReason.EXPLORE_MAP_COST_RETURN);
builder.setDrop(drop);
} else {
GameFightType fightType = GameFightType.EndlessNewTeam;
}
// 挑战
if (model == 1){
GameFightType fightType = null;
int teamId = 0;
if (type == 1) {
//回合
fightType = GameFightType.EndlessNewTeam;
teamId = TeamEnum.CHALLENGE_ENDLESS_NEWTEAM.getTeamId();
if (sChallengeConfig.getNextLevel() < endlessNewReplicaLexel) {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.CHALLENGE_RESPONSE.getNumber(), builder.build(), true);
return;
@ -246,26 +226,29 @@ public class ChallengeLogic {
} else if (type == 2) {
//伤害
fightType = GameFightType.TreasureTeam;
teamId = TeamEnum.CHALLENGE_TREASURE_TEAM.getTeamId();
if (sChallengeConfig.getNextLevel() < treasureReplicaLexel) {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.CHALLENGE_RESPONSE.getNumber(), builder.build(), true);
return;
}
}
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), type == 1?TeamEnum.CHALLENGE_ENDLESS_NEWTEAM.getTeamId():TeamEnum.CHALLENGE_TREASURE_TEAM.getTeamId(), 20, "",
fightType, sChallengeConfig.getMonsterGroup(), 3);
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), teamId, 20, "", fightType, sChallengeConfig.getMonsterGroup(), 3);
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
int time = fightResult.getCurRound();
//首次通关 给 保底 +总奖励 +通关奖励
if ((int) fightResult.getCheckResult()[0] == 1) {
if (fightResult.getResult() == 1) {
//赢了
if (type == 1) {
user.getPlayerInfoManager().setEndlessNewReplica(id);
} else if (type == 2) {
}
if (type == 2) {
user.getPlayerInfoManager().setTreasureReplica(id);
}
comDropMap = dropMap(sChallengeConfig, model, type, 1, fightResult.getCheckResult(),time,builder);
builder.setResult(1);
} else {
} else {// 输了
// 回合
if (type == 1){
if(time >= 20){
//无尽副本回合数超过20 赢
@ -278,8 +261,10 @@ public class ChallengeLogic {
comDropMap = dropMap(sChallengeConfig, model, type, 0, fightResult.getCheckResult(),time,builder);
builder.setResult(0);
}
}else if(type == 2){
//没打过 //输了 保底+总奖励*奖励百分比
}
// 血量
if(type == 2){
//没打过-输了 保底+总奖励*奖励百分比
comDropMap = dropMap(sChallengeConfig, model, type, 0, fightResult.getCheckResult(),time,builder);
builder.setResult(0);
}