Skip to content

Commit

Permalink
Add back penalty to modules, reduce base penalty to 6%
Browse files Browse the repository at this point in the history
  • Loading branch information
qcwxezda committed Nov 5, 2023
1 parent bacb3f8 commit 1036eda
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 33 deletions.
2 changes: 1 addition & 1 deletion latest_changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- Change: DP penalty now only applies to player ships; now only applies to s-mod slots added via this mod's interface

- Balancing: Reduce default DP penalty to 6% per additional S-Mod
- Fix: correctly award XP for damage dealt by drones (as long as DRONE_MOTHERSHIP is set properly)
2 changes: 1 addition & 1 deletion progsmod_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Deployment cost increase per additional s-mod,
# as fraction of base DP cost
"deploymentCostPenalty": 0.08,
"deploymentCostPenalty": 0.06,

# How many story points it costs to raise
# a ship's maximum number of built-in hull mods
Expand Down
16 changes: 8 additions & 8 deletions src/progsmod/data/campaign/NPCFleetSModTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ private void addXPTrackerToSModdedShips(CampaignFleetAPI fleet) {
if (fleet == null || fleet.getBattle() == null || fleet.getBattle().getCombinedTwo() == null) {
return;
}
for (FleetMemberAPI fm : fleet.getBattle().getCombinedTwo().getMembersWithFightersCopy()) {
if (!fm.isFighterWing() && fm.getVariant() != null) {
int numOverLimit = SModUtils.getSModsOverLimitIncludeModules(fm.getVariant(), fm.getStats());
if (numOverLimit > 0 && !fm.getVariant().hasHullMod("progsmod_xptracker")) {
fm.getVariant().addPermaMod("progsmod_xptracker", false);
}
}
}
// for (FleetMemberAPI fm : fleet.getBattle().getCombinedTwo().getMembersWithFightersCopy()) {
// if (!fm.isFighterWing() && fm.getVariant() != null) {
// int numOverLimit = SModUtils.getSModsOverLimitIncludeModules(fm.getVariant(), fm.getStats());
// if (numOverLimit > 0 && !fm.getVariant().hasHullMod("progsmod_xptracker")) {
// fm.getVariant().addPermaMod("progsmod_xptracker", false);
// }
// }
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public boolean execute(String ruleId, final InteractionDialogAPI dialog, List<To
String shipText = THIS_SHIP_TEXT;
ShipVariantAPI selectedVariant = (ShipVariantAPI) memoryMap.get(MemKeys.LOCAL).get(selectedVariantKey);
int nSMods = selectedVariant.getSMods().size();
SModUtils.initializeSModIncreaseLimit(fleetMember, nSMods);
//SModUtils.initializeSModIncreaseLimit(fleetMember, nSMods);

int nSModsLimit = SModUtils.getMaxSMods(fleetMember);
int nRemaining = Math.max(0, nSModsLimit - nSMods);
Expand Down
16 changes: 13 additions & 3 deletions src/progsmod/data/hullmods/XPTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,19 @@ public void addPostDescriptionSection(TooltipMakerAPI tooltip, HullSize hullSize
}

private int getNumPenalizedMods(FleetMemberAPI fm) {
return fm == null ? 0 : Math.min(
SModUtils.getNumOverLimit(fm.getId()),
Math.max(0, fm.getVariant().getSMods().size() - SModUtils.getBaseSMods(fm)));
if (fm == null) return 0;

ShipVariantAPI variant = fm.getVariant();
if (variant == null) return 0;

int sModsOverLimit = Math.max(0, variant.getSMods().size() - SModUtils.getBaseSMods(fm));

List<ShipVariantAPI> modules = SModUtils.getModuleVariantsWithOP(variant);
for (ShipVariantAPI module : modules) {
sModsOverLimit = Math.max(sModsOverLimit, Math.max(0, module.getSMods().size() - SModUtils.getBaseSMods(fm)));
}

return Math.min(SModUtils.getNumOverLimit(fm.getId()), sModsOverLimit);
}

private int computeDPModifier(MutableShipStatsAPI stats, int sModsOverLimit) {
Expand Down
20 changes: 1 addition & 19 deletions src/util/SModUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ public static List<String> getDeployedFleetMemberIds(List<DeployedFleetMemberAPI

/** For when a ship has an increased s-mod limit from another source.
* Only do this once to avoid cheesing repeated assigning / unassigning of BotB. */
@Deprecated
public static void initializeSModIncreaseLimit(FleetMemberAPI fm, int nSMods) {
int normalMax = getBaseSMods(fm);
int numOverLimit = Math.max(0, nSMods - normalMax);
Expand Down Expand Up @@ -684,25 +685,6 @@ public static List<ShipVariantAPI> getModuleVariantsWithOP(ShipVariantAPI base)
return withOP;
}

@Deprecated
public static int getSModsOverLimit(ShipVariantAPI variant, MutableShipStatsAPI stats) {
if (variant == null) return 0;
return Math.max(0, variant.getSMods().size() - SModUtils.getBaseSMods(stats));
}

/** Computes maximum number of S-mods over the limit out of the variant and all of its module variants */
@Deprecated
public static int getSModsOverLimitIncludeModules(ShipVariantAPI variant, MutableShipStatsAPI stats) {
int sModsOverLimit = getSModsOverLimit(variant, stats);

List<ShipVariantAPI> modules = SModUtils.getModuleVariantsWithOP(variant);
for (ShipVariantAPI module : modules) {
sModsOverLimit = Math.max(sModsOverLimit, getSModsOverLimit(module, stats));
}

return sModsOverLimit;
}

public static String shortenText(String text, LabelAPI label) {
if (text == null) {
return null;
Expand Down

0 comments on commit 1036eda

Please sign in to comment.