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{
|
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 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(_)
|
function bullet_base:hitship(_)
|
||||||
self:die()
|
self:die()
|
||||||
return true
|
return true
|
||||||
@ -848,10 +916,12 @@ blast_gun = mknew(gun_base.new{
|
|||||||
maxammo = 5,
|
maxammo = 5,
|
||||||
munition = blast,
|
munition = blast,
|
||||||
hdr = "bLASTER",
|
hdr = "bLASTER",
|
||||||
body= [[plasma orb
|
body= [[---------GUN
|
||||||
|
|
||||||
|
plasma orb
|
||||||
cuts through
|
cuts through
|
||||||
enemies.
|
enemies.
|
||||||
slow.
|
slow.
|
||||||
|
|
||||||
ammo: 5
|
ammo: 5
|
||||||
rate: 1/2sec
|
rate: 1/2sec
|
||||||
@ -920,9 +990,11 @@ protron_gun_p = mknew(protron_gun_e.new{
|
|||||||
maxammo = 20,
|
maxammo = 20,
|
||||||
cooldown = 0x0.0018,
|
cooldown = 0x0.0018,
|
||||||
hdr = "pROTRON",
|
hdr = "pROTRON",
|
||||||
body = [[spray shots
|
body = [[---------GUN
|
||||||
in a dense
|
|
||||||
arc.
|
spray shots
|
||||||
|
in a dense
|
||||||
|
arc.
|
||||||
|
|
||||||
ammo: 20
|
ammo: 20
|
||||||
rate: 2/sec
|
rate: 2/sec
|
||||||
@ -981,9 +1053,10 @@ vulcan_gun_p = mknew(vulcan_gun_e.new{
|
|||||||
munition=vulcan_p,
|
munition=vulcan_p,
|
||||||
maxammo = 100,
|
maxammo = 100,
|
||||||
hdr = "vULCAN",
|
hdr = "vULCAN",
|
||||||
body = [[rapid fire
|
body = [[---------GUN
|
||||||
in a v
|
|
||||||
shape.
|
rapidly fire
|
||||||
|
in a v.
|
||||||
|
|
||||||
ammo: 100
|
ammo: 100
|
||||||
rate: 20/sec
|
rate: 20/sec
|
||||||
@ -1074,7 +1147,11 @@ function player:small_upgrade_opts()
|
|||||||
local ret = {{
|
local ret = {{
|
||||||
icon=53,
|
icon=53,
|
||||||
hdr="hull",
|
hdr="hull",
|
||||||
body=[[ armor
|
body=[[--------SHIP
|
||||||
|
|
||||||
|
survive more
|
||||||
|
unshielded
|
||||||
|
hits.
|
||||||
|
|
||||||
+2 hp]],
|
+2 hp]],
|
||||||
action=function()
|
action=function()
|
||||||
@ -1083,8 +1160,13 @@ function player:small_upgrade_opts()
|
|||||||
end,
|
end,
|
||||||
},{
|
},{
|
||||||
icon=52,
|
icon=52,
|
||||||
hdr="shield",
|
hdr="capacity",
|
||||||
body=[[ capacity
|
body=[[------SHIELD
|
||||||
|
|
||||||
|
shield can
|
||||||
|
absorb more
|
||||||
|
hits before
|
||||||
|
recharging.
|
||||||
|
|
||||||
+1 hp]],
|
+1 hp]],
|
||||||
action=function()
|
action=function()
|
||||||
@ -1094,10 +1176,11 @@ function player:small_upgrade_opts()
|
|||||||
},{
|
},{
|
||||||
icon=1,
|
icon=1,
|
||||||
hdr="thrusters",
|
hdr="thrusters",
|
||||||
body=[[performance
|
body=[[--------SHIP
|
||||||
|
|
||||||
move faster,
|
move faster,
|
||||||
steer faster]],
|
steer more
|
||||||
|
sharply.]],
|
||||||
action=function()
|
action=function()
|
||||||
--maxspd thrust drag
|
--maxspd thrust drag
|
||||||
self.maxspd += 0.5
|
self.maxspd += 0.5
|
||||||
@ -1106,22 +1189,29 @@ steer faster]],
|
|||||||
end,
|
end,
|
||||||
},{
|
},{
|
||||||
icon=20,
|
icon=20,
|
||||||
hdr="hull",
|
hdr="magnet",
|
||||||
body=[[ magnet
|
body=[[--------SHIP
|
||||||
|
|
||||||
pick up xp
|
pick up xp
|
||||||
from further
|
from further
|
||||||
away]],
|
away.]],
|
||||||
action=function ()
|
action=function ()
|
||||||
self.magnet += 2
|
self.magnet += 2
|
||||||
end,
|
end,
|
||||||
}}
|
},
|
||||||
|
self.main_gun:rate_upgrade_opt(),
|
||||||
|
}
|
||||||
|
|
||||||
if cdr > 0 then
|
if cdr > 0 then
|
||||||
add(ret, {
|
add(ret, {
|
||||||
icon = 6,
|
icon = 6,
|
||||||
hdr = "shield",
|
hdr = "recharge",
|
||||||
body=[[charge rate
|
body=[[------SHIELD
|
||||||
|
|
||||||
|
shield will
|
||||||
|
recharge at
|
||||||
|
a faster
|
||||||
|
pace.
|
||||||
|
|
||||||
]] .. tostr(ceil(100 * cdr / self.shieldcooldown)) .. "% faster",
|
]] .. tostr(ceil(100 * cdr / self.shieldcooldown)) .. "% faster",
|
||||||
action = function()
|
action = function()
|
||||||
@ -1133,8 +1223,15 @@ from further
|
|||||||
if pr > 0 then
|
if pr > 0 then
|
||||||
add(ret, {
|
add(ret, {
|
||||||
icon = 6,
|
icon = 6,
|
||||||
hdr = "shield",
|
hdr = "recovery",
|
||||||
body=[[disruption
|
body=[[------SHIELD
|
||||||
|
|
||||||
|
reduce the
|
||||||
|
delay after
|
||||||
|
a hit before
|
||||||
|
shield will
|
||||||
|
start to
|
||||||
|
recharge.
|
||||||
|
|
||||||
]] .. tostr(ceil(100 * pr / self.shieldpenalty)) .. "% shorter",
|
]] .. tostr(ceil(100 * pr / self.shieldpenalty)) .. "% shorter",
|
||||||
action = function()
|
action = function()
|
||||||
@ -1795,7 +1892,12 @@ end
|
|||||||
-- ordinary upgrades
|
-- ordinary upgrades
|
||||||
function small_opts()
|
function small_opts()
|
||||||
-- todo: include gun 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
|
end
|
||||||
|
|
||||||
-->8
|
-->8
|
||||||
@ -1804,7 +1906,7 @@ end
|
|||||||
rearm_mode = mknew{
|
rearm_mode = mknew{
|
||||||
sel=1,
|
sel=1,
|
||||||
bfm=1,
|
bfm=1,
|
||||||
crt_frm = 1,
|
crt_frm = 0,
|
||||||
pos=-1,
|
pos=-1,
|
||||||
init=function(this)
|
init=function(this)
|
||||||
poke(0x5f5c, 255) --no btnp repeat
|
poke(0x5f5c, 255) --no btnp repeat
|
||||||
@ -1819,7 +1921,7 @@ function rearm_mode:glow_box(x0, y0, x1, y1, c, cf)
|
|||||||
i -= 1
|
i -= 1
|
||||||
rect(x0+i,y0+i,x1-i,y1-i,v)
|
rect(x0+i,y0+i,x1-i,y1-i,v)
|
||||||
end
|
end
|
||||||
fillp(crt[self.crt_frm&0xff])
|
fillp(crt[1+(self.crt_frm&7)])
|
||||||
rectfill(x0+4, y0+4, x1-4, y1-4, cf)
|
rectfill(x0+4, y0+4, x1-4, y1-4, cf)
|
||||||
fillp()
|
fillp()
|
||||||
end
|
end
|
||||||
@ -1851,7 +1953,7 @@ end
|
|||||||
|
|
||||||
function rearm_mode:draw_option(id)
|
function rearm_mode:draw_option(id)
|
||||||
local rec = self.options[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)
|
spr(rec.icon,5, 5)
|
||||||
print(rec.hdr, 13, 8, 7)
|
print(rec.hdr, 13, 8, 7)
|
||||||
print(rec.body, 5, 15, 6)
|
print(rec.body, 5, 15, 6)
|
||||||
@ -1887,9 +1989,9 @@ function rearm_mode:draw()
|
|||||||
camera(frac * -128 + (1-frac) * -56, 0)
|
camera(frac * -128 + (1-frac) * -56, 0)
|
||||||
self:draw_option(2)
|
self:draw_option(2)
|
||||||
camera(0, -28 * frac)
|
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)
|
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
|
end
|
||||||
|
|
||||||
function rearm_mode:update_pos()
|
function rearm_mode:update_pos()
|
||||||
@ -1909,6 +2011,7 @@ function rearm_mode:update_pos()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function rearm_mode:update()
|
function rearm_mode:update()
|
||||||
|
self.crt_frm+=0.25
|
||||||
self:update_pos()
|
self:update_pos()
|
||||||
if self.pos > 1 then
|
if self.pos > 1 then
|
||||||
mode = game_mode
|
mode = game_mode
|
||||||
|
Reference in New Issue
Block a user