Compare commits
12 Commits
288b7f64c8
...
gun_upgrad
Author | SHA1 | Date | |
---|---|---|---|
b7c3e6ee92
|
|||
c91e5f4bd1
|
|||
ea2ddadb15
|
|||
9333c03bf3
|
|||
1b45bd3dc3
|
|||
71a7351d77
|
|||
80bb848468
|
|||
b227844d12
|
|||
ce14d03669
|
|||
ccd2c64103
|
|||
e5b8a30cb6
|
|||
7ed305d2d9
|
165
vacuum_gambit.p8
165
vacuum_gambit.p8
@ -676,7 +676,13 @@ bullet_base = mknew{ }
|
||||
|
||||
gun_base = mknew{
|
||||
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
|
||||
@ -707,6 +713,68 @@ function gun_base:actually_shoot(x, y)
|
||||
self.munition.new{}:spawn_at(x, y)
|
||||
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 each
|
||||
shot when
|
||||
firing.
|
||||
|
||||
is: ]]..tostr(c)..[[f
|
||||
minus: ]]..tostr(c-newc)..[[f
|
||||
----------
|
||||
total: ]]..tostr(newc)..[[f
|
||||
|
||||
remainder:
|
||||
]]..sub(tostr(newc-rawnewc),0,5),
|
||||
action=function()
|
||||
self.cooldown=newc>>16
|
||||
self.cd_remainder=newc-rawnewc
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function bullet_base:hitship(_)
|
||||
self:die()
|
||||
return true
|
||||
@ -848,10 +916,12 @@ blast_gun = mknew(gun_base.new{
|
||||
maxammo = 5,
|
||||
munition = blast,
|
||||
hdr = "bLASTER",
|
||||
body= [[plasma orb
|
||||
body= [[---------GUN
|
||||
|
||||
plasma orb
|
||||
cuts through
|
||||
enemies.
|
||||
slow.
|
||||
enemies.
|
||||
slow.
|
||||
|
||||
ammo: 5
|
||||
rate: 1/2sec
|
||||
@ -920,9 +990,11 @@ protron_gun_p = mknew(protron_gun_e.new{
|
||||
maxammo = 20,
|
||||
cooldown = 0x0.0018,
|
||||
hdr = "pROTRON",
|
||||
body = [[spray shots
|
||||
in a dense
|
||||
arc.
|
||||
body = [[---------GUN
|
||||
|
||||
spray shots
|
||||
in a dense
|
||||
arc.
|
||||
|
||||
ammo: 20
|
||||
rate: 2/sec
|
||||
@ -981,9 +1053,10 @@ vulcan_gun_p = mknew(vulcan_gun_e.new{
|
||||
munition=vulcan_p,
|
||||
maxammo = 100,
|
||||
hdr = "vULCAN",
|
||||
body = [[rapid fire
|
||||
in a v
|
||||
shape.
|
||||
body = [[---------GUN
|
||||
|
||||
rapidly fire
|
||||
in a v.
|
||||
|
||||
ammo: 100
|
||||
rate: 20/sec
|
||||
@ -1074,7 +1147,11 @@ function player:small_upgrade_opts()
|
||||
local ret = {{
|
||||
icon=53,
|
||||
hdr="hull",
|
||||
body=[[ armor
|
||||
body=[[--------SHIP
|
||||
|
||||
survive more
|
||||
unshielded
|
||||
hits.
|
||||
|
||||
+2 hp]],
|
||||
action=function()
|
||||
@ -1083,8 +1160,13 @@ function player:small_upgrade_opts()
|
||||
end,
|
||||
},{
|
||||
icon=52,
|
||||
hdr="shield",
|
||||
body=[[ capacity
|
||||
hdr="capacity",
|
||||
body=[[------SHIELD
|
||||
|
||||
shield can
|
||||
absorb more
|
||||
hits before
|
||||
recharging.
|
||||
|
||||
+1 hp]],
|
||||
action=function()
|
||||
@ -1094,10 +1176,11 @@ function player:small_upgrade_opts()
|
||||
},{
|
||||
icon=1,
|
||||
hdr="thrusters",
|
||||
body=[[performance
|
||||
|
||||
body=[[--------SHIP
|
||||
|
||||
move faster,
|
||||
steer faster]],
|
||||
steer more
|
||||
sharply.]],
|
||||
action=function()
|
||||
--maxspd thrust drag
|
||||
self.maxspd += 0.5
|
||||
@ -1106,22 +1189,29 @@ steer faster]],
|
||||
end,
|
||||
},{
|
||||
icon=20,
|
||||
hdr="hull",
|
||||
body=[[ magnet
|
||||
|
||||
hdr="magnet",
|
||||
body=[[--------SHIP
|
||||
|
||||
pick up xp
|
||||
from further
|
||||
away]],
|
||||
away.]],
|
||||
action=function ()
|
||||
self.magnet += 2
|
||||
end,
|
||||
}}
|
||||
},
|
||||
self.main_gun:rate_upgrade_opt(),
|
||||
}
|
||||
|
||||
if cdr > 0 then
|
||||
add(ret, {
|
||||
icon = 6,
|
||||
hdr = "shield",
|
||||
body=[[charge rate
|
||||
hdr = "recharge",
|
||||
body=[[------SHIELD
|
||||
|
||||
shield will
|
||||
recharge at
|
||||
a faster
|
||||
pace.
|
||||
|
||||
]] .. tostr(ceil(100 * cdr / self.shieldcooldown)) .. "% faster",
|
||||
action = function()
|
||||
@ -1133,8 +1223,15 @@ from further
|
||||
if pr > 0 then
|
||||
add(ret, {
|
||||
icon = 6,
|
||||
hdr = "shield",
|
||||
body=[[disruption
|
||||
hdr = "recovery",
|
||||
body=[[------SHIELD
|
||||
|
||||
reduce the
|
||||
delay after
|
||||
a hit before
|
||||
shield will
|
||||
start to
|
||||
recharge.
|
||||
|
||||
]] .. tostr(ceil(100 * pr / self.shieldpenalty)) .. "% shorter",
|
||||
action = function()
|
||||
@ -1795,7 +1892,12 @@ end
|
||||
-- ordinary upgrades
|
||||
function small_opts()
|
||||
-- todo: include gun opts
|
||||
return pick(primary_ship:small_upgrade_opts(), 2)
|
||||
if(not primary_ship.special_guns) return pick(primary_ship:small_upgrade_opts(), 2)
|
||||
local opts = {rnd(primary_ship:small_upgrade_opts())}
|
||||
for g in all(primary_ship.special_guns) do
|
||||
add(opts, rnd(g:small_upgrade_opts()))
|
||||
end
|
||||
return pick(opts, 2)
|
||||
end
|
||||
|
||||
-->8
|
||||
@ -1804,7 +1906,7 @@ end
|
||||
rearm_mode = mknew{
|
||||
sel=1,
|
||||
bfm=1,
|
||||
crt_frm = 1,
|
||||
crt_frm = 0,
|
||||
pos=-1,
|
||||
init=function(this)
|
||||
poke(0x5f5c, 255) --no btnp repeat
|
||||
@ -1819,7 +1921,7 @@ function rearm_mode:glow_box(x0, y0, x1, y1, c, cf)
|
||||
i -= 1
|
||||
rect(x0+i,y0+i,x1-i,y1-i,v)
|
||||
end
|
||||
fillp(crt[self.crt_frm&0xff])
|
||||
fillp(crt[1+(self.crt_frm&7)])
|
||||
rectfill(x0+4, y0+4, x1-4, y1-4, cf)
|
||||
fillp()
|
||||
end
|
||||
@ -1851,7 +1953,7 @@ end
|
||||
|
||||
function rearm_mode:draw_option(id)
|
||||
local rec = self.options[id]
|
||||
self:glow_box(0,0,55,100,self:frame_col(self.sel == id),1)
|
||||
self:glow_box(0,0,55,101,self:frame_col(self.sel == id),1)
|
||||
spr(rec.icon,5, 5)
|
||||
print(rec.hdr, 13, 8, 7)
|
||||
print(rec.body, 5, 15, 6)
|
||||
@ -1887,9 +1989,9 @@ function rearm_mode:draw()
|
||||
camera(frac * -128 + (1-frac) * -56, 0)
|
||||
self:draw_option(2)
|
||||
camera(0, -28 * frac)
|
||||
self:glow_box(0,101,111,127,self:frame_col(self.sel < 0),1)
|
||||
self:glow_box(0,102,111,127,self:frame_col(self.sel < 0),1)
|
||||
spr(96,15,107,4,2)
|
||||
print("full ammo\nfull shield\n+50% health",54, 106, 6)
|
||||
print("full ammo\nfull shield\n+50% health",54, 107, 6)
|
||||
end
|
||||
|
||||
function rearm_mode:update_pos()
|
||||
@ -1909,6 +2011,7 @@ function rearm_mode:update_pos()
|
||||
end
|
||||
|
||||
function rearm_mode:update()
|
||||
self.crt_frm+=0.25
|
||||
self:update_pos()
|
||||
if self.pos > 1 then
|
||||
mode = game_mode
|
||||
|
Reference in New Issue
Block a user