Tactical AI tries to shoot through walls
Posted: Tue May 17, 2011 11:48 pm
Graziel noticed a bug and we tinkered with it on IRC a bit. The behavior is that a tactical AI tries to shoot talents at targets when there isn't a clear projection path, thus hitting the walls. I tracked this down to the switch from requiring canProject in the tactical AI's t_avail check to the within_range check and then relying on the dummy projection. This switch was done to allow talents that could "hit" from further than their range, basically range+radius. Graziel is currently checking this simple addition to the code, and early results look good:
Code: Select all
diff --git a/game/modules/tome/ai/tactical.lua b/game/modules/tome/ai/tactical.lua
index bda8c77..b829719 100644
--- a/game/modules/tome/ai/tactical.lua
+++ b/game/modules/tome/ai/tactical.lua
@@ -148,7 +148,7 @@ newAI("use_tactical", function(self)
-- Use the player set ai_talents weights
val = val * (self.ai_talents and self.ai_talents[t.id] or 1) * (1 + lvl / 5)
-- Update the weight by the dummy projection data
- if nb_foes_hit > 0 or nb_allies_hit > 0 or nb_self_hit > 0 then
+ -- Also force scaling if the talent requires a target (stand-in for canProject)
+ if self:getTalentRequiresTarget(t) or nb_foes_hit > 0 or nb_allies_hit > 0 or nb_self_hit > 0 then
val = val * (nb_foes_hit - ally_compassion * nb_allies_hit - self_compassion * nb_self_hit)
end
-- Only take values greater than 0... allows the ai_talents to turn talents off