Skip to content

Commit

Permalink
1.0 patch
Browse files Browse the repository at this point in the history
  • Loading branch information
qcwxezda committed Apr 4, 2024
1 parent de685b6 commit 71db89d
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 155 deletions.
46 changes: 46 additions & 0 deletions data/config/LunaSettings.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
fieldID,fieldName,fieldType,defaultValue,secondaryValue,fieldDescription,minValue,maxValue,tab
psm_headerIncreaseSModLimit,Increasing S-Mod Limit,Header,Increasing S-Mod Limit,,,,,General
psm_allowIncreaseSModLimit,Allow Increase,Boolean,true,,Allows increasing S-mod limit by spending story points and ship XP.,,,General
psm_baseExtraSModSPCostFrigate,Frigate Base SP Cost,Double,0.5,,SP cost for the first time the S-mod limit is increased on a frigate. Fractional amounts award bonus XP at a fraction equal to one minus the fractional part.,0,10,General
psm_baseExtraSModSPCostDestroyer,Destroyer Base SP Cost,Double,1,,SP cost for the first time the S-mod limit is increased on a destroyer. Fractional amounts award bonus XP at a fraction equal to one minus the fractional part.,0,10,General
psm_baseExtraSModSPCostCruiser,Cruiser Base SP Cost,Double,1.5,,SP cost for the first time the S-mod limit is increased on a cruiser. Fractional amounts award bonus XP at a fraction equal to one minus the fractional part.,0,10,General
psm_baseExtraSModSPCostCapital,Capital Base SP Cost,Double,2,,SP cost for the first time the S-mod limit is increased on a capital ship. Fractional amounts award bonus XP at a fraction equal to one minus the fractional part.,0,10,General
psm_extraSModSPCostGrowthType,SP Cost Growth Is Exponential,Boolean,true,,"If enabled, the SP cost increase per additional S-mod slot is exponential. Otherwise, it's linear.",,,General
psm_extraSModSPCostGrowthFactor,SP Cost Growth Factor,Double,1,,"SP Cost for additional S-mod slots is base+factor*n if linear, or base*factor^n if exponential.",0,5,General
psm_baseExtraSModXPCostFrigate,Frigate Base XP Cost,Double,800,,Base XP cost for the first time the S-mod limit is increased on a frigate. Will be modified by the ship's deployment cost.,0,2500,General
psm_baseExtraSModXPCostDestroyer,Destroyer Base XP Cost,Double,1600,,Base XP cost for the first time the S-mod limit is increased on a destroyer. Will be modified by the ship's deployment cost.,0,5000,General
psm_baseExtraSModXPCostCruiser,Cruiser Base XP Cost,Double,3200,,Base XP cost for the first time the S-mod limit is increased on a cruiser. Will be modified by the ship's deployment cost.,0,10000,General
psm_baseExtraSModXPCostCapital,Capital Base XP Cost,Double,6400,,Base XP cost for the first time the S-mod limit is increased on a capital ship. Will be modified by the ship's deployment cost.,0,20000,General
psm_extraSModXPCostGrowthType,XP Cost Growth Is Exponential,Boolean,true,,"If enabled, the XP cost increase per additional S-mod slot is exponential. Otherwise, it's linear.",,,General
psm_extraSModXPCostGrowthFactor,XP Cost Growth Factor,Double,2.25,,"XP Cost for additional S-mod slots is base*(1+factor*n) if linear, or base*factor^n if exponential.",0,5,General
,,,,,,,,
,,,,,,,,
psm_headerBuildIn,Building in S-Mods,Header,Building in S-Mods,,,,,General
psm_xpCostMultiplierFrigate,Frigate XP Cost Multiplier,Double,1,,Multiplies XP cost for building in hullmods on a frigate by the specified amount.,0,10,General
psm_xpCostMultiplierDestroyer,Destroyer XP Cost Multiplier,Double,1,,Multiplies XP cost for building in hullmods on a destroyer by the specified amount.,0,10,General
psm_xpCostMultiplierCruiser,Cruiser XP Cost Multiplier,Double,1,,Multiplies XP cost for building in hullmods on a cruiser by the specified amount.,0,10,General
psm_xpCostMultiplierCapital,Capital XP Cost Multiplier,Double,1,,Multiplies XP cost for building in hullmods on a capital ship by the specified amount.,0,10,General
psm_xpRefundFactor,XP Refund Fraction,Double,0.8,,Fraction of XP spent refunded when removing S-mods.,0,1,General
psm_reserveXPFraction,Reserve XP Fraction,Double,0.8,,"When the player loses a ship with XP, this fraction of XP lost is added to a reserve pool that can be used by any ship with the same hull type.",0,1,General
,,,,,,,,
,,,,,,,,
psm_headerMiscellaneous,Miscellaneous,Header,Miscellaneous,,,,,General
psm_IgnoreNoBuildIn,"Ignore ""no_build_in"" Tag",Boolean,false,,"If enabled, allows hullmods that can't normally be built in, such as safety overrides, to be built in.",,,General
psm_deploymentCostPenalty,Additional S-Mods DP Penalty,Double,0.06,,"Increases ship DP by this fraction of their base DP values for each S-mod over the standard limit.",0,0.25,General
psm_recentlyBuiltInListSize,Show Recent Size,Int,20,,"The maximum number of hull mods that will show up when ""Show recent"" is pressed.",5,100,General
psm_disableMod,Disable Mod (Requires Reload),Boolean,false,,"If enabled, disables this mod's features.",,,General

