start of normal ship upgrades

todo: thrust upgrade
This commit is contained in:
Kistaro Windrider 2025-01-26 20:21:06 -08:00
parent 2cebea663f
commit 67603f8496
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -1068,6 +1068,62 @@ player = mknew(ship_m.new{
end, end,
}) })
function player:small_upgrade_opts()
local cdr, pr = (self.shieldcooldown - 0x0.000f) / 8, (self.shieldpenalty - 0x0.003c) / 9
if (cdr == 0 and self.shieldcooldown > 0x0.000f) cdr = 0x0.0001
if (pr == 0 and self.shieldpenalty > 0x0.003c) pr = 0x0.0001
local ret = {{
icon=1,
hdr="hull",
body=[[ armor
+2 hp]],
action=function()
self.maxhp += 2
self.hp += 2
end,
},{
icon=1, -- todo: icon
hdr="shield",
body=[[ capacity
+1 hp]],
action=function()
self.maxshield += 1
self.shield += 1
end,
}}
if cdr > 0 then
add(ret, {
icon = 1, --todo: icon
hdr = "shield",
body=[[charge rate
]] .. tostr(ceil(100 * cdr / self.shieldcooldown)) .. "% faster",
action = function()
self.shieldcooldown -= cdr
end
})
end
if pr > 0 then
add(ret, {
icon = 1, --todo: icon
hdr = "shield",
body=[[disruption
]] .. tostr(ceil(100 * pr / self.shieldpenalty)) .. "% shorter",
action = function()
self.shieldpenalty -= pr
end
})
end
return ret
end
frownie = mknew(ship_m.new{ frownie = mknew(ship_m.new{
--shape --shape
sprite = 3, --index of ship sprite sprite = 3, --index of ship sprite
@ -1705,18 +1761,8 @@ end
-- ordinary upgrades -- ordinary upgrades
function small_opts() function small_opts()
return {{ -- todo: include gun opts
icon=1, return pick(primary_ship:small_upgrade_opts(), 2)
hdr="placeholder",
body="placeholder",
action = function() end,
},
{
icon=1,
hdr="placeholder",
body="placeholder",
action = function() end,
}}
end end
-->8 -->8