Wolves MAI: fix bug that sometimes kept predators from attacking
The attacks aspect may only be modified if the avoid_type= key is set in the [micro_ai] tag, otherwise all attacks get disabled.
This commit is contained in:
parent
084a354fda
commit
c65d8d4ae1
2 changed files with 19 additions and 16 deletions
|
@ -2,6 +2,7 @@ Version 1.11.7+dev:
|
|||
* AI:
|
||||
* RCA AI: fix bug #21334: surrounded units don't attack
|
||||
* Simple Attack Micro AI: new optional parameter weapon=
|
||||
* Wolves Micro AI: fix bug that sometimes kept predators from attacking
|
||||
* Lua AI: new replay-safe action ai.synced_command()
|
||||
* Campaigns:
|
||||
* Dead Water:
|
||||
|
|
|
@ -353,25 +353,27 @@ function wesnoth.wml_actions.micro_ai(cfg)
|
|||
{ ca_id = "mai_wolves_wander", location = 'ai/micro_ais/cas/ca_wolves_wander.lua', score = score - 1 }
|
||||
}
|
||||
|
||||
local wolves_aspects = {
|
||||
{
|
||||
aspect = "attacks",
|
||||
facet = {
|
||||
name = "ai_default_rca::aspect_attacks",
|
||||
id = "dont_attack",
|
||||
invalidate_on_gamestate_change = "yes",
|
||||
{ "filter_enemy", {
|
||||
{ "not", {
|
||||
type=cfg.avoid_type
|
||||
if cfg.avoid_type then
|
||||
local wolves_aspects = {
|
||||
{
|
||||
aspect = "attacks",
|
||||
facet = {
|
||||
name = "ai_default_rca::aspect_attacks",
|
||||
id = "dont_attack",
|
||||
invalidate_on_gamestate_change = "yes",
|
||||
{ "filter_enemy", {
|
||||
{ "not", {
|
||||
type=cfg.avoid_type
|
||||
} }
|
||||
} }
|
||||
} }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cfg.action == "delete") then
|
||||
delete_aspects(cfg.side, wolves_aspects)
|
||||
else
|
||||
add_aspects(cfg.side, wolves_aspects)
|
||||
if (cfg.action == "delete") then
|
||||
delete_aspects(cfg.side, wolves_aspects)
|
||||
else
|
||||
add_aspects(cfg.side, wolves_aspects)
|
||||
end
|
||||
end
|
||||
|
||||
elseif (cfg.ai_type == 'herding') then
|
||||
|
|
Loading…
Add table
Reference in a new issue