Skip to content
Snippets Groups Projects
Commit 9a9c7716 authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@4846 51575b47-30f0-44d4-a5cc-537603b46e54
parent 2644ef52
No related branches found
No related tags found
No related merge requests found
......@@ -376,8 +376,13 @@ function _M:display()
local quiver = player:getInven("QUIVER")
local ammo = quiver and quiver[1]
if ammo and ammo.combat then
local shots_left = ammo.combat.shots_left or 0
self:mouseTooltip(self.TOOLTIP_COMBAT_AMMO, self:makeTexture(("#ANTIQUE_WHITE#Ammo: #ffffff#%d"):format(shots_left), 0, h, 255, 255, 255)) h = h + self.font_h
local amt, max = 0, 0
if ammo.type == "alchemist-gem" then
amt = ammo:getNumber()
else
amt, max = ammo.combat.shots_left, ammo.combat.capacity
end
self:mouseTooltip(self.TOOLTIP_COMBAT_AMMO, self:makeTexture(("#ANTIQUE_WHITE#Ammo: #ffffff#%d"):format(amt), 0, h, 255, 255, 255)) h = h + self.font_h
end
if savefile_pipe.saving then
......
......@@ -834,24 +834,28 @@ function _M:displayResources(scale, bx, by, a)
local quiver = player:getInven("QUIVER")
local ammo = quiver and quiver[1]
if ammo then
local amt = ammo.combat.shots_left
local amt, max = 0, 0
local shad, bg
if ammo.type == "alchemist-gem" then shad, bg = _M["ammo_shadow_alchemist-gem"], _M["ammo_alchemist-gem"]
else shad, bg = _M["ammo_shadow_"..ammo.subtype] or ammo_shadow_default, _M["ammo_"..ammo.subtype] or ammo_default
if ammo.type == "alchemist-gem" then
shad, bg = _M["ammo_shadow_alchemist-gem"], _M["ammo_alchemist-gem"]
amt = ammo:getNumber()
else
shad, bg = _M["ammo_shadow_"..ammo.subtype] or ammo_shadow_default, _M["ammo_"..ammo.subtype] or ammo_default
amt, max = ammo.combat.shots_left, ammo.combat.capacity
end
shad[1]:toScreenFull(x, y, shad[6], shad[7], shad[2], shad[3], 1, 1, 1, a)
bg[1]:toScreenFull(x, y, bg[6], bg[7], bg[2], bg[3], 1, 1, 1, a)
if not self.res.ammo or self.res.ammo.vc ~= amt then
if not self.res.ammo or self.res.ammo.vc ~= amt or self.res.ammo.vm ~= max then
self.res.ammo = {
vc = amt,
cur = {core.display.drawStringBlendedNewSurface(font_sha, ("%d"):format(amt), 255, 255, 255):glTexture()},
vc = amt, vm = max,
cur = {core.display.drawStringBlendedNewSurface(font_sha, (max > 0) and ("%d/%d"):format(amt,max) or ("%d"):format(amt), 255, 255, 255):glTexture()},
}
end
local dt = self.res.ammo.cur
dt[1]:toScreenFull(2+x+44, 2+y+3 + (bg[7]-dt[7])/2, dt[6], dt[7], dt[2], dt[3], 0, 0, 0, 0.7 * a)
dt[1]:toScreenFull(x+44, y+3 + (bg[7]-dt[7])/2, dt[6], dt[7], dt[2], dt[3], 1, 1, 1, a)
dt[1]:toScreenFull(2+x+40, 2+y+3 + (bg[7]-dt[7])/2, dt[6], dt[7], dt[2], dt[3], 0, 0, 0, 0.7 * a)
dt[1]:toScreenFull(x+40, y+3 + (bg[7]-dt[7])/2, dt[6], dt[7], dt[2], dt[3], 1, 1, 1, a)
x, y = self:resourceOrientStep(orient, bx, by, scale, x, y, fshat[6], fshat[7])
end
......
......@@ -1300,7 +1300,6 @@ newEffect{
end,
}
newEffect{
name = "RELOADING", image = "talents/reload.png",
desc = "Reloading",
......@@ -1317,12 +1316,12 @@ newEffect{
end,
on_timeout = function(self, eff)
for i = 1, eff.shots_per_turn do
eff.ammo.combat.shots_left = eff.ammo.combat.shots_left + 1
eff.ammo.combat.shots_left = util.bound(eff.ammo.combat.shots_left + 1, 0, eff.ammo.combat.capacity)
if eff.ammo.combat.shots_left == eff.ammo.combat.capacity then
game.logPlayer(self, "Your %s is full.", eff.ammo.name)
self:breakReloading()
break
end
end
end
end,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment