diff --git a/vacuum_gambit.p8 b/vacuum_gambit.p8 index 7b02fc5..c0eef2e 100644 --- a/vacuum_gambit.p8 +++ b/vacuum_gambit.p8 @@ -678,6 +678,11 @@ gun_base = mknew{ shoot_ready = -32768, icon = 20, ammobonus = 1, + + -- fractional frames of + -- cooldown reduction from + -- upgrades, not yet applied + cd_remainder = 0, } -- gun_base subtypes are @@ -727,7 +732,9 @@ function gun_base:ammo_upgrade_opt() hdr=self.hdr, body=[[----------AMMO - more shots. + more shots + before you + run out. is: ]]..tostr(a)..[[ add: ]]..tostr(x)..[[ @@ -740,6 +747,34 @@ total: ]]..tostr(a+x), } end +function gun_base:rate_upgrade_opt() + local c=self.cooldown<<16 + local rawnewc=0.85*(c-self.cd_remainder) + local newc=ceil(rawnewc) + return { + icon=self.icon, + hdr=self.hdr, + body=[[----------RATE + +reduce delay +between shots + in frames. + + fractions +add up across + upgrades. + + is: ]]..tostr(c)..[[ +minus: ]]..tostr(c-newc)..[[ +---------- +total: ]]..tostr(newc), + action=function() + self.cooldown=newc>>16 + self.cd_remainder=newc-rawnewc + end, + } +end + function bullet_base:hitship(_) self:die() return true