Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Table of map-specific Citadel Upgrade cost multipliers
- --Format: MapName = { UpgradeName1 = Multiplier, UpgradeName2 = Multiplier }
- MapCostMults = {
- MAP09 = { --Leviathan
- CUpgradeStructure01 = 2.0, --2x cost mult for Trebuchets
- },
- }
- --Get map path
- local mapPath, luaState = false, false
- if IsUser() then
- luaState = 'User'
- mapPath = SessionGetScenarioInfo().map
- elseif IsSim() then
- luaState = 'Sim'
- mapPath = ScenarioInfo.map
- end
- --Extract map name and apply cost modifications
- if mapPath and type(mapPath) == 'string' then
- LOG("CitadelUpgrades: Applying map-dynamic upgrade costs for state: "..luaState)
- local mapName = string.match(mapPath, '(MAP%d+)%.scmap$')
- if not mapName then
- WARN("\tCould not get map name from path '"..mapPath.."', aborting")
- elseif MapCostMults[mapName] then
- LOG("Map name: "..mapName)
- for name, mult in MapCostMults[mapName] do
- local upgrade = Upgrades.Tree[name]
- if upgrade then
- local newCost = upgrade.Cost * mult
- LOG("\t"..name..", "..mult..":\t"..upgrade.Cost.." ->\t"..newCost)
- upgrade.Cost = newCost
- else
- WARN("\tCould not find upgrade '"..name.."', skipping")
- end
- end
- else
- LOG("\tNo cost mult data for map name '"..mapName.."'")
- end
- elseif not IsRuleInit() then
- WARN("CitadelUpgrades: Could not get scenario data for state: "..luaState)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement