Skip to content

Commit

Permalink
review changes and others
Browse files Browse the repository at this point in the history
  • Loading branch information
SJuliez committed Sep 22, 2024
1 parent 0b2466f commit b8ce280
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions megamek/src/megamek/common/weapons/ASEWMissileWeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,42 +86,41 @@ protected void handleEntityDamage(Entity entityTarget,
vPhaseReport.add(r);
}
//Large craft suffer a to-hit penalty for the location struck.
if (entityTarget instanceof Dropship d) {
int loc = hit.getLocation();
d.setASEWAffected(loc, 2);
if (entityTarget instanceof Dropship dropship) {
dropship.setASEWAffected(hit.getLocation(), 2);
//Report the arc affected by the attack and the duration of the effects
r = new Report(3472);
r.subject = subjectId;
r.add(entityTarget.getLocationAbbr(hit));
vPhaseReport.add(r);
} else if (entityTarget instanceof Jumpship j) {
} else if (entityTarget instanceof Jumpship jumpship) {
int loc = hit.getLocation();
j.setASEWAffected(loc, 2);
jumpship.setASEWAffected(loc, 2);
//If a Warship is hit in the fore or aft side, the broadside arc is also affected
if ((j instanceof Warship)
if ((jumpship instanceof Warship)
&& (loc == Jumpship.LOC_FLS || loc == Jumpship.LOC_ALS)) {
j.setASEWAffected(Warship.LOC_LBS, 2);
jumpship.setASEWAffected(Warship.LOC_LBS, 2);
//Report the arc hit by the attack and the associated broadside and the duration of the effects
r = new Report(3474);
r.subject = subjectId;
r.add(entityTarget.getLocationAbbr(hit));
r.add("LBS");
vPhaseReport.add(r);
} else if ((j instanceof Warship)
} else if ((jumpship instanceof Warship)
&& (loc == Jumpship.LOC_FRS || loc == Jumpship.LOC_ARS)) {
j.setASEWAffected(Warship.LOC_RBS, 2);
jumpship.setASEWAffected(Warship.LOC_RBS, 2);
//Report the arc hit by the attack and the associated broadside and the duration of the effects
r = new Report(3474);
r.subject = subjectId;
r.add(entityTarget.getLocationAbbr(hit));
r.add("RBS");
vPhaseReport.add(r);
} else {
//If the nose or aft is hit, just report the arc affected by the attack and the duration of the effects
r = new Report(3472);
r.subject = subjectId;
r.add(entityTarget.getLocationAbbr(hit));
vPhaseReport.add(r);
//If the nose or aft is hit, just report the arc affected by the attack and the duration of the effects
r = new Report(3472);
r.subject = subjectId;
r.add(entityTarget.getLocationAbbr(hit));
vPhaseReport.add(r);
}
} else {
// Other units just suffer a flat +4 penalty until the effects expire
Expand All @@ -133,11 +132,6 @@ protected void handleEntityDamage(Entity entityTarget,
}
}

/**
* Calculate the attack value based on range
*
* @return an <code>int</code> representing the attack value at that range.
*/
@Override
protected int calcAttackValue() {
calcCounterAV();
Expand Down

0 comments on commit b8ce280

Please sign in to comment.