From 67603f8496ff8beebd474bd5c316af431ff484c3 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sun, 26 Jan 2025 20:21:06 -0800 Subject: [PATCH] start of normal ship upgrades todo: thrust upgrade --- vacuum_gambit.p8 | 70 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/vacuum_gambit.p8 b/vacuum_gambit.p8 index a22ac4e..7806e17 100644 --- a/vacuum_gambit.p8 +++ b/vacuum_gambit.p8 @@ -1068,6 +1068,62 @@ player = mknew(ship_m.new{ 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{ --shape sprite = 3, --index of ship sprite @@ -1705,18 +1761,8 @@ end -- ordinary upgrades function small_opts() - return {{ - icon=1, - hdr="placeholder", - body="placeholder", - action = function() end, - }, - { - icon=1, - hdr="placeholder", - body="placeholder", - action = function() end, - }} + -- todo: include gun opts + return pick(primary_ship:small_upgrade_opts(), 2) end -->8