Commit graph

390 commits

Author SHA1 Message Date
mattsc
cf731dd923 Wolves Micro AI: fix problem with target unit filtering 2016-10-21 17:25:11 -07:00
mattsc
67fd4367fd Wolves Micro AI: better recovery from ambushes etc.
This is not necessary for most other Micro AIs, but this AI moves
several units per execution. If an ambush or failed teleport or similar
happens, it is better to reconsider rather than pull through with the
previously planned moves.
2016-10-21 07:59:03 -07:00
mattsc
348f64f4a0 Multipack Wolves Micro AI: better recovery from ambushes etc.
This is not necessary for most other Micro AIs, but this AI moves
several units per execution. If an ambush or failed teleport or similar
happens, it is better to reconsider rather than pull through with the
previously planned moves.
2016-10-21 07:53:24 -07:00
mattsc
7647a4ad42 Fast Micro AI: replace tabs by spaces
To be consistent with the rest of the file.
2016-10-20 19:15:55 -07:00
mattsc
6ff7e1112d Fast Micro AI: clear all persistent variables after use 2016-10-20 19:15:55 -07:00
mattsc
fef404fdb9 Fast Micro AI: simplify code by using new ai.aspect.attacks
Note that this requires that the enemy filter in the utils function now
matches the enemy units to be attacked, while previously it was set to
all enemy units NOT matching the filter. As this is not used anywhere
else, that’s not a problem, it’s just noted here for completeness.
2016-10-20 09:36:32 -07:00
mattsc
25eb3dd20f Fast Micro AI: fix attack_filter when excluding leader
“canrecruit = nil” does not give the same result as “canrecruit =
false” in a standard unit filter.
2016-10-20 09:36:32 -07:00
Charles Dang
e8a499fcec Merge pull request #822 from GregoryLundberg/GL_Upgrade_Lua
Upgrade to Lua 5.3.3+
2016-10-18 12:58:12 +11:00
mattsc
d99ee0fc88 Lurkers MAI test scenario: keep side leaders hidden after reload 2016-10-17 17:59:02 -07:00
Celtic Minstrel
e81131fcc5 Add deprecation messages for old AI aspect fetchers
This commit also updates uses of these fetchers in mainline Lua code.
2016-10-17 14:24:51 -04:00
Gregory A Lundberg
fc6774289e Upgrade deprecated Lua
loadstring was removed, load does the same thing.
atan2 was remvoed, atan works instead
2016-10-17 10:34:43 -05:00
mattsc
b302289402 Micro AIs: correctly deal with hidden and petrified enemies
Previously, the Micro AI behavior was inconsistent at best when it came
to dealing with these units and could even result in AI errors when an
AI unit was ambushed or a petrified unit was in the way of a move. Now,
both types of units are properly "ignored" and the AI moves have been
made robust against unexpected events such as ambushes. Incidentally,
the latter also makes the AI more robust against WML events doing
things the AI cannot know about (such as removing units).
2016-10-16 19:59:19 -07:00
mattsc
2c2f79545e Assassin Micro AI: remove unused parameters from function calls 2016-10-12 15:17:11 -07:00
mattsc
7834b25b57 Forest Animals Micro AI: move only one unit per execution
There is essentially no time saving involved with doing it all in one
execution as all tables need to be reevaluated for each unit anyway in
order to adapt to potential changes due to ambushes or WML events. (The
latter is not all done yet, will be added in a follow-up commit.)
2016-10-11 10:11:01 -07:00
mattsc
3d2fd331d3 Hunter Micro AI: goto hex must be passable for hunter 2016-10-10 17:13:13 -07:00
mattsc
2eeed5ad35 Big Animals Micro AI: move only one unit per execution
There is essentially no time saving involved with doing it all in one
execution as all tables need to be reevaluated for each unit anyway in
order to adapt to potential changes due to ambushes or WML events. (The
latter is not all done yet, will be added in a follow-up commit.)
2016-10-10 17:13:13 -07:00
mattsc
f28d4336bf ai_helper.move_unit_out_of_way: normalize dx/dy here
Instead of making it a requirement that they should be normalized by
the calling function.
2016-10-09 14:25:15 -07:00
mattsc
b00e6d5d96 ai_helper.LS_to_triples: fix function name
For consistency with LS_of_triples.
2016-10-04 17:17:16 -07:00
mattsc
b84ec9f775 Micro AIs: fix attacks aspect setup when ca_id= key not given
This is an optional key of the [micro_ai] tag.
2016-09-17 08:33:55 -07:00
mattsc
c03bd5411f Various Lua AI code: use simpler and faster new syntax
No change in behavior.
2016-09-04 18:54:26 -07:00
mattsc
d781e6263a High XP attacks: adapt other AIs to existence of new CA
This means:
1. Adding the new CA to AI configs
2. Removing it whenever the combat CA is removed
3. Preventing conflicts for AIs that previously used overlapping scores
2016-09-03 20:00:12 -07:00
mattsc
f7d9d747c0 New Micro AI: Assassin Squad AI 2016-09-01 14:41:17 -07:00
fendrin
8eea8122f9 Replace FOREACH 2016-08-06 06:20:41 +02:00
Celtic Minstrel
95c4556a59 fai -> wfl in FormulaAI files 2016-07-29 12:52:10 -04:00
mattsc
3f2df87bed Recruit rushers AIs: adapt syntax to recent AI changes
This caused an error message and recruiting to be abandoned when the
recruit rushers Micro AI was used for two different sides in the same
scenario.  It was only presents since the AI refactoring done during
1.13.4+dev and did not affect any release.
2016-07-27 19:58:22 -07:00
Celtic Minstrel
232709ea57 A few Micro AI tweaks
- For MAIs using aspects, make the facet ID more unique
- Only shallow-preparse the [micro_ai], rather than fully preparsing it
  (This is so that filters in Micro AIs can use $this_unit if needed)
