Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement 4397 internal bomb bay redux #5003

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
869b90a
Start on implementing #4397: Internal Bomb Bay quirk
Sleet01 Dec 5, 2023
cec225c
Start of Aero class hierarchy refactor to simplify shared attributes
Sleet01 Dec 5, 2023
ca077cd
First pass at splitting Aero into ASF (for external stores MP calcs) …
Sleet01 Dec 6, 2023
2a8b4d6
A lot of rework but now ASF bombs are busted.
Sleet01 Dec 7, 2023
6ec6796
cleanup temp test files
Sleet01 Dec 7, 2023
4f2cb3b
80% working for ASFs with cargo bays
Sleet01 Dec 12, 2023
505f452
Post-rebase to quirks-in-unit-files
Sleet01 Dec 14, 2023
0075f69
All functionality complete, added to allowed classes
Sleet01 Dec 17, 2023
2907d8e
Re-order UnitType indices for unit selection box
Sleet01 Dec 17, 2023
ab7d1bb
Adding Internal Bay indicator to summary, TRO, Weapons display, Syste…
Sleet01 Dec 17, 2023
49eb3da
Further cleanup, make ASF with bomb bays report correct weight in ver…
Sleet01 Dec 18, 2023
90ff570
Continuing refinement of internal bomb handling and verification
Sleet01 Dec 19, 2023
c3d916a
Updated ground fire check and first pass at proper MUL reinforcement …
Sleet01 Dec 19, 2023
b819db4
Fixed broken bomb loads in MUL reinforce: should only apply bombs in-…
Sleet01 Dec 20, 2023
f46b01c
Fixed some NPEs, including one causing Princess hangs, and clarified …
Sleet01 Dec 20, 2023
6d65165
Final cleanup and fixes for LAM/VTOL bombing
Sleet01 Dec 20, 2023
8a2e4d8
Remove unneeded extra stack trace variable
Sleet01 Dec 21, 2023
3be068e
Start on implementing IBB + Cargo crit, plus more cleanup
Sleet01 Dec 21, 2023
b74edc9
Various fixes for auto check complaints
Sleet01 Dec 28, 2023
d7d721c
Work on fixing search options, includes some extra stuff to remove
Sleet01 Dec 30, 2023
4ca0034
Reconstituting fixes from failed branch
Sleet01 Jan 2, 2024
94ee6c8
Fixes and updates from review
Sleet01 Jan 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions megamek/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies {
mainClassName = 'megamek.MegaMek'

ext {
mmJvmOptions = ['-Xmx2048m', '--add-opens', 'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.util.concurrent=ALL-UNNAMED']
mmJvmOptions = ['-Xmx4096m', '--add-opens', 'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.util.concurrent=ALL-UNNAMED', '-Dsun.awt.disablegrab=true']
data = 'data'
unitFiles = "${data}/mechfiles"
rats = "${data}/rat"
Expand Down Expand Up @@ -101,12 +101,12 @@ task equipmentList(type: JavaExec, dependsOn: jar) {

task copyFiles(type: Copy) {
description = 'Stages files that are to be copied into the distribution.'

dependsOn officialUnitList
dependsOn equipmentList

from projectDir

include "${data}/**"
include "${docs}/**"
include "${mmconf}/**"
Expand All @@ -116,9 +116,9 @@ task copyFiles(type: Copy) {
exclude { it.file.isDirectory() && (it.file in file(unitFiles).listFiles()) }
exclude "${rats}/**"
include "${userdata}/"

into fileStagingDir

inputs.dir "${data}"
inputs.dir "${docs}"
inputs.dir "${mmconf}"
Expand Down Expand Up @@ -176,7 +176,7 @@ task stageFiles {
dependsOn unitFilesZip
dependsOn ratZip
dependsOn deleteAtlasedImages

doLast {
mkdir "${fileStagingDir}/${log}"
}
Expand Down Expand Up @@ -249,7 +249,7 @@ createExe {
new File("${buildDir}/${outputDir}/${iniFile}").text = """# Launch4j runtime config
# you can add arguments here that will be processed by the JVM at runtime
${project.ext.mmJvmOptions.join('\n')}
"""
"""
}
}

Expand Down Expand Up @@ -320,7 +320,7 @@ task buildFromRepo (type: GradleBuild) {
description = 'Assembles the distribution packages in the clean repository copy'
group = 'distribution'
dependsOn cloneMMRepo

dir = "${mmRepoDir}"
tasks = [ ':megamek:assembleDist' ]
}
Expand All @@ -329,7 +329,7 @@ task release (type: Copy) {
description = 'Builds the release packages from the repository and copies them into the project build directory'
group = 'distribution'
dependsOn buildFromRepo

from (buildFromRepo)
into "${distributionDir}"
}
Expand Down
1 change: 1 addition & 0 deletions megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3950,6 +3950,7 @@ WeaponAttackAction.AttackerNotReady=Attacker is in no condition to fire weapons.
WeaponAttackAction.AttackerTooHigh=attacker is too high.
WeaponAttackAction.BusyAltBombing=Already altitude bombing.
WeaponAttackAction.BusyDiveBombing=Already dive bombing.
WeaponAttackAction.AlreadyUsedMaxInternalBombs=Already used maximum internal bombs (6).
WeaponAttackAction.BusyLayingMines=Can't fire weapons when laying mines.
WeaponAttackAction.BusySpaceBombing=Already space bombing.
WeaponAttackAction.CantShootAndFastMove=Infantry fast moved this turn and so can not shoot.
Expand Down
3 changes: 2 additions & 1 deletion megamek/i18n/megamek/common/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ PlanetaryConditions.Indicator.Gravity.Normal=\u23AF
PlanetaryConditions.Indicator.Gravity.High=\u2B73
PlanetaryConditions.Indicator.EMI.true=\u2301
PlanetaryConditions.Indicator.EMI.false=\u2312
UnitType.Aero=Aerospace Fighter
UnitType.Aero=Aerospace
UnitType.AeroSpaceFighter=Aerospace Fighter
UnitType.BattleArmor=Battle Armor
UnitType.Conventional\ Fighter=Conventional Fighter
UnitType.Dropship=Dropship
Expand Down
2 changes: 1 addition & 1 deletion megamek/i18n/megamek/common/options/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ QuirksInfo.option.good_rep_2.description=Unit costs 25% more C-bills.\nincluded
QuirksInfo.option.hyper_actuator.displayableName=Hyper-Extending Actuators
QuirksInfo.option.hyper_actuator.description=This unit can flip arms,\neven with lower arm and hand actuators. (SO pg 194)
QuirksInfo.option.internal_bomb.displayableName=Internal Bomb Bay
QuirksInfo.option.internal_bomb.description=No game effect,\ncurrently. (SO pg 195)
QuirksInfo.option.internal_bomb.description=Allows some units to utilize cargo space as bomb bays, but risk internal explosions. (SO pg 195)
QuirksInfo.option.low_profile.displayableName=Narrow/Low Profile
QuirksInfo.option.low_profile.description=This unit is may take less damage because of a narrow/low profile. (BMM pg 85)
QuirksInfo.option.imp_com.displayableName=Improved Communications
Expand Down
9 changes: 9 additions & 0 deletions megamek/i18n/megamek/common/report-messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,15 @@
5543=<font color='008000'>success!</font>
5550=External heat reduced due to intact heat-dissipating armor!
5560=<data> takes over as <data> of <data> (<data>).
5600=<newline>Bomb Bay Explosions<newline>-------------------
5601=<data> (<data>) took ground fire damage while dropping internal bay bombs.
5602=<data> (<data>) must roll under <data>+ to avoid bomb bay explosion, rolls <data>.
5603=\ <font color='C00000'><data> (<data>) takes <data> damage when <data> remaining bombs explode!</font>
5604=\ <font color='008000'><data> (<data>) avoids bomb bay explosion; <data> internal bombs remaining.</font>
5605=\ <font color='C00000'><data> (<data>) suffers a critical Cargo hit; <msg:5606,5607></font>
5606=player must choose <data> bombs to be destroyed.
5607=bot loses <data> bombs.
5608=<data> (<data>) Internal Bomb Bay + Cargo critical: Damage exceeds remaining bombs; all bombs destroyed.

#6000's -- Damage Related
6005=\ no effect.
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/MegaMek.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,4 @@ public static void initializeSuiteGraphicalSetups(final String currentProject) {
// Setup Button Order Preferences
ButtonOrderPreferences.getInstance().setButtonPriorities();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,14 @@ public static double evaluateIncomingArtilleryDamage(Coords coords, Princess ope

if ((aaa.getTurnsTilHit() == 0) && (aaa.getTarget(operator.getGame()) != null)) {
// damage for artillery weapons is, for some reason, derived from the weapon type's rack size
int damage = 0;
Mounted weapon = aaa.getEntity(operator.getGame()).getEquipment(aaa.getWeaponId());
int damage = ((WeaponType) weapon.getType()).getRackSize();
if (weapon.getType() instanceof BombType){
damage = (weapon.getExplosionDamage());
} else {
damage = ((WeaponType) weapon.getType()).getRackSize();
}


// distance from given coordinates reduces damage
Coords attackDestination = aaa.getTarget(operator.getGame()).getPosition();
Expand Down
23 changes: 17 additions & 6 deletions megamek/src/megamek/client/bot/princess/FireControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ WeaponFireInfo buildWeaponFireInfo(final Entity shooter,
final boolean assumeUnderFlightPath,
final boolean guessToHit) {
return new WeaponFireInfo(shooter, flightPath, target, targetState,
weapon, game, assumeUnderFlightPath, guessToHit, owner, new int[0]);
weapon, game, assumeUnderFlightPath, guessToHit, owner, null);
}

/**
Expand All @@ -1465,9 +1465,9 @@ private WeaponFireInfo buildWeaponFireInfo(final Entity shooter,
final Game game,
final boolean assumeUnderFlightPath,
final boolean guessToHit,
final int[] bombPayload) {
final HashMap<String, int[]> bombPayloads) {
return new WeaponFireInfo(shooter, flightPath, target, targetState,
weapon, game, assumeUnderFlightPath, guessToHit, owner, bombPayload);
weapon, game, assumeUnderFlightPath, guessToHit, owner, bombPayloads);
}

/**
Expand Down Expand Up @@ -1694,11 +1694,22 @@ private FiringPlan getDiveBombPlan(final Entity shooter,
while (weaponIter.hasNext()) {
final Mounted weapon = weaponIter.next();
if (weapon.getType().hasFlag(WeaponType.F_DIVE_BOMB)) {
final int[] bombPayload = new int[BombType.B_NUM];
final HashMap<String, int[]> bombPayloads = new HashMap<String, int[]>();
bombPayloads.put("internal", new int[BombType.B_NUM]);
bombPayloads.put("external", new int[BombType.B_NUM]);

// load up all droppable bombs, yeah baby! Mix thunder bombs and infernos 'cause why the hell not.
// seriously, though, TODO: more intelligent bomb drops
for (final Mounted bomb : shooter.getBombs(BombType.F_GROUND_BOMB)) {
bombPayload[((BombType) bomb.getType()).getBombType()]++;
int bType = ((BombType) bomb.getType()).getBombType();
if (bomb.isInternalBomb()) {
// Can only drop 6 internal bombs in one turn.
if (bombPayloads.get("internal")[bType] < 6) {
bombPayloads.get("internal")[bType]++;
}
} else {
bombPayloads.get("external")[bType]++;
}
}

final WeaponFireInfo diveBomb = buildWeaponFireInfo(shooter,
Expand All @@ -1709,7 +1720,7 @@ private FiringPlan getDiveBombPlan(final Entity shooter,
game,
passedOverTarget,
guess,
bombPayload);
bombPayloads);
diveBombPlan.add(diveBomb);
}
}
Expand Down
Loading
Loading