Skip to content

Commit

Permalink
Merge pull request #1410 from mkerensky/1407Fix
Browse files Browse the repository at this point in the history
Fix #1407
  • Loading branch information
NickAragua committed Jul 11, 2019
2 parents ed3295b + 9907aeb commit e88f0fd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions megamek/src/megamek/common/BattleArmor.java
Original file line number Diff line number Diff line change
Expand Up @@ -702,15 +702,20 @@ public HitData getTrooperAtLocation(HitData hit, Entity transport) {
}
break;
case Tank.LOC_REAR:
if ((getInternal(5) > 0) && (getInternal(6) > 0)) {
//Troopers 5 and 6 only exist when you have Clan and CS/WoB units, so we need
//to ensure the array is large enough before checking their status.
if (locations() >= 7 && ((getInternal(5) > 0) && (getInternal(6) > 0))) {
//If we have a live trooper 5 and 6, randomize who gets hit
loc = Compute.randomInt(2) + 5;
} else if (getInternal(5) > 0) {
loc = 5;
} else {
} else if ((locations() >= 7) && (getInternal(5) <= 0)) {
//If trooper 5 is dead, hit trooper 6
loc = 6;
} else {
loc = 5;
}
break;
}
//If we get here with an invalid loc for this squad, this next test should fail
if (loc < locations()) {
return new HitData(loc);
}
Expand Down

0 comments on commit e88f0fd

Please sign in to comment.