diff --git a/game/modules/tome/class/PlayerDisplay.lua b/game/modules/tome/class/PlayerDisplay.lua index 22f44923fec005d2dcaa5a5fe54af06383fce801..6c25de1493749f67db7c5a3360f70dd307c491ab 100644 --- a/game/modules/tome/class/PlayerDisplay.lua +++ b/game/modules/tome/class/PlayerDisplay.lua @@ -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 diff --git a/game/modules/tome/class/uiset/Minimalist.lua b/game/modules/tome/class/uiset/Minimalist.lua index fd749131df9d953dab00e446b5353257d1c55522..422787ac38945096039ae16d68721372375f0bef 100644 --- a/game/modules/tome/class/uiset/Minimalist.lua +++ b/game/modules/tome/class/uiset/Minimalist.lua @@ -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 diff --git a/game/modules/tome/data/timed_effects/other.lua b/game/modules/tome/data/timed_effects/other.lua index 72c9bb79cadb1153a563532b786556a84ea138c6..5765a06ae0a51c8223376d16faaccf4ca205abd8 100644 --- a/game/modules/tome/data/timed_effects/other.lua +++ b/game/modules/tome/data/timed_effects/other.lua @@ -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, }