Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: edge2054/Fae
base: ea232e1002
head fork: edge2054/Fae
compare: 009dfa5725
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on May 06, 2012
Eric Wykoff fixed and optimized the cleave code f79ce21
Eric Wykoff comments 009dfa5
Showing with 21 additions and 11 deletions.
  1. +21 −11 class/interface/Combat.lua
32 class/interface/Combat.lua
@@ -60,7 +60,8 @@ end
-- Cleave if we have enough action points
-- Attacks foes adjacent to both you and your target
-function _M:cleaveTargets(target)
+-- No energy argument used for talent calls to this function
+function _M:cleaveTargets(target, no_energy)
-- Get adjacent hexes and search for viable targets
local dir = util.getDir(target.x, target.y, self.x, self.y)
if dir == 5 then return nil end
@@ -77,25 +78,34 @@ function _M:cleaveTargets(target)
-- Attack hostile targets
self:attackTarget(target, true)
- if self:getActions() / 2 >= 2 then
- if lt_hostile then
+ -- check for targets
+ if lt_hostile or rt_hostile then
+ -- if just one viable target attack it
+ if lt_hostile and not rt_hostile then
self:attackTarget(lt, true)
- end
- if rt_hostile then
+ elseif rt_hostile and not lt_hostile then
self:attackTarget(rt, true)
- end
- else
- if lt_hostile and rng.chance(2) then
+ -- if two viable targets and less then 4 action points attack one at random
+ elseif lt_hostile and rt_hostile and self:getActions() / 2 < 2 then
+ if rng.chance(2) then
+ self:attackTarget(lt, true)
+ else
+ self:attackTarget(rt, true)
+ end
+ -- otherwise attack them both
+ else
self:attackTarget(lt, true)
- elseif rt_hostile then
self:attackTarget(rt, true)
- self:useEnergy(game.energy_to_act)
+ if not no_energy then
+ self:useEnergy(game.energy_to_act)
+ end
-- Attack with all available weapons
+-- No energy argument is used for talent and cleave calls
function _M:attackTarget(target, no_energy)
local successes, dam
local mainhand, offhand

No commit comments for this range

Something went wrong with that request. Please try again.