-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.lua
More file actions
117 lines (100 loc) · 4.39 KB
/
Copy pathcore.lua
File metadata and controls
117 lines (100 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
-- Steady Growth Perfect - Extends Demeter's Steady Growth to upgrade boons to Perfect rarity
-- Author: shadowofdoom
-- Version: 1.1.0
-- Loaded by main.lua
-- Config is provided by main.lua via chalk
-- Access via: config.enabled, config.debug, config.enable_perfect_upgrades
-- Check if required Perfect mods are available
local function ArePerfectModsAvailable()
if not rom or not rom.mods then return false end
return rom.mods["Jowday-BoonBuddy"] ~= nil
and rom.mods["Jowday-Perfectoinist"] ~= nil
end
-- Mod initialization
if config.debug then
print("[SteadyGrowthPerfect] Core logic loaded")
end
-- Check if user wants Perfect upgrades enabled
if not config.enable_perfect_upgrades then
if config.debug then
print("[SteadyGrowthPerfect] Perfect upgrades disabled in config")
end
return
end
-- PHASE 2: Add Perfect to RarityUpgradeOrder
if ArePerfectModsAvailable() then
if game.TraitRarityData and game.TraitRarityData.RarityUpgradeOrder then
-- Check if Perfect is not already in the order
local hasPerfect = false
for _, rarity in ipairs(game.TraitRarityData.RarityUpgradeOrder) do
if rarity == "Perfect" then
hasPerfect = true
break
end
end
if not hasPerfect then
table.insert(game.TraitRarityData.RarityUpgradeOrder, "Perfect")
if config.debug then
print("[SteadyGrowthPerfect] Added Perfect to RarityUpgradeOrder")
print("[SteadyGrowthPerfect] New order: " .. table.concat(game.TraitRarityData.RarityUpgradeOrder, ", "))
end
end
end
else
if config.debug then
print("[SteadyGrowthPerfect] Required mods (BoonBuddy, Perfectoinist) not found")
end
end
-- PHASE 3: Add Perfect rarity level to BoonGrowthBoon
if ArePerfectModsAvailable() then
if game.TraitData and game.TraitData.BoonGrowthBoon then
-- Check if Perfect rarity level doesn't already exist
if not game.TraitData.BoonGrowthBoon.RarityLevels.Perfect then
game.TraitData.BoonGrowthBoon.RarityLevels.Perfect = {
Multiplier = 1/6 -- Perfect: every 1 room (6 × 1/6 = 1)
}
if config.debug then
print("[SteadyGrowthPerfect] Added Perfect rarity level to BoonGrowthBoon")
print("[SteadyGrowthPerfect] Perfect multiplier: 1/6 (triggers every 1 room)")
end
end
end
end
-- PHASE 4: Wrap AddRarityToTraits to exclude Legendary, Duo, and Infusion boons
if ArePerfectModsAvailable() then
modutil.mod.Path.Wrap("AddRarityToTraits", function(base, source, args)
-- Temporarily mark Legendary, Duo, and Infusion boons to block them from being upgraded
local blockedTraits = {}
if game.CurrentRun and game.CurrentRun.Hero and game.CurrentRun.Hero.Traits then
for i, traitData in ipairs(game.CurrentRun.Hero.Traits) do
local rarity = traitData.Rarity
-- Check if this is a Legendary, Duo, or Infusion boon
if rarity == "Legendary" or rarity == "Duo" or rarity == "Infusion" then
-- Temporarily mark it to block from rarify
if not traitData.BlockInRunRarify then
traitData.BlockInRunRarify = true
table.insert(blockedTraits, traitData)
if config.debug then
print("[SteadyGrowthPerfect] Temporarily blocking " .. rarity .. " boon from upgrade: " .. traitData.Name)
end
end
end
end
end
-- Call base function with blocked traits
base(source, args)
-- Restore the BlockInRunRarify flag for traits we temporarily blocked
for i, traitData in ipairs(blockedTraits) do
traitData.BlockInRunRarify = nil
if config.debug then
print("[SteadyGrowthPerfect] Restored upgrade eligibility for: " .. traitData.Name)
end
end
end)
if config.debug then
print("[SteadyGrowthPerfect] Wrapped AddRarityToTraits to exclude Legendary, Duo, and Infusion boons")
end
end
if config.debug then
print("[SteadyGrowthPerfect] Initialization complete")
end