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

Non-Meks in fire hexes #4758

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions megamek/src/megamek/client/ui/SharedUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ private static Object doPSRCheck(MovePath md, boolean stringResult) {
lastPos, curPos, isPavementStep);
checkNag(rollTarget, nagReport, psrList);

// check for non-mech entering a fire
// check for non-heat tracking entering a fire
boolean underwater = curHex.containsTerrain(Terrains.WATER)
&& (curHex.depth() > 0)
&& (step.getElevation() < curHex.getLevel());
if (curHex.containsTerrain(Terrains.FIRE) && !underwater
&& !(entity instanceof Mech) && (step.getElevation() <= 1)
&& !entity.tracksHeat() && (step.getElevation() <= 1) && !entity.isAirborne()
&& (moveType != EntityMovementType.MOVE_JUMP)
&& !(curPos.equals(lastPos))) {
nagReport.append(Messages.getString("MovementDisplay.FireMoving", 8));
Expand Down
71 changes: 32 additions & 39 deletions megamek/src/megamek/server/GameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7607,21 +7607,15 @@ private void processMovement(Entity entity, MovePath md, Map<EntityTargetPair,

// check to see if we are a mech and we've moved OUT of fire
Hex lastHex = game.getBoard().getHex(lastPos);
if (entity instanceof Mech) {
if (entity.tracksHeat() && !entity.isAirborne()) {
if (!lastPos.equals(curPos) && (prevStep != null)
&& ((lastHex.containsTerrain(Terrains.FIRE)
&& (prevStep.getElevation() <= 1))
|| (lastHex.containsTerrain(Terrains.MAGMA)
&& (prevStep.getElevation() == 0)))
&& ((lastHex.containsTerrain(Terrains.FIRE) && (prevStep.getElevation() <= 1))
|| (lastHex.containsTerrain(Terrains.MAGMA) && (prevStep.getElevation() == 0)))
&& ((stepMoveType != EntityMovementType.MOVE_JUMP)
// Bug #828741 -- jumping bypasses fire, but not
// on the
// first step
// Bug #828741 -- jumping bypasses fire, but not on the first step
// getMpUsed -- total MP used to this step
// getMp -- MP used in this step
// the difference will always be 0 on the "first
// step"
// of a jump,
// the difference will always be 0 on the "first step" of a jump,
// and >0 on a step in the midst of a jump
|| (0 == (step.getMpUsed() - step.getMp())))) {
int heat = 0;
Expand All @@ -7633,7 +7627,9 @@ private void processMovement(Entity entity, MovePath md, Map<EntityTargetPair,
} else if (lastHex.terrainLevel(Terrains.MAGMA) == 2) {
heat += 5;
}
if (((Mech) entity).hasIntactHeatDissipatingArmor()) {
boolean isMekWithHeatDissipatingArmor = (entity instanceof Mech)
&& ((Mech) entity).hasIntactHeatDissipatingArmor();
if (isMekWithHeatDissipatingArmor) {
heat /= 2;
}
entity.heatFromExternal += heat;
Expand All @@ -7642,7 +7638,7 @@ private void processMovement(Entity entity, MovePath md, Map<EntityTargetPair,
r.addDesc(entity);
r.add(heat);
addReport(r);
if (((Mech) entity).hasIntactHeatDissipatingArmor()) {
if (isMekWithHeatDissipatingArmor) {
r = new Report(5550);
addReport(r);
}
Expand Down Expand Up @@ -18621,6 +18617,24 @@ private void resolveHeat() {
}
}

if (entity.tracksHeat() && (entityHex != null) && entityHex.containsTerrain(Terrains.FIRE) && (entityHex.getFireTurn() > 0)
&& (entity.getElevation() <= 1) && (entity.getAltitude() == 0)) {
int heatToAdd = 5;
boolean isMekWithHeatDissipatingArmor = (entity instanceof Mech) && ((Mech) entity).hasIntactHeatDissipatingArmor();
if (isMekWithHeatDissipatingArmor) {
heatToAdd /= 2;
}
entity.heatFromExternal += heatToAdd;
r = new Report(5030);
r.add(heatToAdd);
r.subject = entity.getId();
addReport(r);
if (isMekWithHeatDissipatingArmor) {
r = new Report(5550);
addReport(r);
}
}

// put in ASF heat build-up first because there are few differences
if (entity instanceof Aero && !(entity instanceof ConvFighter)) {
ServerHelper.resolveAeroHeat(game, entity, vPhaseReport, rhsReports, radicalHSBonus, hotDogMod, this);
Expand Down Expand Up @@ -18731,22 +18745,6 @@ private void resolveHeat() {
// Add +5 Heat if the hex you're in is on fire
// and was on fire for the full round.
if (entityHex != null) {
if (entityHex.containsTerrain(Terrains.FIRE) && (entityHex.getFireTurn() > 0)
&& (entity.getElevation() <= 1)) {
int heatToAdd = 5;
if (((Mech) entity).hasIntactHeatDissipatingArmor()) {
heatToAdd /= 2;
}
entity.heatFromExternal += heatToAdd;
r = new Report(5030);
r.add(heatToAdd);
r.subject = entity.getId();
addReport(r);
if (((Mech) entity).hasIntactHeatDissipatingArmor()) {
r = new Report(5550);
addReport(r);
}
}
int magma = entityHex.terrainLevel(Terrains.MAGMA);
if ((magma > 0) && (entity.getElevation() == 0)) {
int heatToAdd = 5 * magma;
Expand Down Expand Up @@ -19481,6 +19479,11 @@ private void resolveHarJelRepairs() {
* @param coordinates the coordinate location of the fire
*/
private void doFlamingDamage(final Entity entity, final Coords coordinates) {
// TO:AR p.41,p.43
if (entity.tracksHeat() || entity.isDropShip()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't all dropships track heat?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DS technically are not heat-tracking units, since they never use the Heat Scale (even though their weapons usage is limited by heat sink capacity). They are explicitly called out as unaffected by fire in the TO:AR fire rules, however.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tracksHeat() is only true for Meks, ASF and Small Craft. Dropships have an override to return false.

return;
}

Report r;
int boomRoll = Compute.d6(2);

Expand All @@ -19505,16 +19508,6 @@ private void doFlamingDamage(final Entity entity, final Coords coordinates) {
return;
}

// mechs shouldn't be here, but just in case
if (entity instanceof Mech) {
return;
}

// fire has no effect on dropships
if (entity instanceof Dropship) {
return;
}

// Must roll 8+ to survive...
r = new Report(5100);
kuronekochomusuke marked this conversation as resolved.
Show resolved Hide resolved
r.subject = entity.getId();
Expand Down