Skip to content
This repository has been archived by the owner on Jan 11, 2018. It is now read-only.

Commit

Permalink
AI improvements
Browse files Browse the repository at this point in the history
There can at most be 7, not 8 minions on the battlefield.
Also entities need to have more than 0 attack, to be able to attack!
  • Loading branch information
Skeen committed Mar 21, 2014
1 parent a1e9699 commit ac71692
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions projects/Release/LuaScripts/AI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ local canEntityAttack = function(entity)
local can_attack = CanAttack(entity)
local is_exhausted = IsExhausted(entity)
local is_frozen = IsFrozen(entity)
local attack_dmg = GetATK(entity)

return can_attack and (is_exhausted == false) and (is_frozen == false)
return can_attack and (is_exhausted == false) and (is_frozen == false) and (attack_dmg > 0)
end

local num_battlefield_minions = function()
Expand Down Expand Up @@ -239,7 +240,7 @@ turn_start_function = function()
end

-- Throw all minions
while num_battlefield_minions() < 8 and throw_random_minion() do
while num_battlefield_minions() < 7 and throw_random_minion() do
end

-- Keep killing tanks, while we're able to
Expand Down

0 comments on commit ac71692

Please sign in to comment.