Skip to content

Commit

Permalink
Merge pull request #6024 from SJuliez/field-guns-explosion
Browse files Browse the repository at this point in the history
#5995 - Prevent Field Guns from exploding/jamming
  • Loading branch information
SJuliez authored Sep 22, 2024
2 parents 7beb861 + a70aa0e commit e049e37
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/weapons/ACCaselessHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
return true;
}

if ((roll.getIntValue() <= 2) && !(ae instanceof Infantry)) {
if ((roll.getIntValue() <= 2) && !ae.isConventionalInfantry()) {
Roll diceRoll = Compute.rollD6(2);

Report r = new Report(3164);
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/weapons/AmmoWeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ protected boolean doAmmoFeedProblemCheck(Vector<Report> vPhaseReport) {
// don't have neg ammo feed problem quirk
if (!weapon.hasQuirk(OptionsConstants.QUIRK_WEAP_NEG_AMMO_FEED_PROBLEMS)) {
return false;
} else if ((roll.getIntValue() <= 2) && !ae.isConventionalInfantry()) {
// attack roll was a 2, may explode
} else if (roll.getIntValue() <= 2) {
Roll diceRoll = Compute.rollD6(2);

Report r = new Report(3173);
Expand Down Expand Up @@ -142,8 +142,8 @@ protected boolean doAmmoFeedProblemCheck(Vector<Report> vPhaseReport) {
vPhaseReport.addElement(r);
return false;
}
// attack roll was not 2, won't explode
} else {
// attack roll was not 2, won't explode
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/weapons/HVACWeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
return true;
}

if (roll.getIntValue() == 2) {
if ((roll.getIntValue() == 2) && !ae.isConventionalInfantry()) {
Report r = new Report(3162);
r.subject = subjectId;
weapon.setJammed(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
return true;
}

if (roll.getIntValue() == 2) {
if ((roll.getIntValue() == 2) && !ae.isConventionalInfantry()) {
Report r = new Report(3161);
r.subject = subjectId;
r.newlines = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
if (doAmmoFeedProblemCheck(vPhaseReport)) {
return true;
}
if (roll.getIntValue() == 2) {

if ((roll.getIntValue() == 2) && !ae.isConventionalInfantry()) {
Report r = new Report(3165);
r.subject = subjectId;
weapon.setJammed(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public PrototypeCLUltraWeaponHandler(ToHitData t, WeaponAttackAction w, Game g,
protected boolean doChecks(Vector<Report> vPhaseReport) {
if (doAmmoFeedProblemCheck(vPhaseReport)) {
return true;
} else if (ae.isConventionalInfantry()) {
return false;
}

if ((roll.getIntValue() <= 3) && (howManyShots == 2)) {
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/weapons/PrototypeGaussHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
if (doAmmoFeedProblemCheck(vPhaseReport)) {
return true;
}
if (roll.getIntValue() == 2) {

if ((roll.getIntValue() == 2) && !ae.isConventionalInfantry()) {
Report r = new Report(3165);
r.subject = subjectId;
weapon.setJammed(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public PrototypeISUltraWeaponHandler(ToHitData t, WeaponAttackAction w, Game g,
protected boolean doChecks(Vector<Report> vPhaseReport) {
if (doAmmoFeedProblemCheck(vPhaseReport)) {
return true;
} else if (ae.isConventionalInfantry()) {
return false;
}

if (((roll.getIntValue() <= 4) && (howManyShots == 2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
return true;
}

if (roll.getIntValue() == 2) {
if ((roll.getIntValue() == 2) && !ae.isConventionalInfantry()) {
Report r = new Report(3165);
r.subject = subjectId;
weapon.setJammed(true);
Expand Down
4 changes: 1 addition & 3 deletions megamek/src/megamek/common/weapons/RACHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ public RACHandler(ToHitData t, WeaponAttackAction w, Game g, TWGameManager m) {
protected boolean doChecks(Vector<Report> vPhaseReport) {
if (doAmmoFeedProblemCheck(vPhaseReport)) {
return true;
}

if (ae instanceof Infantry) {
} else if (ae.isConventionalInfantry()) {
return false;
}
boolean jams = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
if (kindRapidFire) {
jamLevel = 2;
}
if ((roll.getIntValue() <= jamLevel) && (howManyShots == 2) && !(ae instanceof Infantry)) {
if ((roll.getIntValue() <= jamLevel) && (howManyShots == 2) && !ae.isConventionalInfantry()) {
if (roll.getIntValue() > 2 || kindRapidFire) {
Report r = new Report(3161);
r.subject = subjectId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
return true;
}

if (roll.getIntValue() == 2) {
if ((roll.getIntValue() == 2) && !ae.isConventionalInfantry()) {
Report r = new Report(3162);
r.subject = subjectId;
weapon.setJammed(true);
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/weapons/UltraWeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
return true;
}

if ((roll.getIntValue() == 2) && (howManyShots == 2) && !(ae instanceof Infantry)) {
if ((roll.getIntValue() == 2) && (howManyShots == 2) && !ae.isConventionalInfantry()) {
Report r = new Report();
r.subject = subjectId;
weapon.setJammed(true);
Expand Down

0 comments on commit e049e37

Please sign in to comment.