Skip to content

Commit

Permalink
Add option to apply weight multiplier to ammo costs ala MML
Browse files Browse the repository at this point in the history
  • Loading branch information
lbmaian committed Dec 20, 2023
1 parent 42b54d2 commit af51ba0
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 4 deletions.
34 changes: 33 additions & 1 deletion saw/src/main/java/saw/gui/dlgPrefs.form
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="2" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>

Expand Down Expand Up @@ -537,6 +537,38 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel15">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Cost Options">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</TitledBorder>
</Border>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>

<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Component class="javax.swing.JCheckBox" name="chkCostAmmoMult">
<Properties>
<Property name="text" type="java.lang.String" value="Apply weight mult to ammo (ala MML)"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel13">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
Expand Down
24 changes: 23 additions & 1 deletion saw/src/main/java/saw/gui/dlgPrefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ private void SetState() {
chkHeatAllMP.setEnabled( true );
}
chkHeatUAC.setSelected( Prefs.getBoolean( "HeatACFullRate", false ) );
chkCostAmmoMult.setSelected( Prefs.getBoolean( "CostAmmoMult", false ) );
chkAutoAddECM.setSelected( Prefs.getBoolean( "AutoAddECM", true ) );

chkMaxNotInt.setSelected( Prefs.getBoolean( "UseMaxArmorInstead", false ) );
Expand Down Expand Up @@ -155,6 +156,7 @@ private void SaveState() {
Prefs.putBoolean( "HeatExcludeJumpMP", chkHeatJumpMP.isSelected() );
Prefs.putBoolean( "HeatExcludeAllMP", chkHeatAllMP.isSelected() );
Prefs.putBoolean( "HeatACFullRate", chkHeatUAC.isSelected() );
Prefs.putBoolean( "CostAmmoMult", chkCostAmmoMult.isSelected() );
Prefs.putBoolean( "UseMaxArmorInstead", chkMaxNotInt.isSelected() );
Prefs.putBoolean( "ArmorUseCustomPercent", chkCustomPercents.isSelected() );
Prefs.putBoolean( "ArmorMaxHead", rdoArmorMaxHead.isSelected() );
Expand Down Expand Up @@ -219,6 +221,7 @@ private void SetDefaults() {
Prefs.putBoolean( "HeatExcludeJumpMP", false );
Prefs.putBoolean( "HeatExcludeAllMP", false );
Prefs.putBoolean( "HeatACFullRate", false );
Prefs.putBoolean( "CostAmmoMult", false );
Prefs.putBoolean( "UseMaxArmorInstead", false );
Prefs.putBoolean( "ArmorUseCustomPercent", false );
Prefs.putBoolean( "ArmorMaxHead", true );
Expand Down Expand Up @@ -298,6 +301,8 @@ private void initComponents() {
chkHeatAllMP = new javax.swing.JCheckBox();
chkHeatUAC = new javax.swing.JCheckBox();
jLabel19 = new javax.swing.JLabel();
jPanel15 = new javax.swing.JPanel();
chkCostAmmoMult = new javax.swing.JCheckBox();
jPanel13 = new javax.swing.JPanel();
chkAutoAddECM = new javax.swing.JCheckBox();
jPanel4 = new javax.swing.JPanel();
Expand Down Expand Up @@ -674,10 +679,25 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridheight = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
pnlConstruction.add(jPanel8, gridBagConstraints);

jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Cost Options"));
jPanel15.setLayout(new java.awt.GridBagLayout());

chkCostAmmoMult.setText("Apply weight mult to ammo (ala MML)");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
jPanel15.add(chkCostAmmoMult, gridBagConstraints);

gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
pnlConstruction.add(jPanel15, gridBagConstraints);

jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Usability Options"));
jPanel13.setLayout(new javax.swing.BoxLayout(jPanel13, javax.swing.BoxLayout.LINE_AXIS));

Expand Down Expand Up @@ -1667,6 +1687,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt)
private javax.swing.JButton btnSetDefaults;
private javax.swing.JButton btnTXTPath;
private javax.swing.JCheckBox chkAutoAddECM;
private javax.swing.JCheckBox chkCostAmmoMult;
private javax.swing.JCheckBox chkCustomPercents;
private javax.swing.JCheckBox chkGroupAmmoAtBottom;
private javax.swing.JCheckBox chkHeatAllMP;
Expand Down Expand Up @@ -1705,6 +1726,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt)
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel15;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
Expand Down
34 changes: 33 additions & 1 deletion ssw/src/main/java/ssw/gui/dlgPrefs.form
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="2" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>

Expand Down Expand Up @@ -537,6 +537,38 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel15">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Cost Options">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</TitledBorder>
</Border>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>

<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Component class="javax.swing.JCheckBox" name="chkCostAmmoMult">
<Properties>
<Property name="text" type="java.lang.String" value="Apply weight mult to ammo (ala MML)"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel13">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
Expand Down
24 changes: 23 additions & 1 deletion ssw/src/main/java/ssw/gui/dlgPrefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ private void SetState() {
chkHeatAllMP.setEnabled( true );
}
chkHeatUAC.setSelected( Prefs.getBoolean( "HeatACFullRate", false ) );
chkCostAmmoMult.setSelected( Prefs.getBoolean( "CostAmmoMult", false ) );
chkAutoAddECM.setSelected( Prefs.getBoolean( "AutoAddECM", true ) );

chkMaxNotInt.setSelected( Prefs.getBoolean( "UseMaxArmorInstead", false ) );
Expand Down Expand Up @@ -152,6 +153,7 @@ private void SaveState() {
Prefs.putBoolean( "HeatExcludeJumpMP", chkHeatJumpMP.isSelected() );
Prefs.putBoolean( "HeatExcludeAllMP", chkHeatAllMP.isSelected() );
Prefs.putBoolean( "HeatACFullRate", chkHeatUAC.isSelected() );
Prefs.putBoolean( "CostAmmoMult", chkCostAmmoMult.isSelected() );
Prefs.putBoolean( "UseMaxArmorInstead", chkMaxNotInt.isSelected() );
Prefs.putBoolean( "ArmorUseCustomPercent", chkCustomPercents.isSelected() );
Prefs.putBoolean( "ArmorMaxHead", rdoArmorMaxHead.isSelected() );
Expand Down Expand Up @@ -214,6 +216,7 @@ private void SetDefaults() {
Prefs.putBoolean( "HeatExcludeJumpMP", false );
Prefs.putBoolean( "HeatExcludeAllMP", false );
Prefs.putBoolean( "HeatACFullRate", false );
Prefs.putBoolean( "CostAmmoMult", false );
Prefs.putBoolean( "UseMaxArmorInstead", false );
Prefs.putBoolean( "ArmorUseCustomPercent", false );
Prefs.putBoolean( "ArmorMaxHead", true );
Expand Down Expand Up @@ -293,6 +296,8 @@ private void initComponents() {
chkHeatAllMP = new javax.swing.JCheckBox();
chkHeatUAC = new javax.swing.JCheckBox();
jLabel19 = new javax.swing.JLabel();
jPanel15 = new javax.swing.JPanel();
chkCostAmmoMult = new javax.swing.JCheckBox();
jPanel13 = new javax.swing.JPanel();
chkAutoAddECM = new javax.swing.JCheckBox();
jPanel4 = new javax.swing.JPanel();
Expand Down Expand Up @@ -668,10 +673,25 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridheight = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
pnlConstruction.add(jPanel8, gridBagConstraints);

jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Cost Options"));
jPanel15.setLayout(new java.awt.GridBagLayout());

chkCostAmmoMult.setText("Apply weight mult to ammo (ala MML)");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
jPanel15.add(chkCostAmmoMult, gridBagConstraints);

gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
pnlConstruction.add(jPanel15, gridBagConstraints);

jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Usability Options"));
jPanel13.setLayout(new javax.swing.BoxLayout(jPanel13, javax.swing.BoxLayout.LINE_AXIS));

Expand Down Expand Up @@ -1653,6 +1673,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt)
private javax.swing.JButton btnSetDefaults;
private javax.swing.JButton btnTXTPath;
private javax.swing.JCheckBox chkAutoAddECM;
private javax.swing.JCheckBox chkCostAmmoMult;
private javax.swing.JCheckBox chkCustomPercents;
private javax.swing.JCheckBox chkGroupAmmoAtBottom;
private javax.swing.JCheckBox chkHeatAllMP;
Expand Down Expand Up @@ -1691,6 +1712,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt)
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel15;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
Expand Down
15 changes: 15 additions & 0 deletions sswlib/src/main/java/components/CombatVehicle.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,19 @@ public class CombatVehicle implements ifUnit, ifBattleforce {
1.3, 1.3, 1.3, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.5,
1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6 };

// Constructors
public CombatVehicle() {
// no prefs file, create a default.
Prefs = Preferences.userRoot().node( Constants.SAWPrefs );
Load();
}

public CombatVehicle( Preferences p ) {
Prefs = p;
Load();
}

private void Load() {
OmniAvailable.SetCodes( 'E', 'X', 'E', 'E', 'D', 'E', 'X', 'E', 'E', 'D' );
OmniAvailable.SetFactions( "", "", "", "", "", "", "", "" );
OmniAvailable.SetISDates( 0, 0, false, 3010, 0, 0, false, false );
Expand Down Expand Up @@ -2579,6 +2591,9 @@ public double GetAmmoCosts() {
retval += ( (abPlaceable) v.get( i ) ).GetCost();
}
}
if( Prefs.getBoolean( "CostAmmoMult", false ) ) {
retval *= GetCostMult() * GetConfigMultiplier();
}
return retval;
} else {
return retval;
Expand Down
3 changes: 3 additions & 0 deletions sswlib/src/main/java/components/Mech.java
Original file line number Diff line number Diff line change
Expand Up @@ -3405,6 +3405,9 @@ public double GetAmmoCosts() {
retval += ( (abPlaceable) v.get( i ) ).GetCost();
}
}
if( Prefs.getBoolean( "CostAmmoMult", false ) ) {
retval *= GetCostMult();
}
return retval;
} else {
return retval;
Expand Down

0 comments on commit af51ba0

Please sign in to comment.