身外化身

back_recharge
xuexinpeng 2022-04-22 17:26:59 +08:00
parent a45d00b522
commit 913af67528
4 changed files with 76 additions and 37 deletions

View File

@ -20,12 +20,12 @@ import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author hj
* @Date 2021/11/11 17:06:42
* @Description:
* @Author
* @Description:
* @Version 1.0
*/
@Component
@ -61,9 +61,9 @@ public class TransformationUpGradeHandler extends BaseHandler<HeroInfoProto.Tran
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"该卡片版本错误");
}
int[][] costItem = {{nextConfig.getExp()[0],nextConfig.getExp()[1]}};
if(!ItemUtil.itemCost(user,costItem, BIReason.TRANSFORMATION_CARD_COST,1)){
/* if(!ItemUtil.itemCost(user,costItem, BIReason.TRANSFORMATION_CARD_COST,1)){
return;
}
}*/
info.setLevel(info.getLevel()+1);
user.getHeroManager().putTransformationList(info);
int[][] dropItem = {nextConfig.getChangingForceExp()};
@ -73,9 +73,18 @@ public class TransformationUpGradeHandler extends BaseHandler<HeroInfoProto.Tran
}else if(type == 2 ){
//升星
if(!ItemUtil.itemCost(user, changingCard.getStarUpCost(), BIReason.TRANSFORMATION_CARD_COST,1)){
return;
List<CommonProto.KeyVal> itemIdList = proto.getItemListList();
Map <Integer,Integer> costMap = new HashMap<>();
for(CommonProto.KeyVal keyVal :itemIdList){
if(costMap.containsKey(keyVal.getKey())){
costMap.put(keyVal.getKey(),costMap.get(keyVal.getKey())+1);
}else {
costMap.put(keyVal.getKey(),1);
}
}
/* if(!ItemUtil.itemCost(user, costMap, BIReason.TRANSFORMATION_CARD_COST,1)){
return;
}*/
if (info != null){
info.setStar(info.getStar()+ 1);
user.getHeroManager().putTransformationList(info);
@ -87,6 +96,14 @@ public class TransformationUpGradeHandler extends BaseHandler<HeroInfoProto.Tran
//user.getHeroManager().addTransformationForce(changingCard.getStarUpExp()[info.getStar()-1][1]);
}
}
CommonProto.TransformationCardInfo cardInfo = CommonProto.TransformationCardInfo.newBuilder()
.setId(info.getCardId())
.setIndex(info.getIndex())
.setStatus(info.getStatus())
.setLevel(info.getLevel())
.setStar(info.getStar())
.build();
builder.setInfo(cardInfo);
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.TransformationUpGradeResponse.getNumber(), builder.build(), true);
}
}

View File

@ -92,29 +92,38 @@ public class ChallengeLogic {
}
}
LOGGER.info("tongguan reward");
builder.setPercentReward(10000);
builder.setLossBloodOrTimes(result[1]);
LOGGER.info("win times 回合数:"+result[1]);
if(type ==1){
//回合副本
builder.setPercentReward(10000);
builder.setLossBloodOrTimes(result[1]);
LOGGER.info("win times 回合数:"+result[1]);
}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) {
//没打过
int[][] reward1 = sChallengeConfig.getReward1();
int ratio = 0;
if (type == 2) {//无尽副本 血量
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();
if (type == 1) {//回合数
long times = result[1];
for (int[] percent : reward1) {
if (percent[0] > times) {
break;
}
ratio = percent[1];
}
double leaveHp = result[2] + result[3] + result[4]
builder.setLossBloodOrTimes(times);
LOGGER.info("输了 回合数 times :"+times);
} 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;
for (int[] percent : reward1) {
@ -125,16 +134,6 @@ public class ChallengeLogic {
}
LOGGER.info("输了 lossBlood:"+lossBlood);
builder.setLossBloodOrTimes((long)lossBlood);
} else if (type == 1) {//回合数
long times = result[1];//回合数
for (int[] percent : reward1) {
if (percent[0] > times) {
break;
}
ratio = percent[1];
}
builder.setLossBloodOrTimes(times);
LOGGER.info("输了 回合数 times :"+times);
}
LOGGER.info("challengeHandler ====>id:{},ratio:{}", sChallengeConfig.getId(), ratio);
for (int[] fix : sChallengeConfig.getPassReward()) {
@ -155,8 +154,8 @@ public class ChallengeLogic {
*
*/
public void check() {
status[0] = 0;
status[1] = 0;
status[0] = 1;
status[1] = 1;
//无尽副本星期1、3、5、7开启
//宝物副本星期2、4、6、7开启
int[][] config = {{1, 3, 5, 7}, {2, 4, 6, 7}};
@ -193,7 +192,7 @@ public class ChallengeLogic {
return;
}
PlayerInfoProto.ChallengeResponse.Builder builder = PlayerInfoProto.ChallengeResponse.newBuilder();
int type = proto.getType(); //1无尽 2宝物
int type = proto.getType(); //1回合挑战 2伤害挑战
int model = proto.getModel(); //1为挑战 2为扫荡
int id = proto.getId();
SChallengeStage sChallengeConfig = STableManager.getConfig(SChallengeStage.class).get(id);
@ -232,12 +231,14 @@ public class ChallengeLogic {
} else {
GameFightType fightType = GameFightType.EndlessNewTeam;
if (type == 1) {
//回合
fightType = GameFightType.EndlessNewTeam;
if (sChallengeConfig.getNextLevel() < endlessNewReplicaLexel) {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.CHALLENGE_RESPONSE.getNumber(), builder.build(), true);
return;
}
} else if (type == 2) {
//伤害
fightType = GameFightType.TreasureTeam;
if (sChallengeConfig.getNextLevel() < treasureReplicaLexel) {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.CHALLENGE_RESPONSE.getNumber(), builder.build(), true);

View File

@ -1293,6 +1293,8 @@ public class CBean2Proto {
.setId(value.getCardId())
.setIndex(value.getIndex())
.setStatus(value.getStatus())
.setLevel(value.getLevel())
.setStar(value.getStar())
.build();
list.add(builder);
}

View File

@ -46,4 +46,23 @@ public class SMonsterGroup implements BaseConfig {
public int[][] getAnimal() {
return animal;
}
public static double getInitHp(int monsterGroup){
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(monsterGroup);
// 获取怪物组
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();
}
}
return bossBlood;
}
}