Skip to content

Commit

Permalink
Merge pull request #2381 from niamu/dud_potions
Browse files Browse the repository at this point in the history
Fix broken dud potions when loaded from save
  • Loading branch information
niamu committed May 19, 2015
2 parents bc3d8dc + bb7e2b5 commit a8a2dbb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/playerEffects.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ end

function PlayerEffects:randEffect(player, effects)
local rand = math.random()
for i,prob in ipairs(effects.p) do
if rand <= prob then
self:doEffect(effects[i], player)
for i,prob in pairs(effects.p) do
if rand <= prob then
local effect = effects[i]
if not effect then
effect = effects[tostring(i)]
end
self:doEffect(effect, player)
break
end
end
Expand Down

0 comments on commit a8a2dbb

Please sign in to comment.