[1.0.4] Tactical AI skips buff opportunities

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

[1.0.4] Tactical AI skips buff opportunities

#1 Post by jenx »

Here is the code, about line 360 of tactical.lua:

Code: Select all

		-- Need buffs
		if avail.buff and want.attack and want.attack > 0 then
			want.buff = math.max(0.01, want.attack + 0.5)
			game.logSeen(self, ">>>>> tactical ai wants buff: %0.2f", want.buff)
		end
But in most cases, slingers and archers see you outside their range, so they have no attack options, meaning want.attack is false.

This is easy to see, as it happens every time in the arena.

I've added info to the log from tactical.lua, to study it, and here is the slinger's first move:

Code: Select all

AI took for target	33476	halfling slinger	::	17687	thought-forged warrior	81	<	100
[LOG]	>>>>> tactical ai talents testing: Inertial Shot, T_INERTIAL_SHOT; mode: activated; no_npc_use: 0; cooling down: false; pre-use satisfied: true; requires target: true; within_range: false;
[LOG]	>>>>> tactical ai talents testing: Attack, T_ATTACK; mode: activated; no_npc_use: 0; cooling down: false; pre-use satisfied: true; requires target: true; within_range: false;
[LOG]	>>>>> tactical ai talents testing: Reload, T_RELOAD; mode: activated; no_npc_use: 0; cooling down: false; pre-use satisfied: true; requires target: nil; within_range: false;
[LOG]	>>>>> tactical ai talent is available to use: Reload, T_RELOAD
[LOG]	>>>>> tactical ai talents can use: Reload, ammo. Weight: 3.55
[LOG]	>>>>> tactical ai talents testing: Shoot, T_SHOOT; mode: activated; no_npc_use: 0; cooling down: false; pre-use satisfied: true; requires target: true; within_range: false;
[LOG]	>>>>> tactical ai talents testing: Rapid Shot, T_RAPID_SHOT; mode: sustained; no_npc_use: 0; cooling down: false; pre-use satisfied: true; requires target: nil; within_range: false;
[LOG]	>>>>> tactical ai talent is available to use: Rapid Shot, T_RAPID_SHOT
[LOG]	>>>>> tactical ai talents can use: Rapid Shot, buff. Weight: 40.77
[LOG]	>>>>> tactical ai talents testing: Heave, T_HEAVE; mode: activated; no_npc_use: 0; cooling down: false; pre-use satisfied: true; requires target: true; within_range: false;
[LOG]	>>>>> tactical ai talents testing: Disengage, T_DISENGAGE; mode: activated; no_npc_use: 0; cooling down: false; pre-use satisfied: true; requires target: true; within_range: false;
[LOG]	>>>>> tactical ai wants ammo: 0.00
[LOG]	>>>>> tactical ai wants escape: 0.00
So even though Rapid Shot is weighted heavily at 40.77, want.attack is nil, because within_range is false for all shooting talents.

I'm not sure how the code should be changed to fix this bug though. Suggestions anyone?
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.0.4] Tactical AI skips buff opportunities

#2 Post by jenx »

I'm trying this out, to see if this works.

BUFF choices for the ai are often excellent choices, and often instant use. So they should be used when no attack options are present.

And I don't like the math.max function. This means that buffs are rarely used if there is an available attack. But I'll leave it as is for the moment and see how it goes.

Code: Select all

		-- Need buffs
		if avail.buff then
			if want.attack and want.attack > 0 then
				want.buff = math.max(0.01, want.attack + 0.5)
			else
				table.sort(avail.buff, function(a,b) return a.val > b.val end)
				want.buff = avail.buff[1].val
			end
		end
MADNESS rocks

Post Reply