2016-07-15 16:15:44 -04:00
Celtic Minstrel
01d3156d47 Micro AIs: Fix not properly deleting aspects
(This affects the Protect and Wolves MAIs)
2016-07-15 16:07:22 -04:00
Celtic Minstrel
21e79b5f6a Protect Micro AI: Fix missing aspect ID 2016-07-15 15:50:24 -04:00
mattsc
20b07c6379 Micro AIs: internal changes to AI and CA ID handling
This is needed to fix some corner cases of multiple Micro AI changes
during a scenario, such as for the bats in the Goto test scenario.
2016-04-02 07:54:57 -07:00
Celtic Minstrel
74ce7454d9 Random Recruit MAI test: Add second [probability] tag 2016-03-30 01:04:44 -04:00
Celtic Minstrel
85a498ba15 Fast MAI: Correctly honour the attacks aspect if set 2016-03-30 01:04:42 -04:00
mattsc
ff11fecfe3 Guardians MAI test scenario: update portrait paths 2016-03-28 17:42:50 -07:00
Celtic Minstrel
c8b47e48a1 Simple Attack MAI: Fix filters being ignored 2016-03-28 14:59:38 -04:00
Celtic Minstrel
d4104e01c5 Rush Recruit MAI: Pass requested CA score to recruit engine 2016-03-28 14:58:53 -04:00
Celtic Minstrel
32c3abbbaf Micro AIs: Distinguish attribute and tag parameters and copy all of the latter
(Though currently only Protect Unit and Random Recruiting actually honour multiples of any tag.)
2016-03-28 12:54:25 -04:00
mattsc
c82ae94ae9 Random Recruiting Micro AI: fix [probability] tag 2016-03-28 07:22:52 -07:00
mattsc
1e3d80df0b Micro AI tests: do not change controller to null for active side 2016-03-27 20:39:02 -07:00
mattsc
9ed1b39b90 Random Recruiting MAI: use require() instead of dofile() 2016-03-27 20:39:02 -07:00
mattsc
263227852a Micro AI CAs: use consistent indenting 2016-03-27 20:39:02 -07:00
Celtic Minstrel
678444133e Suppress end turn confirmation in all interactive test scenarios 2016-03-27 15:13:24 -04:00
Celtic Minstrel
c79874086d MicroAIs: Update all to use the new [args] syntax
Except for Protect Unit, all of them seem to still work correctly.
2016-03-27 15:13:21 -04:00
Celtic Minstrel
c19ddba30a MicroAIs: Refactor code to make it easy for add-ons to add new ones 2016-03-26 21:57:15 -04:00
Celtic Minstrel
6ed34069fe Micro AIs: Remove tests for deprecated syntax 2016-03-26 21:57:14 -04:00
Celtic Minstrel
16ed12f7de Fix FormulaAI lurkers example 2016-03-24 17:49:02 -04:00
mattsc
c60280392b Protect Unit MAI test scenario: adapt Lua engine to new syntax 2016-03-23 16:43:51 -07:00
mattsc
f920a03ebb Patrols MAI test scenario: adapt Lua engine to new syntax 2016-03-23 16:38:22 -07:00
mattsc
7c4aec9cfe Micro AI test scenario: fix incorrect aspect name 2016-03-22 18:31:42 -07:00
Celtic Minstrel
2ed5e7815f MicroAIs: Fix those that honour the avoid aspect improperly
This affects the Hang Out and Fast MAIs.
2016-03-22 07:22:22 -07:00
Celtic Minstrel
7c9e24aa29 Remove several deprecated recruitment-related aspects
- number_of_possible_recruits_to_force_recruit
- recruitment_ignore_bad_combat
- recruitment_ignore_bad_movement
2016-03-22 07:22:22 -07:00
Celtic Minstrel
9c2027a8d8 Remove version key from AI configs
This has a lot of cascade effects and may remove support for some old syntaxes, such as [protect_unit].
2016-03-22 07:22:22 -07:00