psm_headerCombat,Combat,Header,Combat,,,,,Combat
psm_xpGainMultiplier,XP Gain Multiplier,Double,45,,"All XP Gained by ships in combat is multiplied by this amount.",1,200,Combat
psm_xpFractionAttack,Attack XP Fraction,Double,0.34,,"Fraction of XP awarded for offensive actions.",0,1,Combat
psm_xpFractionDefense,Defense XP Fraction,Double,0.33,,"Fraction of XP awarded for defensive actions.",0,1,Combat
psm_xpFractionSupport,Support XP Fraction,Double,0.33,,"Fraction of XP awarded for support actions.",0,1,Combat
psm_targetDModLowerBound,D-Mod Minimum XP Fraction,Double,0.6,,"Enemy ships with d-mods give less XP than pristine ships. However, regardless of the number of d-mods, they will always give at least this fraction of a pristine ship's XP.",0,1,Combat
psm_postBattleXPFraction,Post-Battle Additional XP Fraction,Double,0.025,,"All ships gain this fraction of the total XP gain as additional XP per combat.",0,0.1,Combat
psm_postBattleCivilianMultiplier,Post-Battle Civilian XP Multiplier,Double,2,,"Civilian ships gain increased post-battle XP, by this much.",0,5,Combat
psm_postBattleAutoPursuitMultiplier,Auto-Resolve XP Multiplier,Double,4,,"Combat ships gain increased post-battle XP for auto-resolve pursuits, by this much.",0,10,Combat
psm_combatUpdateInterval,Combat Update Interval,Double,3,,"Adjusts how often ship contribution is tallied up during combat, in seconds.",1,10,Combat
psm_giveXPToDisabledShips,Give XP To Disabled Ships,Boolean,false,,"If enabled, receive XP for ships even if they were disabled in combat.",,,Combat
psm_onlyGiveXPForKills,Only Give XP For Kills,Boolean,false,,"If enabled, only enemy ships that are destroyed give XP.",,,Combat
psm_condenseXPGainMessages,Condense XP Gain Messages,Boolean,false,,"If enabled, condenses XP gain messages post-battle and no longer displays individual ship contributions.",,,Combat

Binary file modified graphics/hullmods/progsmod_xp_tracker.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified jars/Progressive S-Mods.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion latest_changelog.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
- Hotfix for a crash related to missing ship data when installing 0-cost hull mods
- Updated the XP tracker hullmod icon using an asset provided by Serenitis in 2022
- Added LunaLib support (note: not every setting is in LunaLib, those that aren't still read from the json)
- Added setting to condense XP gain text
- Changed Global.getCombatEngine() to CombatEngine.getInstance(), which creates the combat engine if it doesn't exist.
Should fix those rare strange cases where Global.getCombatEngine() is mysteriously null.
2 changes: 1 addition & 1 deletion mod_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "progressiveSMods",
"name": "Progressive S-Mods",
"author": "qcwxezda, chdcl",
"version": {"major":0, "minor":11, "patch":3},
"version": {"major":1, "minor":0, "patch":0},
"dependencies": [],
"description": "Ships gain XP during combat that can be spent to build in hull mods. Disables building in hull mods using story points.",
"gameVersion":"0.97a-RC11",
Expand Down
6 changes: 3 additions & 3 deletions progsmod.version
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"modThreadId":23006,
"modVersion":
{
"major":0,
"minor":11,
"patch":3,
"major":1,
"minor":0,
"patch":0,
},
"directDownloadURL": "https://github.com/qcwxezda/Starsector-Progressive-S-Mods/releases/latest/download/Progressive.S-Mods.zip",
"changelogURL":"https://raw.githubusercontent.com/qcwxezda/Starsector-Progressive-S-Mods/main/latest_changelog.txt"
Expand Down
2 changes: 2 additions & 0 deletions progsmod_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
"xpFractionAttack": 0.34,
"xpFractionDefense": 0.33,
"xpFractionSupport": 0.33,

"condenseXPGainMessages":false
},

# Set this to true in order to disable this mod's features
Expand Down
66 changes: 10 additions & 56 deletions src/progsmod/data/campaign/EngagementListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public class EngagementListener extends BaseCampaignEventListener {
private Map<String, FleetMemberAPI> idToFleetMemberMap;
/** Maps fleet member ids to their total XP gain, by contribution type */
private Map<String, Map<ContributionType, Float>> xpGainMap;
/** Contribution map as populated in the combat plugin */
private Map<ContributionType, Map<String, Map<String, Float>>> totalContributionMap;
/** Set of player ships that are eligible to gain XP */
private Set<String> playerFilter;
/** Set of enemy ships that are eligible to give XP */
Expand Down Expand Up @@ -77,7 +75,7 @@ public void reportBattleFinished(CampaignFleetAPI primaryWinner, BattleAPI battl
}
// If the ship has modules, add XP for any S-mods built into modules
List<String> moduleSlotIds = fm.getVariant().getModuleSlots();
if (moduleSlotIds.size() > 0) {
if (!moduleSlotIds.isEmpty()) {
for (String id : moduleSlotIds) {
ShipVariantAPI moduleVariant = fm.getVariant().getModuleVariant(id);
for (String modId : moduleVariant.getSMods()) {
Expand Down Expand Up @@ -122,7 +120,8 @@ public void reportBattleFinished(CampaignFleetAPI primaryWinner, BattleAPI battl
public void reportPlayerEngagement(EngagementResultAPI result) {
// Populate the required utility mappings
shipToFleetMemberMap = ContributionTracker.getShipToFleetMemberMap();
totalContributionMap = ContributionTracker.getContributionTable();
Map<ContributionType, Map<String, Map<String, Float>>> totalContributionMap =
ContributionTracker.getContributionTable();
idToFleetMemberMap = new HashMap<>();
xpGainMap = new HashMap<>();
playerFilter = new HashSet<>();
Expand All @@ -142,8 +141,8 @@ public void reportPlayerEngagement(EngagementResultAPI result) {
// List of ships that are eligible to gain XP
playerFilter.addAll(SModUtils.getFleetMemberIds(playerFleet));
if (!SModUtils.Constants.GIVE_XP_TO_DISABLED_SHIPS) {
playerFilter.removeAll(SModUtils.getFleetMemberIds(playerResult.getDestroyed()));
playerFilter.removeAll(SModUtils.getFleetMemberIds(playerResult.getDisabled()));
playerFilter.removeAll(new HashSet<>(SModUtils.getFleetMemberIds(playerResult.getDestroyed())));
playerFilter.removeAll(new HashSet<>(SModUtils.getFleetMemberIds(playerResult.getDisabled())));
}
// List of ships that can give XP when damaged
enemyFilter.addAll(SModUtils.getFleetMemberIds(enemyResult.getDestroyed()));
Expand Down Expand Up @@ -181,7 +180,7 @@ public void reportPlayerEngagement(EngagementResultAPI result) {
totalXPGain += xpGain;
}
// Show the XP gain in the dialog
if (idToFleetMemberMap.containsKey(id)) {
if (idToFleetMemberMap.containsKey(id) && !SModUtils.Constants.CONDENSE_XP_GAIN_MESSAGES) {
SModUtils.addTypedXPGainToDialog(
lastDialog,
idToFleetMemberMap.get(id),
Expand All @@ -190,6 +189,9 @@ public void reportPlayerEngagement(EngagementResultAPI result) {
}
}

if (SModUtils.Constants.CONDENSE_XP_GAIN_MESSAGES) {
SModUtils.addCondensedXPGainToDialog(lastDialog, totalXPGain, xpGainMap.size());
}

givePostBattleXP(playerFleet, totalXPGain, false);
}
Expand Down Expand Up @@ -237,7 +239,7 @@ else if (isAutoResolve) {
lastDialog,
civilianShips,
(int) (totalXPGain * SModUtils.Constants.POST_BATTLE_XP_FRACTION * (isAutoResolve ? SModUtils.Constants.POST_BATTLE_AUTO_PURSUIT_MULTIPLIER : 1.0f)),
(int) (totalXPGain * SModUtils.Constants.POST_BATTLE_XP_FRACTION * SModUtils.Constants.POST_BATTLE_CIVILIAN_MULTIPLIER));
(int) (totalXPGain * SModUtils.Constants.POST_BATTLE_XP_FRACTION * SModUtils.Constants.POST_BATTLE_CIVILIAN_MULTIPLIER), isAutoResolve);
}
}

Expand Down Expand Up @@ -305,52 +307,4 @@ private float getXPFractionForType(ContributionType type) {
default: return 0f;
}
}

// private void checkContribTable(Map<ContributionType, Map<String, Map<String, Float>>> totalContribution) {
// Logger logger = Global.getLogger(getClass());
// for (Map.Entry<ContributionType, Map<String, Map<String, Float>>> entry : totalContribution.entrySet()) {
// for (Map.Entry<String, Map<String, Float>> entry2 : entry.getValue().entrySet()) {
// String enemy = entry2.getKey();
// if (!ProgSModCombatPlugin.baseShipTable.containsKey(enemy)) {
// logger.info("Unknown enemy (contrib)");
// }
// else if (ProgSModCombatPlugin.baseShipTable.get(enemy).getOwner() == 0) {
// logger.info("Player where enemy should be (contrib)");
// }
// for (Map.Entry<String, Float> entry3 : entry2.getValue().entrySet()) {
// String player = entry3.getKey();
// if (!ProgSModCombatPlugin.baseShipTable.containsKey(player)) {
// logger.info("Unknown player (contrib)");
// }
// else if (ProgSModCombatPlugin.baseShipTable.get(player).getOwner() == 1) {
// logger.info("Enemy where player should be (contrib)");
// }
// }
// }
// }
// }

// private void checkContribTable2(Map<ContributionType, Map<String, Map<String, Float>>> totalContribution) {
// Logger logger = Global.getLogger(getClass());
// for (Map.Entry<ContributionType, Map<String, Map<String, Float>>> entry : totalContribution.entrySet()) {
// for (Map.Entry<String, Map<String, Float>> entry2 : entry.getValue().entrySet()) {
// String enemy = entry2.getKey();
// if (!shipToFleetMemberMap.containsKey(enemy) || !idToFleetMemberMap.containsKey(shipToFleetMemberMap.get(enemy))) {
// logger.info("Unknown enemy (contrib2)");
// }
// else if (idToFleetMemberMap.get(shipToFleetMemberMap.get(enemy)).getOwner() == 0) {
// logger.info("Player where enemy should be (contrib2)");
// }
// for (Map.Entry<String, Float> entry3 : entry2.getValue().entrySet()) {
// String player = entry3.getKey();
// if (!shipToFleetMemberMap.containsKey(player) || !idToFleetMemberMap.containsKey(shipToFleetMemberMap.get(player))) {
// logger.info("Unknown player (contrib2)");
// }
// else if (idToFleetMemberMap.get(shipToFleetMemberMap.get(player)).getOwner() == 1) {
// logger.info("Enemy where player should be (contrib2)");
// }
// }
// }
// }
// }
}
4 changes: 2 additions & 2 deletions src/progsmod/data/campaign/rulecmd/util/TempShipMaker.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package progsmod.data.campaign.rulecmd.util;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipVariantAPI;
import com.fs.starfarer.api.fleet.FleetMemberAPI;
import com.fs.starfarer.api.fleet.FleetMemberType;
import com.fs.starfarer.api.mission.FleetSide;
import com.fs.starfarer.campaign.fleet.FleetMember;
import com.fs.starfarer.combat.CombatEngine;
import com.fs.starfarer.combat.CombatFleetManager;
import com.fs.starfarer.loading.specs.HullVariantSpec;

Expand All @@ -17,7 +17,7 @@ public static ShipAPI makeShip(ShipVariantAPI variant, FleetMemberAPI fleetMembe
// Create a temporary fleet member
FleetMember tempFleetMember = new FleetMember(0, (HullVariantSpec) variant, FleetMemberType.SHIP);
tempFleetMember.setId(fleetMember.getId());
ShipAPI ship = tempFleetMember.instantiateForCombat(null, 0, (CombatFleetManager) Global.getCombatEngine().getFleetManager(FleetSide.PLAYER));
ShipAPI ship = tempFleetMember.instantiateForCombat(null, 0, (CombatFleetManager) CombatEngine.getInstance().getFleetManager(FleetSide.PLAYER));
ship.setName(fleetMember.getShipName());
return ship;
}
Expand Down

0 comments on commit 71db89d

Please sign in to comment.