Alright, so I playtested the AI a lot to find any remaining bugs that need to be fixed before an eventual release. So far I only found 2 issues that need fixing:
The attack target selection thing, that was mentioned before. It seems to be a problem with defense position monsters on my side of the field. If I control defense position monsters, the AI doesn't attack the correct targets anymore. Without any attack target restrictions, it rams its monsters in stronger attack-position monsters or in defense position monsters with more defense. I think someone mentioned a fix for this before already? Skaviory maybe?
And the target selection for some cards using specific helper functions. In my Firefist AI, I sometimes use the provided helper functions (like Index_By_Loc(cards,2,"Highest",TYPE_MONSTER,nil,"==",LOCATION_MZONE) to get the strongest available target), however those don't seem to work properly in all situations. They don't select the strongest target, but a seemingly random one instead, I observed the same behavior for cards of other decks, which probably use the same functions. Some of my other cards use custom functions and/or filters, those usually work properly. So I think there might be a bug in some of these helper functions.
€ this is probably caused by this:
function Index_By_Loc(Cards, Owner, Oper, Type, Position, Oper2, Location)
local Index = 1
local Highest = 0
local Lowest = 99999999
if Oper == "Highest" then
for i=1,#Cards do
if Cards[i] ~= false then
if (Type == nil or bit32.band(Cards[i].type,Type) >= Type)
and (Owner == nil or CurrentMonOwner(Cards[i].cardid) == Owner)
and (Position == nil or bit32.band(Cards[i].position,Position) > 0)
and (Oper2 == "==" and Cards[i].location == Location) or (Oper2 == "~=" and Cards[i].location ~= Location)
and Cards[i].attack > Highest then
Highest = Cards[i].attack
Index = i
end
end
end
end
if Oper == "Lowest" then
for i=1,#Cards do
if Cards[i] ~= false then
if(Type == nil or bit32.band(Cards[i].type,Type) >= Type)
and (Owner == nil or CurrentMonOwner(Cards[i].cardid) == Owner)
and (Position == nil or bit32.band(Cards[i].position,Position) > 0)
and (Oper2 == "==" and Cards[i].location == Location) or (Oper2 == "~=" and Cards[i].location ~= Location)
and Cards[i].attack < Lowest then
Lowest = Cards[i].attack
Index = i
end
end
end
end
return {Index}
end
The highlighted parenthesis should be the problem, I deleted them on my end and will continue testing.
€ seems to work properly now, according to my tests. Committed the change to GitHub
Edited by user
2013-12-02T15:44:47Z
|
Reason: Not specified