挑战副本
parent
f93e4bdb4a
commit
ea6899e50b
|
@ -16,6 +16,8 @@ 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;
|
||||
|
@ -49,7 +51,7 @@ public class ChallengeLogic {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static Map<Integer, Integer> dropMap(SChallengeStage sChallengeConfig, int model, int type, int win, long[] result) {
|
||||
public static Map<Integer, Integer> dropMap(SChallengeStage sChallengeConfig, int model, int type, int win, long[] result,PlayerInfoProto.ChallengeResponse.Builder builder) {
|
||||
/*
|
||||
model //1为挑战 2为扫荡
|
||||
win // 1赢 0输
|
||||
|
@ -78,6 +80,7 @@ public class ChallengeLogic {
|
|||
}
|
||||
}
|
||||
LOGGER.info("zong reward");
|
||||
builder.setPercentReward(10000);
|
||||
}
|
||||
if (model == 1 && win == 1) {
|
||||
//打过
|
||||
|
@ -89,19 +92,36 @@ public class ChallengeLogic {
|
|||
}
|
||||
}
|
||||
LOGGER.info("tongguan reward");
|
||||
builder.setPercentReward(10000);
|
||||
} else if (model == 1 && win == 0) {
|
||||
//没打过
|
||||
int[][] reward1 = sChallengeConfig.getReward1();
|
||||
int ratio = 0;
|
||||
if (type == 1) {//无尽副本 血量
|
||||
long leaveHp = result[2] + result[3] + result[4]
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(sChallengeConfig.getMonsterGroup());
|
||||
// 获取怪物组
|
||||
int[][] content = sMonsterGroup.getContents();
|
||||
double bossBlood = 0.0; //怪物初始化血量
|
||||
for (int i = 0; i < content.length; i++) {
|
||||
int[] ints = content[i];
|
||||
for (int j = 0; j < ints.length; j++) {
|
||||
if (ints[j] == 0){
|
||||
continue;
|
||||
}
|
||||
SMonsterConfig monsterConfig = STableManager.getConfig(SMonsterConfig.class).get(ints[j]);
|
||||
bossBlood+=monsterConfig.getHp();
|
||||
}
|
||||
}
|
||||
double leaveHp = result[2] + result[3] + result[4]
|
||||
+ result[5] + result[6];
|
||||
double lossBlood = bossBlood - leaveHp;
|
||||
for (int[] percent : reward1) {
|
||||
if (percent[0] > leaveHp) {
|
||||
if (percent[0] > lossBlood) {
|
||||
break;
|
||||
}
|
||||
ratio = percent[1];
|
||||
}
|
||||
builder.setLossBlood((long)lossBlood);
|
||||
} else if (type == 2) {//回合数
|
||||
long times = result[1];//回合数
|
||||
for (int[] percent : reward1) {
|
||||
|
@ -120,6 +140,7 @@ public class ChallengeLogic {
|
|||
}
|
||||
}
|
||||
LOGGER.info("no pass reward percent");
|
||||
builder.setPercentReward(ratio);
|
||||
}
|
||||
return comDropMap;
|
||||
|
||||
|
@ -199,7 +220,7 @@ public class ChallengeLogic {
|
|||
break;
|
||||
}
|
||||
//扫荡 = 保底 +总奖励
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, null);
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, null,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);
|
||||
builder.setDrop(drop);
|
||||
|
@ -230,23 +251,23 @@ public class ChallengeLogic {
|
|||
} else if (type == 2) {
|
||||
user.getPlayerInfoManager().setTreasureReplica(id);
|
||||
}
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, fightResult.getCheckResult());
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, fightResult.getCheckResult(),builder);
|
||||
builder.setResult(1);
|
||||
} else {
|
||||
if (type == 1){
|
||||
if((int) fightResult.getCheckResult()[1]>=20){
|
||||
//无尽副本回合数超过20 赢
|
||||
user.getPlayerInfoManager().setEndlessNewReplica(id);
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, fightResult.getCheckResult());
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 1, fightResult.getCheckResult(),builder);
|
||||
builder.setResult(1);
|
||||
}else{
|
||||
//没打过 //输了 保底+总奖励*奖励百分比
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 0, fightResult.getCheckResult());
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 0, fightResult.getCheckResult(),builder);
|
||||
builder.setResult(0);
|
||||
}
|
||||
}else if(type == 2){
|
||||
//没打过 //输了 保底+总奖励*奖励百分比
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 0, fightResult.getCheckResult());
|
||||
comDropMap = dropMap(sChallengeConfig, model, type, 0, fightResult.getCheckResult(),builder);
|
||||
builder.setResult(0);
|
||||
}
|
||||
}
|
||||
|
@ -262,6 +283,7 @@ public class ChallengeLogic {
|
|||
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);
|
||||
builder.setType(type);
|
||||
}
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.CHALLENGE_RESPONSE.getNumber(), builder.build(), true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue