Merge pull request #237 from argonui/replenish-overcharging
Replenishing cards: Bugfix to allow overcharging
This commit is contained in:
commit
2ea7a45249
@ -500,9 +500,18 @@ function replenishTokens(card, count, replenish)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- this is the theoretical new amount of uses (to be checked below)
|
||||||
local newCount = foundTokens + replenish
|
local newCount = foundTokens + replenish
|
||||||
if newCount > count then newCount = count end
|
|
||||||
|
-- if there are already more uses than the replenish amount, keep them
|
||||||
|
if foundTokens > count then
|
||||||
|
newCount = foundTokens
|
||||||
|
-- only replenish up until the replenish amount
|
||||||
|
elseif newCount > count then
|
||||||
|
newCount = count
|
||||||
|
end
|
||||||
|
|
||||||
|
-- update the clickable counter or spawn a group of tokens
|
||||||
if clickableResourceCounter then
|
if clickableResourceCounter then
|
||||||
clickableResourceCounter.call("updateVal", newCount)
|
clickableResourceCounter.call("updateVal", newCount)
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user