三级火箭边界值更改
This commit is contained in:
parent
84f57ee119
commit
e3aef26f0e
@ -264,7 +264,7 @@ public class RocketEnergyAggregator {
|
||||
// 校验状态
|
||||
if (!rocketStatus.canAddEnergy()) {
|
||||
log.warn("火箭不可充能, roomId={}, status={}", roomId, rocketStatus.getStatus());
|
||||
throw new RuntimeException("火箭状态不允许充能");
|
||||
return;
|
||||
}
|
||||
|
||||
// 记录增加前的状态
|
||||
|
||||
@ -63,7 +63,7 @@ public enum RocketLevel {
|
||||
return switch (this) {
|
||||
case LEVEL_1 -> LEVEL_2;
|
||||
case LEVEL_2 -> LEVEL_3;
|
||||
case LEVEL_3 -> LEVEL_3; // 三级是最高级,返回null表示需要重置
|
||||
case LEVEL_3 -> null; // 三级是最高级,返回null表示需要重置
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -175,6 +175,11 @@ public class RocketStatus {
|
||||
* @param targetLevel 目标等级
|
||||
*/
|
||||
public void upgradeToLevel(RocketConfigGateway configGateway, RocketLevel targetLevel) {
|
||||
if (targetLevel == null) {
|
||||
this.status = RocketStatusEnum.LAUNCHED;
|
||||
return;
|
||||
}
|
||||
|
||||
// 查询目标等级的配置
|
||||
RocketConfig targetConfig = configGateway.findByLevel(targetLevel.getLevel());
|
||||
if (targetConfig == null || targetConfig.getStatus() != 1) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user