Skip to content

Commit

Permalink
Merge pull request #4758 from SJuliez/#4734
Browse files Browse the repository at this point in the history
Non-Meks in fire hexes
  • Loading branch information
SJuliez authored Sep 8, 2023
2 parents dd008f7 + 33c7c14 commit c6d55b0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 41 deletions.
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()) {
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);
r.subject = entity.getId();
Expand Down

0 comments on commit c6d55b0

Please sign in to comment.