Skip to content

Commit

Permalink
switch per-round avionics/control hit tracking to boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
Algebro7 committed Aug 6, 2024
1 parent 805394c commit 4b0784d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
24 changes: 12 additions & 12 deletions megamek/src/megamek/common/Aero.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public String[] getLocationNames() {
* applied before the attack resolves.
*/
private int altLossThisRound = 0;
private int avionicsHitsThisRound = 0;
private int controlHitsThisRound = 0;
private boolean avionicsHitThisRound = false;
private boolean controlHitThisRound = false;

private boolean spheroid = false;

Expand Down Expand Up @@ -762,21 +762,21 @@ public void setAvionicsHits(int hits) {
}

@Override
public int getAvionicsHitsThisRound() {
return avionicsHitsThisRound;
public boolean isAvionicsHitThisRound() {
return avionicsHitThisRound;
}

@Override
public void setAvionicsHitsThisRound(int hits) {
avionicsHitsThisRound = hits;
public void setAvionicsHitThisRound(boolean hit) {
avionicsHitThisRound = hit;
}

public int getControlHitsThisRound() {
return controlHitsThisRound;
public boolean isControlHitThisRound() {
return controlHitThisRound;
}

public void setControlHitsThisRound(int hits) {
controlHitsThisRound = hits;
public void setControlHitThisRound(boolean hit) {
controlHitThisRound = hit;
}

public boolean isGearHit() {
Expand Down Expand Up @@ -1053,8 +1053,8 @@ public void newRound(int roundNumber) {
setWhoFirst();

resetAltLossThisRound();
setAvionicsHitsThisRound(0);
setControlHitsThisRound(0);
setAvionicsHitThisRound(false);
setControlHitThisRound(false);

// Reset usedInternalBombs
setUsedInternalBombs(0);
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/IAero.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public interface IAero {

int getAvionicsHits();

int getAvionicsHitsThisRound();
boolean isAvionicsHitThisRound();

void setAvionicsHitsThisRound(int i);
void setAvionicsHitThisRound(boolean hit);

int getSensorHits();

Expand Down
12 changes: 6 additions & 6 deletions megamek/src/megamek/common/LandAirMech.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public String[] getLocationAbbrs() {
private int straightMoves = 0;
private int altLoss = 0;
private int altLossThisRound = 0;
private int avionicsHitsThisRound = 0;
private boolean avionicsHitThisRound = false;


//Autoejection
Expand Down Expand Up @@ -882,7 +882,7 @@ public void newRound(int roundNumber) {
setWhoFirst();

resetAltLossThisRound();
setAvionicsHitsThisRound(0);
setAvionicsHitThisRound(false);
}
}

Expand Down Expand Up @@ -1335,13 +1335,13 @@ public int getAvionicsHits() {
}

@Override
public int getAvionicsHitsThisRound() {
return avionicsHitsThisRound;
public boolean isAvionicsHitThisRound() {
return avionicsHitThisRound;
}

@Override
public void setAvionicsHitsThisRound(int hits) {
avionicsHitsThisRound = hits;
public void setAvionicsHitThisRound(boolean hit) {
avionicsHitThisRound = hit;
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions megamek/src/megamek/server/GameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -24044,7 +24044,7 @@ private Vector<Report> applyMechSystemCritical(Entity en, int loc, CriticalSlot
break;
case LandAirMech.LAM_AVIONICS:
if (en.getConversionMode() == LandAirMech.CONV_MODE_FIGHTER) {
((LandAirMech)en).setAvionicsHitsThisRound(((LandAirMech)en).getAvionicsHitsThisRound() + 1);
((LandAirMech)en).setAvionicsHitThisRound(true);
if (en.isPartOfFighterSquadron()) {
game.addControlRoll(new PilotingRollData(
en.getTransportId(), 1, "avionics hit"));
Expand Down Expand Up @@ -24343,7 +24343,7 @@ private Vector<Report> applyAeroCritical(Aero aero, int loc, CriticalSlot cs, in
r.subject = aero.getId();
reports.add(r);
aero.setAvionicsHits(aero.getAvionicsHits() + 1);
aero.setAvionicsHitsThisRound(aero.getAvionicsHitsThisRound() + 1);
aero.setAvionicsHitThisRound(true);
if (aero.isPartOfFighterSquadron()) {
game.addControlRoll(new PilotingRollData(
aero.getTransportId(), 1, "avionics hit"));
Expand All @@ -24360,7 +24360,7 @@ private Vector<Report> applyAeroCritical(Aero aero, int loc, CriticalSlot cs, in
r = new Report(9115);
r.subject = aero.getId();
reports.add(r);
aero.setControlHitsThisRound(aero.getControlHitsThisRound() + 1);
aero.setControlHitThisRound(true);
if (aero.isPartOfFighterSquadron()) {
game.addControlRoll(new PilotingRollData(
aero.getTransportId(), 1, "critical hit"));
Expand Down

0 comments on commit 4b0784d

Please sign in to comment.