[Fix] AI shouldn't be fleeing when enemy has more health.

This commit is contained in:
Allanis 2014-03-10 16:55:21 +00:00
parent 40aa774ff7
commit b314a922b3

View File

@ -33,9 +33,12 @@ function control()
-- Think for attacking.
elseif task == "attack" then
target = ai.target()
-- Runaway if needed.
if(shield_run > 0 and ai.pshield() < shield_run) or
(armour_run > 0 and ai.parmour() < armour_run) then
if(shield_run > 0 and ai.pshield() < shield_run
and ai.pshield() < ai.pshield(target)) or
(armour_run > 0 and ai.parmour() < armour_run
and ai.parmour() < ai.parmour(target)) then
ai.pushtask(0, "runaway", ai.target())
-- Think like normal.