Bug fixes

master
a327ex 2021-05-19 02:21:08 -03:00
parent 316cb14e3b
commit 15058fa7f8
4 changed files with 9 additions and 3 deletions

View File

@ -392,9 +392,10 @@ function Seeker:hit(damage, projectile)
if self.push_invulnerable then return end if self.push_invulnerable then return end
self:show_hp() self:show_hp()
local actual_damage = self:calculate_damage(damage)*(self.stun_dmg_m or 1)*(self.bane_dmg_m or 1) local actual_damage = math.max(self:calculate_damage(damage)*(self.stun_dmg_m or 1)*(self.bane_dmg_m or 1), 0)
if self.vulnerable then actual_damage = actual_damage*1.2 end if self.vulnerable then actual_damage = actual_damage*1.2 end
self.hp = self.hp - actual_damage self.hp = self.hp - actual_damage
if self.hp > self.max_hp then self.hp = self.max_hp end
main.current.damage_dealt = main.current.damage_dealt + actual_damage main.current.damage_dealt = main.current.damage_dealt + actual_damage
if projectile and projectile.spawn_critters_on_hit then if projectile and projectile.spawn_critters_on_hit then

View File

@ -48,6 +48,7 @@ function engine_run(config)
love.filesystem.setIdentity(config.game_name) love.filesystem.setIdentity(config.game_name)
steam.init() steam.init()
system.load_state() system.load_state()
if type(state) ~= 'table' then state = {} end
local _, _, flags = love.window.getMode() local _, _, flags = love.window.getMode()
local window_width, window_height = love.window.getDesktopDimensions(flags.display) local window_width, window_height = love.window.getDesktopDimensions(flags.display)

View File

@ -120,8 +120,12 @@ end
function system.save_state() function system.save_state()
if not system.does_file_exist(love.filesystem.getSaveDirectory()) then love.filesystem.createDirectory("") end if not system.does_file_exist(love.filesystem.getSaveDirectory()) then love.filesystem.createDirectory("") end
local file = io.open(state_path, "r")
if file then
file:close()
binser.w(state_path, state or {}) binser.w(state_path, state or {})
end end
end
function system.load_state() function system.load_state()

View File

@ -1438,7 +1438,7 @@ function Projectile:on_collision_enter(other, contact)
self:die(x, y, r, 0) self:die(x, y, r, 0)
knife_hit_wall1:play{pitch = random:float(0.9, 1.1), volume = 0.2} knife_hit_wall1:play{pitch = random:float(0.9, 1.1), volume = 0.2}
local r = Unit.bounce(self, nx, ny) local r = Unit.bounce(self, nx, ny)
trigger:after(0.01, function() self.parent.t:after(0.01, function()
WallKnife{group = main.current.main, x = x, y = y, r = r, v = self.v*0.1, color = self.color} WallKnife{group = main.current.main, x = x, y = y, r = r, v = self.v*0.1, color = self.color}
end) end)
if self.character == 'spellblade' then if self.character == 'spellblade' then