Skip to content

Commit

Permalink
more reported rolls
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronekochomusuke committed Nov 11, 2023
1 parent e55d81e commit d2caa6e
Show file tree
Hide file tree
Showing 17 changed files with 178 additions and 193 deletions.
28 changes: 15 additions & 13 deletions megamek/src/megamek/common/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13419,13 +13419,15 @@ private boolean doMASCOrSuperchargerFailureCheckFor(Mounted masc, Vector<Report>
HashMap<Integer, List<CriticalSlot>> vCriticals) {
if ((masc != null) && masc.curMode().equals("Armed")) {
boolean bFailure = false;
int nRoll = Compute.d6(2);
Roll discRoll = Compute.rollD6(2);
int rollValue = discRoll.getIntValue();
String rollReport = discRoll.getReport();
boolean isSupercharger = masc.getType().hasSubType(MiscType.S_SUPERCHARGER);
//WHY is this -1 here?
if (isSupercharger
&& (((this instanceof Mech) && ((Mech) this).isIndustrial())
|| (this instanceof SupportTank) || (this instanceof SupportVTOL))) {
nRoll -= 1;
rollValue -= 1;
}

if (isSupercharger) {
Expand All @@ -13442,10 +13444,10 @@ private boolean doMASCOrSuperchargerFailureCheckFor(Mounted masc, Vector<Report>
r.subject = getId();
r.indent();
r.add(isSupercharger ? getSuperchargerTarget() : getMASCTarget());
r.add(nRoll);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);

if ((!isSupercharger && (nRoll < getMASCTarget()))
|| (isSupercharger && (nRoll < getSuperchargerTarget()))) {
if ((!isSupercharger && (rollValue < getMASCTarget()))
|| (isSupercharger && (rollValue < getSuperchargerTarget()))) {
// uh oh
bFailure = true;
r.choose(false);
Expand All @@ -13454,33 +13456,33 @@ private boolean doMASCOrSuperchargerFailureCheckFor(Mounted masc, Vector<Report>
if (isSupercharger) {
// do the damage - engine crits
int hits = 0;
Roll diceRoll = Compute.rollD6(2);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
Roll diceRoll2 = Compute.rollD6(2);
int rollValue2 = diceRoll2.getIntValue();
String rollReport2 = diceRoll2.getReport();
r = new Report(6310);
r.subject = getId();
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(String.valueOf(rollValue2), rollReport2);
r.newlines = 0;
vDesc.addElement(r);
if (rollValue <= 7) {
if (rollValue2 <= 7) {
// no effect
r = new Report(6005);
r.subject = getId();
r.newlines = 0;
vDesc.addElement(r);
} else if ((rollValue >= 8) && (rollValue <= 9)) {
} else if ((rollValue2 == 8) || (rollValue2 == 9)) {
hits = 1;
r = new Report(6315);
r.subject = getId();
r.newlines = 0;
vDesc.addElement(r);
} else if ((rollValue >= 10) && (rollValue <= 11)) {
} else if ((rollValue2 ==10) || (rollValue2 == 11)) {
hits = 2;
r = new Report(6320);
r.subject = getId();
r.newlines = 0;
vDesc.addElement(r);
} else if (rollValue == 12) {
} else if (rollValue2 == 12) {
hits = 3;
r = new Report(6325);
r.subject = getId();
Expand Down
10 changes: 6 additions & 4 deletions megamek/src/megamek/common/Mech.java
Original file line number Diff line number Diff line change
Expand Up @@ -6252,13 +6252,15 @@ public boolean doRISCEmergencyCoolantCheckFor(Vector<Report> vDesc,
}
if (coolantSystem != null) {
boolean bFailure = false;
int nRoll = Compute.d6(2);
Roll diceRoll = Compute.rollD6(2);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
bUsedCoolantSystem = true;
vDesc.addElement(Report.subjectReport(2365, getId()).addDesc(this).add(coolantSystem.getName()));
int requiredRoll = EMERGENCY_COOLANT_SYSTEM_FAILURE[nCoolantSystemLevel];
Report r = Report.subjectReport(2370, getId()).indent().add(requiredRoll).add(nRoll);
Report r = Report.subjectReport(2370, getId()).indent().add(requiredRoll).addDataWithTooltip(String.valueOf(rollValue), rollReport);

if (nRoll < requiredRoll) {
if (rollValue < requiredRoll) {
// uh oh
bFailure = true;
r.choose(false);
Expand Down Expand Up @@ -6298,7 +6300,7 @@ public boolean doRISCEmergencyCoolantCheckFor(Vector<Report> vDesc,
} else {
r.choose(true);
vDesc.addElement(r);
nCoolantSystemMOS = nRoll - EMERGENCY_COOLANT_SYSTEM_FAILURE[nCoolantSystemLevel];
nCoolantSystemMOS = rollValue - EMERGENCY_COOLANT_SYSTEM_FAILURE[nCoolantSystemLevel];
}
return bFailure;
}
Expand Down
14 changes: 6 additions & 8 deletions megamek/src/megamek/common/weapons/ACCaselessHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@

import java.util.Vector;

import megamek.common.Compute;
import megamek.common.Game;
import megamek.common.Infantry;
import megamek.common.Report;
import megamek.common.ToHitData;
import megamek.common.*;
import megamek.common.actions.WeaponAttackAction;
import megamek.server.GameManager;

Expand Down Expand Up @@ -53,13 +49,15 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {
}

if ((roll <= 2) && !(ae instanceof Infantry)) {
int caselesscrit = Compute.d6(2);
Roll diceRoll = Compute.rollD6(2);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();

Report r = new Report(3164);
r.subject = subjectId;
r.add(caselesscrit);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);

if (caselesscrit >= 8) {
if (rollValue >= 8) {
// Round explodes destroying weapon
weapon.setDestroyed(true);
r.choose(false);
Expand Down
18 changes: 7 additions & 11 deletions megamek/src/megamek/common/weapons/AmmoWeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@

import java.util.Vector;

import megamek.common.Compute;
import megamek.common.CriticalSlot;
import megamek.common.HitData;
import megamek.common.Game;
import megamek.common.Mounted;
import megamek.common.Report;
import megamek.common.ToHitData;
import megamek.common.*;
import megamek.common.actions.WeaponAttackAction;
import megamek.common.options.OptionsConstants;
import megamek.server.GameManager;
Expand Down Expand Up @@ -104,22 +98,24 @@ protected boolean doAmmoFeedProblemCheck(Vector<Report> vPhaseReport) {
return false;
// attack roll was a 2, may explode
} else if (roll <= 2) {
int jamRoll = Compute.d6(2);
Roll diceRoll = Compute.rollD6(2);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();

Report r = new Report(3173);
r.subject = subjectId;
r.newlines = 0;
r.add(jamRoll);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
vPhaseReport.addElement(r);

if (jamRoll == 12) {
if (rollValue == 12) {
// round explodes in weapon
r = new Report(3163);
r.subject = subjectId;
vPhaseReport.addElement(r);

explodeRoundInBarrel(vPhaseReport);
} else if (jamRoll >= 10) {
} else if (rollValue >= 10) {
// plain old weapon jam
r = new Report(3161);
r.subject = subjectId;
Expand Down
8 changes: 5 additions & 3 deletions megamek/src/megamek/common/weapons/AreaEffectHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,18 @@ public static void checkInfantryDestruction(Entity entity, int distFromCenter, E
return;
}

int roll = Compute.d6(2);
int result = roll + distFromCenter;
Roll diceRoll = Compute.rollD6(2);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
int result = rollValue + distFromCenter;
boolean destroyed = result <= rollTarget;

Report r = new Report(9987);
r.indent(1);
r.subject = attacker.getId();
r.newlines = 1;
r.add(rollTarget);
r.add(roll);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.add(distFromCenter);
r.choose(destroyed);
vPhaseReport.addElement(r);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,7 @@
import java.util.Objects;
import java.util.Vector;

import megamek.common.AmmoType;
import megamek.common.BattleArmor;
import megamek.common.BombType;
import megamek.common.Building;
import megamek.common.Compute;
import megamek.common.Coords;
import megamek.common.Entity;
import megamek.common.HitData;
import megamek.common.Game;
import megamek.common.Infantry;
import megamek.common.Mounted;
import megamek.common.Report;
import megamek.common.TagInfo;
import megamek.common.TargetRoll;
import megamek.common.Targetable;
import megamek.common.ToHitData;
import megamek.common.WeaponType;
import megamek.common.*;
import megamek.common.actions.ArtilleryAttackAction;
import megamek.common.actions.WeaponAttackAction;
import megamek.common.enums.GamePhase;
Expand Down Expand Up @@ -513,20 +497,23 @@ protected int handleAMS(Vector<Report> vPhaseReport, Mounted ammoUsed) {
r.indent(1);
r.subject = subjectId;
vPhaseReport.add(r);
int destroyRoll = Compute.d6();
if (destroyRoll <= 3) {
Roll diceRoll = Compute.rollD6(1);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();

if (rollValue <= 3) {
r = new Report(3240);
r.subject = subjectId;
r.add("missile");
r.add(destroyRoll);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
vPhaseReport.add(r);
nDamPerHit = 0;
hits = 0;

} else {
r = new Report(3241);
r.add("missile");
r.add(destroyRoll);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.subject = subjectId;
vPhaseReport.add(r);
hits = 1;
Expand Down
24 changes: 8 additions & 16 deletions megamek/src/megamek/common/weapons/MechTaserHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,7 @@

import java.util.Vector;

import megamek.common.Aero;
import megamek.common.BattleArmor;
import megamek.common.Compute;
import megamek.common.Entity;
import megamek.common.HitData;
import megamek.common.Game;
import megamek.common.Mech;
import megamek.common.Protomech;
import megamek.common.Report;
import megamek.common.Tank;
import megamek.common.ToHitData;
import megamek.common.*;
import megamek.common.actions.WeaponAttackAction;
import megamek.server.GameManager;
import megamek.server.Server;
Expand Down Expand Up @@ -62,8 +52,10 @@ protected boolean specialResolution(Vector<Report> vPhaseReport, Entity entityTa
return done;
}
Report r = new Report(3700);
int taserRoll = Compute.d6(2);
r.add(taserRoll);
Roll diceRoll = Compute.rollD6(2);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.newlines = 0;
vPhaseReport.add(r);
if (entityTarget.getWeight() > 100) {
Expand All @@ -85,7 +77,7 @@ protected boolean specialResolution(Vector<Report> vPhaseReport, Entity entityTa
done = true;
} else if (entityTarget instanceof Mech) {
if (((Mech) entityTarget).isIndustrial()) {
if (taserRoll >= 8) {
if (rollValue >= 8) {
r = new Report(3705);
r.addDesc(entityTarget);
r.add(4);
Expand All @@ -99,7 +91,7 @@ protected boolean specialResolution(Vector<Report> vPhaseReport, Entity entityTa
entityTarget.setTaserInterference(2, 4, true);
}
} else {
if (taserRoll >= 11) {
if (rollValue >= 11) {
r = new Report(3705);
r.addDesc(entityTarget);
r.add(3);
Expand All @@ -117,7 +109,7 @@ protected boolean specialResolution(Vector<Report> vPhaseReport, Entity entityTa
} else if ((entityTarget instanceof Protomech)
|| (entityTarget instanceof Tank)
|| (entityTarget instanceof Aero)) {
if (taserRoll >= 8) {
if (rollValue >= 8) {
r = new Report(3705);
r.addDesc(entityTarget);
r.add(4);
Expand Down
8 changes: 5 additions & 3 deletions megamek/src/megamek/common/weapons/MissileWeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -843,12 +843,14 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
if (!game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_AERO_SANITY)) {
if (!bMissed && amsEngaged && !isTbolt() && !ae.isCapitalFighter()) {
// handle single AMS action against standard missiles
int amsRoll = Compute.d6();
Roll diceRoll = Compute.rollD6(1);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
r = new Report(3352);
r.subject = subjectId;
r.add(amsRoll);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
vPhaseReport.add(r);
hits = Math.max(0, hits - amsRoll);
hits = Math.max(0, hits - rollValue);
}
// Report any AMS bay action against standard missiles.
if (amsBayEngaged && (originalAV <= 0)) {
Expand Down
20 changes: 8 additions & 12 deletions megamek/src/megamek/common/weapons/NarcExplosiveHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@

import java.util.Vector;

import megamek.common.AmmoType;
import megamek.common.BattleArmor;
import megamek.common.Compute;
import megamek.common.Game;
import megamek.common.Infantry;
import megamek.common.Report;
import megamek.common.ToHitData;
import megamek.common.WeaponType;
import megamek.common.*;
import megamek.common.actions.WeaponAttackAction;
import megamek.server.GameManager;

Expand Down Expand Up @@ -79,18 +72,21 @@ protected int calcHits(Vector<Report> vPhaseReport) {
r.indent(1);
r.subject = subjectId;
vPhaseReport.add(r);
int destroyRoll = Compute.d6();
if (destroyRoll <= 3) {
Roll diceRoll = Compute.rollD6(1);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();

if (rollValue <= 3) {
r = new Report(3240);
r.subject = subjectId;
r.add("pod");
r.add(destroyRoll);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
vPhaseReport.add(r);
return 0;
}
r = new Report(3241);
r.add("pod");
r.add(destroyRoll);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.subject = subjectId;
vPhaseReport.add(r);
}
Expand Down
Loading

0 comments on commit d2caa6e

Please sign in to comment.