Skip to content

Commit

Permalink
Merge pull request #5003 from Sleet01/implement_4397_internal_bomb_ba…
Browse files Browse the repository at this point in the history
…y_redux

Implement 4397 internal bomb bay redux
  • Loading branch information
SJuliez authored Jan 3, 2024
2 parents 5f45b0a + 94ee6c8 commit 330199b
Show file tree
Hide file tree
Showing 64 changed files with 2,282 additions and 1,302 deletions.
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

0 comments on commit 330199b

Please sign in to comment.