小兵攻击加成
parent
76907cc43e
commit
b4934dafe5
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.logic.soldier;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.exception.ErrorTableException;
|
||||
|
@ -51,7 +52,8 @@ public class SoldierLogic {
|
|||
MapInfoProto.GetSoldiersInfoResponse.Builder builder = MapInfoProto.GetSoldiersInfoResponse.newBuilder()
|
||||
.setLevel(mainLevelManager.getSoldierLv())
|
||||
.setUpLvEndTime(mainLevelManager.getUpSoldierLvEndTime())
|
||||
.addAllSoldiers(soldiers);
|
||||
.addAllSoldiers(soldiers)
|
||||
.setAttackUp(getAttackUpByServerStart());
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.GetSoldiersInfoResponse_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
|
@ -68,6 +70,17 @@ public class SoldierLogic {
|
|||
return soldiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据开服天数获取攻击力加成
|
||||
* @return 加成百分比
|
||||
*/
|
||||
public int getAttackUpByServerStart(){
|
||||
int attackUp = SSpecialConfig.getIntegerValue("SoldierStage_AttackUp");
|
||||
long openTime = GameApplication.serverConfig.getCacheOpenTime();
|
||||
int days = TimeUtils.getSoFarWentDays(openTime, TimeUtils.now());
|
||||
return days * attackUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 兵力升级
|
||||
* @param session 用户缓存
|
||||
|
@ -225,7 +238,7 @@ public class SoldierLogic {
|
|||
if (levelConfig == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);//配置不存在
|
||||
}
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[][]{levelConfig.getRewardSoldiers()}, BIReason.SOLDIER_DISMISS_REWARD);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, levelConfig.getRewardSoldiers(), BIReason.SOLDIER_DISMISS_REWARD);
|
||||
builder.setDrop(drop);
|
||||
// 删除待招募区小兵
|
||||
soldierMap.remove(notUsePosition);
|
||||
|
@ -283,6 +296,9 @@ public class SoldierLogic {
|
|||
Long ack = soldier.getAttributes().getOrDefault(attackId, 0L);
|
||||
attack += (long) Math.ceil((lotteryConfig.getSoldiersUP() / 10000D) * ack + ack);
|
||||
}
|
||||
// 计算开服时间的加成
|
||||
int totalUp = getAttackUpByServerStart();
|
||||
attack = Math.round(attack * (totalUp / 100d + 1));
|
||||
// 总回合
|
||||
long round = (stageConfig.getHp() / attack) + 1;
|
||||
// 每回合耗时
|
||||
|
|
|
@ -17,7 +17,7 @@ public class SSoldiersLevelConfig implements BaseConfig {
|
|||
|
||||
private int[][] property;
|
||||
|
||||
private int[] rewardSoldiers;
|
||||
private int[][] rewardSoldiers;
|
||||
|
||||
// library》level》SSoldiersLevelConfig
|
||||
public static Map<Integer, Map<Integer, SSoldiersLevelConfig>> libForLevelMap = new HashMap<>();
|
||||
|
@ -48,7 +48,7 @@ public class SSoldiersLevelConfig implements BaseConfig {
|
|||
return property;
|
||||
}
|
||||
|
||||
public int[] getRewardSoldiers() {
|
||||
public int[][] getRewardSoldiers() {
|
||||
return rewardSoldiers;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue