小兵战斗校验,攻击力改战斗力
parent
532cb834e5
commit
c439582b56
|
|
@ -1333,7 +1333,7 @@ public class MapLogic {
|
|||
if (hero == null) {
|
||||
continue;
|
||||
}
|
||||
heroForces += HeroLogic.getInstance().calHeoForce(user, hero, mapManager.getTeamId());
|
||||
heroForces += (int) HeroLogic.getInstance().calHeoForce(user, hero, mapManager.getTeamId());
|
||||
crossInfo.getHeroIds().add(hero.getTemplateId());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3725,14 +3725,18 @@ public class HeroLogic {
|
|||
continue;
|
||||
}
|
||||
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(propertyId);
|
||||
if (sPropertyConfig == null || sPropertyConfig.getScore() == 0) {
|
||||
if (sPropertyConfig == null) {
|
||||
continue;
|
||||
}
|
||||
float score = sPropertyConfig.getScore();
|
||||
if (score == 0){
|
||||
continue;
|
||||
}
|
||||
if (sPropertyConfig.getStyle() == GlobalsDef.PERCENT_TYPE) {
|
||||
forceAdd += propertyValue * sPropertyConfig.getScore() / 10000;
|
||||
forceAdd += propertyValue * score / 10000;
|
||||
// LOGGER.info("战力加成值 ================> {},{}" , propertyId, propertyValue * sPropertyConfig.getScore() / 10000);
|
||||
} else {
|
||||
forceNum += propertyValue * sPropertyConfig.getScore();
|
||||
forceNum += propertyValue * score;
|
||||
}
|
||||
}
|
||||
// BigDecimal bg = new BigDecimal(forceAdd).setScale(4, RoundingMode.UP);
|
||||
|
|
|
|||
|
|
@ -277,35 +277,23 @@ public class SoldierLogic {
|
|||
throw new ErrorTableException(162);//关卡条件不满足
|
||||
}
|
||||
|
||||
final int attackId = 2;//攻击力属性id
|
||||
long attack = 0;
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
int teamId = TeamEnum.MIAN_LINE_TEAM.getTeamId();
|
||||
// 获取英雄得战斗力
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||
Hero hero = heroManager.getHero(heroInfo.getHeroId());
|
||||
Map<Integer, Long> notBufferAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
||||
attack += notBufferAttribute.getOrDefault(attackId,0L);
|
||||
}
|
||||
long teamForce = HeroLogic.getInstance().calTeamTotalForce(user, teamId);
|
||||
// 获取小兵战斗力
|
||||
SSoldiersLotteryConfig lotteryConfig = SSoldiersLotteryConfig.levelMap.get(mainLevelManager.getSoldierLv());
|
||||
if (lotteryConfig == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);//配置不存在
|
||||
}
|
||||
for (Soldier soldier : mainLevelManager.getSoldierMap().values()) {
|
||||
// 待招募小兵
|
||||
if (soldier.getPosition() == -1){
|
||||
continue;
|
||||
}
|
||||
Long ack = soldier.getAttributes().getOrDefault(attackId, 0L);
|
||||
attack += (long) Math.ceil((lotteryConfig.getSoldiersUP() / 10000D) * ack + ack);
|
||||
}
|
||||
long soldierForce = calFightSoldierForce(user, lotteryConfig);
|
||||
LOGGER.info("小兵战斗,英雄编队原始战力,英雄:{},小兵:{}",teamForce,soldierForce);
|
||||
long force = teamForce + soldierForce;
|
||||
// 计算开服时间的加成
|
||||
int totalUp = getAttackUpByServerStart();
|
||||
attack = Math.round(attack * (totalUp / 100d + 1));
|
||||
force = Math.round(force * (totalUp / 100d + 1));
|
||||
LOGGER.info("小兵战斗,英雄编队加成战力,{}",force);
|
||||
// 总回合
|
||||
long round = (stageConfig.getHp() / attack) + 1;
|
||||
long round = (stageConfig.getHp() / force) + 1;
|
||||
// 每回合耗时
|
||||
int attackTime = SSpecialConfig.getIntegerValue("Soldiers_Attack_Time");
|
||||
|
||||
|
|
@ -329,4 +317,26 @@ public class SoldierLogic {
|
|||
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.SoldierFightCheckResponse_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算小兵战力
|
||||
*/
|
||||
public long calFightSoldierForce(User user, SSoldiersLotteryConfig lotteryConfig){
|
||||
MainLevelManager manager = user.getMainLevelManager();
|
||||
HashMap<Integer, Long> attr = new HashMap<>();
|
||||
for (Soldier soldier : manager.getSoldierMap().values()) {
|
||||
// 待招募小兵
|
||||
if (soldier.getPosition() == -1){
|
||||
continue;
|
||||
}
|
||||
for (Map.Entry<Integer, Long> entry : soldier.getAttributes().entrySet()) {
|
||||
int id = entry.getKey();
|
||||
long num = entry.getValue();
|
||||
// 等级加成
|
||||
long count = (long) Math.ceil((lotteryConfig.getSoldiersUP() / 10000D) * num + num);
|
||||
attr.put(id, attr.getOrDefault(id, 0L) + count);
|
||||
}
|
||||
}
|
||||
return HeroLogic.getInstance().calForce(attr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,9 +118,6 @@ public class BuyGoodsNewLogic {
|
|||
|
||||
/**
|
||||
* 代金卷修改器购买物品
|
||||
* @param iSession
|
||||
* @param goodsId
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void vouchersBuyGoods(ISession iSession, int goodsId) throws Exception {
|
||||
SRechargeCommodityNewConfig sRechargeCommodityConfig = SRechargeCommodityNewConfig.getConfigById(goodsId);
|
||||
|
|
@ -134,9 +131,6 @@ public class BuyGoodsNewLogic {
|
|||
|
||||
/**
|
||||
* gm代金卷购买物品
|
||||
* @param iSession
|
||||
* @param goodsId
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void gmBuyGoods(ISession iSession, int goodsId) throws Exception {
|
||||
SRechargeCommodityNewConfig sRechargeCommodityConfig = SRechargeCommodityNewConfig.getConfigById(goodsId);
|
||||
|
|
@ -150,9 +144,6 @@ public class BuyGoodsNewLogic {
|
|||
|
||||
/**
|
||||
* 扶持发送奖励
|
||||
* @param user
|
||||
* @param goods
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void supportBuyGoods(User user, String goods) throws Exception {
|
||||
String[] good = goods.split("\\|");
|
||||
|
|
@ -284,7 +275,7 @@ public class BuyGoodsNewLogic {
|
|||
MailLogic.getInstance().sendMail(uid,title,content,"",TimeUtils.nowInt(),Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
|
||||
if(price>0 && isRmbBuy(orderId)) {
|
||||
if(price > 0 && isRmbBuy(orderId)) {
|
||||
rechargeInfo.addRealityRmb(price);// 记录真实充值
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class SensitivewordFilter {
|
|||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"敏感字检测服未开启");
|
||||
}
|
||||
String address = (String) o;
|
||||
String[] split = address.split("\\:");
|
||||
String[] split = address.split(":");
|
||||
String serviceKey = StringUtil.getServiceKey(ServiceKey.RPCCore, split[0], split[1]);
|
||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue