From 33c182e6236034c625dd21a149088bf34a8d6609 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Sat, 23 Aug 2025 19:20:58 +0200 Subject: [PATCH] Add Craftsmanship miracle; update production calculations and unlock logic --- Mods/Miracles/craftmenship.json | 18 ++++++++++++++++++ Mods/Miracles/global_network.json | 2 +- Mods/Miracles/unlock_settlement.json | 1 + Scripts/Core/GameLogic.cs | 15 ++++++++++++--- Scripts/Core/GameState.cs | 1 + Scripts/Core/Stat.cs | 3 ++- 6 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 Mods/Miracles/craftmenship.json diff --git a/Mods/Miracles/craftmenship.json b/Mods/Miracles/craftmenship.json new file mode 100644 index 0000000..c5e5141 --- /dev/null +++ b/Mods/Miracles/craftmenship.json @@ -0,0 +1,18 @@ +{ + "name": "Craftsmanship", + "faithCost": 600, + "followersRequired": 300, + "productionRequired": 25, + "unlockedByDefault": false, + "effects": [ + { + "type": "ModifyStat", + "targetStat": "ProductionPerFollower", + "op": "Add", + "value": 0.05 + }, + { + "type": "DestroySelf" + } + ] +} diff --git a/Mods/Miracles/global_network.json b/Mods/Miracles/global_network.json index 22ac425..3f29cba 100644 --- a/Mods/Miracles/global_network.json +++ b/Mods/Miracles/global_network.json @@ -6,7 +6,7 @@ "effects": [ { "type": "UnlockMiracle", - "miraclesToUnlock": [ "orbital_calculations", "construct_vessel_frame", "launch_ark" ] + "miraclesToUnlock": ["orbital_calculations", "construct_vessel_frame"] }, { "type": "DestroySelf" } ] diff --git a/Mods/Miracles/unlock_settlement.json b/Mods/Miracles/unlock_settlement.json index 8dce181..8a26ba8 100644 --- a/Mods/Miracles/unlock_settlement.json +++ b/Mods/Miracles/unlock_settlement.json @@ -14,6 +14,7 @@ "gods_endurance", "geological_survey", "divine_mandate", + "craftsmanship", "unlock_age_of_industry" ] }, diff --git a/Scripts/Core/GameLogic.cs b/Scripts/Core/GameLogic.cs index f6432dd..9a60456 100644 --- a/Scripts/Core/GameLogic.cs +++ b/Scripts/Core/GameLogic.cs @@ -17,9 +17,14 @@ public class GameLogic var faithMultiplier = state.ActiveBuffs .Where(b => b.TargetStat == Stat.FaithPerFollower) .Aggregate(1.0f, (acc, buff) => acc * buff.Multiplier); - var productionMultiplier = state.ActiveBuffs + + var productionFollowerMultiplier = state.ActiveBuffs + .Where(b => b.TargetStat == Stat.ProductionPerFollower) + .Aggregate(1.0f, (acc, buff) => acc * buff.Multiplier); + var productionFlatMultiplier = state.ActiveBuffs .Where(b => b.TargetStat == Stat.ProductionPerSecond) .Aggregate(1.0f, (acc, buff) => acc * buff.Multiplier); + var followerMultiplier = state.ActiveBuffs .Where(b => b.TargetStat == Stat.FollowersPerSecond) .Aggregate(1.0f, (acc, buff) => acc * buff.Multiplier); @@ -28,12 +33,16 @@ public class GameLogic .Aggregate(1.0f, (acc, buff) => acc * buff.Multiplier); var faithPerSecond = state.Get(Stat.Followers) * state.Get(Stat.FaithPerFollower) * faithMultiplier; - var productionPerSecond = state.Get(Stat.ProductionPerSecond) * productionMultiplier; + + var productionFromFollowers = state.Get(Stat.Followers) * state.Get(Stat.ProductionPerFollower) * productionFollowerMultiplier; + var productionFromIndustry = state.Get(Stat.ProductionPerSecond) * productionFlatMultiplier; + var totalProductionPerSecond = productionFromFollowers + productionFromIndustry; + var followersPerSecond = state.Get(Stat.FollowersPerSecond) * followerMultiplier; var corruptionPerSecond = state.Get(Stat.CorruptionPerSecond) * corruptionMultiplier; state.Modify(Stat.Faith, faithPerSecond * delta); - state.Modify(Stat.Production, productionPerSecond * delta); + state.Modify(Stat.Production, totalProductionPerSecond * delta); state.Modify(Stat.Corruption, corruptionPerSecond * delta); state.Modify(Stat.Followers, followersPerSecond * delta); diff --git a/Scripts/Core/GameState.cs b/Scripts/Core/GameState.cs index aaaa095..ecadf9c 100644 --- a/Scripts/Core/GameState.cs +++ b/Scripts/Core/GameState.cs @@ -25,6 +25,7 @@ public class GameState Set(Stat.ProductionPerSecond, 0.0); Set(Stat.CorruptionPerSecond, 0.01); Set(Stat.FollowersPerSecond, 0); + Set(Stat.ProductionPerFollower, 0); } public double Get(Stat stat) => _stats[stat].Value; diff --git a/Scripts/Core/Stat.cs b/Scripts/Core/Stat.cs index 0452861..a06261d 100644 --- a/Scripts/Core/Stat.cs +++ b/Scripts/Core/Stat.cs @@ -14,5 +14,6 @@ public enum Stat FollowersPerSecond, // Modifying Stats - FaithPerFollower + FaithPerFollower, + ProductionPerFollower, } \ No newline at end of file