Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak princess gravity PSR handling #5864

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 42 additions & 42 deletions megamek/src/megamek/client/ui/SharedUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,50 +344,50 @@ private static Object doPSRCheck(MovePath md, boolean stringResult) {
rollTarget = entity.checkBogDown(step, overallMoveType, curHex,
lastPos, curPos, lastElevation, isPavementStep);
checkNag(rollTarget, nagReport, psrList);
}

// Check if used more MPs than Mech/Vehicle would have w/o gravity
if (!i.hasMoreElements() && !firstStep) {
if ((entity instanceof Mech) || (entity instanceof Tank)) {
if ((moveType == EntityMovementType.MOVE_WALK)
|| (moveType == EntityMovementType.MOVE_VTOL_WALK)
|| (moveType == EntityMovementType.MOVE_RUN)
|| (moveType == EntityMovementType.MOVE_VTOL_RUN)
|| (moveType == EntityMovementType.MOVE_SPRINT)
|| (moveType == EntityMovementType.MOVE_VTOL_SPRINT)) {
int limit = entity.getRunningGravityLimit();
if (step.isOnlyPavement() && entity.isEligibleForPavementBonus()) {
limit++;
}
if (step.getMpUsed() > limit) {
rollTarget = entity.checkMovedTooFast(step, overallMoveType);
checkNag(rollTarget, nagReport, psrList);
}
} else if (moveType == EntityMovementType.MOVE_JUMP) {
int origWalkMP = entity.getWalkMP(MPCalculationSetting.NO_GRAVITY);
int gravWalkMP = entity.getWalkMP();
if (step.getMpUsed() > entity.getJumpMP(MPCalculationSetting.NO_GRAVITY)) {
rollTarget = entity.checkMovedTooFast(step, overallMoveType);
checkNag(rollTarget, nagReport, psrList);
} else if ((game.getPlanetaryConditions().getGravity() > 1)
&& ((origWalkMP - gravWalkMP) > 0)) {
rollTarget = entity.getBasePilotingRoll(md.getLastStepMovementType());
entity.addPilotingModifierForTerrain(rollTarget, step);
int gravMod = game.getPlanetaryConditions()
.getGravityPilotPenalty();
if ((gravMod != 0) && !game.getBoard().inSpace()) {
rollTarget.addModifier(gravMod, game
.getPlanetaryConditions().getGravity()
+ "G gravity");
}
rollTarget.append(new PilotingRollData(entity
.getId(), 0, "jumped in high gravity"));
SharedUtility.checkNag(rollTarget, nagReport,
psrList);
}
if (step.getMpUsed() > entity.getSprintMP(MPCalculationSetting.NO_GRAVITY)) {
rollTarget = entity.checkMovedTooFast(step, overallMoveType);
checkNag(rollTarget, nagReport, psrList);
// Check if used more MPs than Mech/Vehicle would have w/o gravity
if (!i.hasMoreElements() && !firstStep) {
if ((entity instanceof Mech) || (entity instanceof Tank)) {
if ((moveType == EntityMovementType.MOVE_WALK)
|| (moveType == EntityMovementType.MOVE_VTOL_WALK)
|| (moveType == EntityMovementType.MOVE_RUN)
|| (moveType == EntityMovementType.MOVE_VTOL_RUN)
|| (moveType == EntityMovementType.MOVE_SPRINT)
|| (moveType == EntityMovementType.MOVE_VTOL_SPRINT)) {
int limit = entity.getRunningGravityLimit();
if (step.isOnlyPavement() && entity.isEligibleForPavementBonus()) {
limit++;
}
if (step.getMpUsed() > limit) {
rollTarget = entity.checkMovedTooFast(step, overallMoveType);
checkNag(rollTarget, nagReport, psrList);
}
} else if (moveType == EntityMovementType.MOVE_JUMP) {
int origWalkMP = entity.getWalkMP(MPCalculationSetting.NO_GRAVITY);
int gravWalkMP = entity.getWalkMP();
if (step.getMpUsed() > entity.getJumpMP(MPCalculationSetting.NO_GRAVITY)) {
rollTarget = entity.checkMovedTooFast(step, overallMoveType);
checkNag(rollTarget, nagReport, psrList);
} else if ((game.getPlanetaryConditions().getGravity() > 1)
&& ((origWalkMP - gravWalkMP) > 0)) {
rollTarget = entity.getBasePilotingRoll(md.getLastStepMovementType());
entity.addPilotingModifierForTerrain(rollTarget, step);
int gravMod = game.getPlanetaryConditions()
.getGravityPilotPenalty();
if ((gravMod != 0) && !game.getBoard().inSpace()) {
rollTarget.addModifier(gravMod, game
.getPlanetaryConditions().getGravity()
+ "G gravity");
}
rollTarget.append(new PilotingRollData(entity
.getId(), 0, "jumped in high gravity"));
SharedUtility.checkNag(rollTarget, nagReport,
psrList);
}
if (step.getMpUsed() > entity.getSprintMP(MPCalculationSetting.NO_GRAVITY)) {
rollTarget = entity.checkMovedTooFast(step, overallMoveType);
checkNag(rollTarget, nagReport, psrList);
}
}
}
Expand Down
Loading