diff --git a/game/modules/tome/data/general/objects/world-artifacts.lua b/game/modules/tome/data/general/objects/world-artifacts.lua index 8a0fde05b5cd3f42d6a04a5312c25d77717fc818..d17d1ffd92557e214d2565fdf0551b9bb3d7b4f9 100644 --- a/game/modules/tome/data/general/objects/world-artifacts.lua +++ b/game/modules/tome/data/general/objects/world-artifacts.lua @@ -3681,23 +3681,19 @@ newEntity{ base = "BASE_WHIP", define_as = "HYDRA_BITE", special_on_hit = {desc=_t"hit up to two adjacent enemies",on_kill=1, fct=function(combat, who, target) local o, item, inven_id = who:findInAllInventoriesBy("define_as", "HYDRA_BITE") if not o or not who:getInven(inven_id).worn then return end + if o.running == 1 then return end + o.running = 1 local tgts = {} local twohits=1 for _, c in pairs(util.adjacentCoords(who.x, who.y)) do - local targ = game.level.map(c[1], c[2], engine.Map.ACTOR) - if targ and targ ~= target and who:reactionToward(target) < 0 then tgts[#tgts+1] = targ end + local targ = game.level.map(c[1], c[2], engine.Map.ACTOR) + if targ and targ ~= target and who:reactionToward(target) < 0 then tgts[#tgts+1] = targ end end if #tgts == 0 then return end - local target1 = rng.table(tgts) - local target2 = rng.table(tgts) - local tries = 0 - while target1 == target2 and tries < 100 do - local target2 = rng.table(tgts) - tries = tries + 1 - end - if o.running == 1 then return end - o.running = 1 - if tries >= 100 or #tgts==1 then twohits=nil end + tgts = rng.tableSample(tgts, 2) + local target1 = tgts[1] + local target2 = tgts[2] + if not target2 or target2 == target1 then twohits=nil end if twohits then who:logCombat(target1, "#Source#'s three headed flail lashes at #Target#%s!",who:canSee(target2) and (" and %s"):tformat(target2.name:capitalize()) or "") else