Compare commits
2 Commits
288b7f64c8
...
e5b8a30cb6
Author | SHA1 | Date | |
---|---|---|---|
e5b8a30cb6
|
|||
7ed305d2d9
|
@ -676,7 +676,13 @@ bullet_base = mknew{ }
|
|||||||
|
|
||||||
gun_base = mknew{
|
gun_base = mknew{
|
||||||
shoot_ready = -32768,
|
shoot_ready = -32768,
|
||||||
icon = 20
|
icon = 20,
|
||||||
|
ammobonus = 1,
|
||||||
|
|
||||||
|
-- fractional frames of
|
||||||
|
-- cooldown reduction from
|
||||||
|
-- upgrades, not yet applied
|
||||||
|
cd_remainder = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- gun_base subtypes are
|
-- gun_base subtypes are
|
||||||
@ -707,6 +713,68 @@ function gun_base:actually_shoot(x, y)
|
|||||||
self.munition.new{}:spawn_at(x, y)
|
self.munition.new{}:spawn_at(x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- upgrade
|
||||||
|
function gun_base:small_upgrade_opts()
|
||||||
|
local ret = {
|
||||||
|
self:ammo_upgrade_opt(),
|
||||||
|
self:rate_upgrade_opt(),
|
||||||
|
}
|
||||||
|
local s = self.special_upgrade_opt
|
||||||
|
if (s) add(ret, s(self))
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
function gun_base:ammo_upgrade_opt()
|
||||||
|
local a=self.maxammo
|
||||||
|
local x=a\10+self.ammobonus
|
||||||
|
return {
|
||||||
|
icon=self.icon,
|
||||||
|
hdr=self.hdr,
|
||||||
|
body=[[----------AMMO
|
||||||
|
|
||||||
|
more shots
|
||||||
|
before you
|
||||||
|
run out.
|
||||||
|
|
||||||
|
is: ]]..tostr(a)..[[
|
||||||
|
add: ]]..tostr(x)..[[
|
||||||
|
----------
|
||||||
|
total: ]]..tostr(a+x),
|
||||||
|
action=function()
|
||||||
|
self.maxammo+=x
|
||||||
|
self.ammo+=x
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
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(_)
|
function bullet_base:hitship(_)
|
||||||
self:die()
|
self:die()
|
||||||
return true
|
return true
|
||||||
|
Reference in New Issue
Block a user