Commit graph

390 commits

Author SHA1 Message Date
mattsc
23fc509256 Lua AIs: fix some incorrectly used variables
Fixes #5586
2021-03-14 08:59:42 -07:00
mattsc
0c7ea59613 Multipack Wolves MAI: fix error when a wolf is surrounded 2021-03-14 08:59:41 -07:00
mattsc
778fde4fbe Protect Unit Micro AI: ensure units are on AI side
In general, the units specified in the MAI setup should be on the AI side.  However, that might change during a scenario, for example when there is an event that switches units to other sides.
2021-03-14 08:59:41 -07:00
mattsc
c61494e1dc Goto Micro AI: fix possible error when ignoring enemies
The final determination of the hex to move to must take enemies into account, otherwise the MAI might try to move the unit to a hex it cannot actually reach.
2021-03-14 08:59:41 -07:00
mattsc
768c5f8315 Goto Micro AI: fix checks of avoid_enemies key
Numerical values are sometimes transferred from WML to Lua using the string type. This applies, for example, to very small numbers, such as 0.0000000000001. This needs to be taken into account when checking whether avoid_enemies is a number.
2021-03-14 08:59:41 -07:00
mattsc
e20f0c67db Micro AI test scenarios: add missing side controllers
Fixes #4890
2020-05-12 08:19:49 -07:00
mattsc
465ba7cc41 Forest Animals Micro AI: exclude rabbit holes on map border
Previously, a rabbit hole item on the map border could be selected for spawning a new rabbit, resulting in an error message on screen and abandoning the CA for the rest of the turn.
2020-01-21 16:30:26 -08:00
mattsc
e82469adcb Bottleneck Micro AI: bug fix for units in front of bottleneck
Previously, units so far in front of the bottleneck that they could not get behind it in one move were left stranded. Now they are moved toward it.
2019-12-16 12:41:32 -08:00
mattsc
7652c456b7 Fast Micro AI: fix AI setup 2019-12-16 12:25:26 -08:00
mattsc
e5eb2cc11e Fast Micro AI: fix re-adding default CAs when deleting the MAI
The high_xp_attack CA is deleted when adding the Fast MAI, but not added back in when deleting the MAI.
2019-12-16 07:18:56 -08:00
mattsc
f77dbe4804 Herding Micro AI: fix variables not being local 2019-10-05 20:17:00 -07:00
Andrius Štikonas
9ac2b7cc6d
Fix some spelling issues
Fix a typo in micro_ai simple_attack demo: you -> your.
Fix inconsistent spaces
Fix misspelled wesnoth in systemd unit file
2019-03-01 18:56:01 +00:00
mattsc
2c94696f83 Forest Animals MAI: fix AI crash when using custom rabbit hole image 2018-12-27 14:51:18 -08:00
Severin Glöckner
cf15d38420 Micro AI Demos: use Cme instead of Chw for lurkers map
[ci skip]
2018-09-14 22:33:17 +02:00
Severin Glöckner
708a5136a3 Micro AI Demos: save maps in new format
[ci skip]
2018-09-14 22:33:17 +02:00
mattsc
f24bd96f42 Fast Micro AI: fix for chance-to-hit specials without id
All mainline chance-to-hit weapon specials have ids, but it is not required for UMC specials.
2018-08-10 07:05:01 -07:00
Martin Hrubý (hrubymar10)
c18537edc0 Migrate links to https if available 2018-07-15 13:22:56 +11:00
mattsc
7727130e24 Goto Micro AI: add [and] to a filter
Another efficiency improvement.  This ensures that the side of the unit
is checked first before the potentially complex rest of the filter is
evaluated.
2018-06-06 20:24:04 -07:00
mattsc
4b8870ed93 Goto Micro AI: change order of SLF and SUF evaluation
This is for efficiency reasons, as location filters do not necessarily
change throughout a side’s turn, while fewer and fewer units have moves
left.
2018-06-06 20:24:03 -07:00
Celtic Minstrel
fa14c650fc MicroAI Tests: Fix issues found by the schema validator
With this, the MicroAI test scenarios are clean of schema errors
2018-05-19 16:33:09 -04:00
Celtic Minstrel
e00c3a043e Embrace turns=unlimited as a way of specifying unlimited turns 2018-05-19 16:31:26 -04:00
mattsc
2f611a9c2e
Merge pull request #3079 from mattsc/lua_deprecation_fixes
Replace deprecated Lua code
2018-05-13 16:57:17 -07:00
mattsc
bf81191b21 MAI test scenarios: remove uses of deprecated MESSAGE macro 2018-05-13 15:27:15 -07:00
mattsc
c9ef14ad54 Do not load helper.lua where it is not used any more 2018-05-12 17:41:42 -07:00
mattsc
0396461309 Remove unnecessary inclusions of helper.set_wml_action_metatable {} 2018-05-12 17:41:42 -07:00
mattsc
8ff8acea72 Lua code: replace deprecated helper.[gs]et_variable_array() calls 2018-05-12 17:41:40 -07:00
mattsc
c7f32b1ed5 Lua code: replace deprecated helper.child_range() calls 2018-05-12 17:41:40 -07:00
mattsc
a5bd46e172 Lua code: replace deprecated helper.get_child() calls 2018-05-12 17:41:39 -07:00
Celtic Minstrel
c266b35528 Fix rabbits AI being broken by save-load 2018-03-17 17:16:22 -04:00
Celtic Minstrel
23aac4f72f Cleanup of fef953a48e
- Fix the rabbit AI
- Enable invoke_synced_command to also call (some) built-in commands
  and give an error message in the case of an unknown command
- Remove some unnecessary implementation details
2018-03-17 16:48:00 -04:00
Charles Dang
134353f863 Further cleanup of deprecated Lua API usecases (inc. ones from fef953a)
[ci skip]
2018-03-17 00:41:32 +11:00
gfgtdf
fef953a48e remove ai.synced_command
fixes #1649 . ai.synced_command could easily be used to implement all types of
undeteced cheats so it was removed. As a replacement this commit adds a
[custom_command] synced command that just calls
wesnoth.game_events.on_synced_command which calls a lua handler that
must first be set.
2018-03-16 13:43:05 +01:00
Charles Dang
33725add8f Data/AI: wmlindent run
[ci skip]

Addresses some of the whitespace issues noted in #2613.
2018-03-09 11:07:23 +11:00
mattsc
85b46f34b0 Fast Micro AI: make code robust against events removing units
The previous version caused errors under some circumstances when an
event removed units other than the attacker during or immediately after
an AI attack.
2018-02-11 08:05:58 -08:00
Matthias Krüger
b11d3fdcbe fix a bunch of typos found by codespell in data directory.
https://github.com/lucasdemarchi/codespell
2018-02-06 23:03:06 +11:00
mattsc
b7efaadec4 Protect Unit Micro AI: fix typo/bug in AI aspect change 2017-11-27 06:54:14 -08:00
mattsc
d53243daa9 Fast Micro AI: fix typo from commit 6efc5ae090 2017-10-03 20:55:34 -07:00
Celtic Minstrel
4b8e37044c Micro AIs: Fix Lua error in AIs that use unit variables 2017-05-11 16:00:51 -04:00
mattsc
24891d85e2 Lua AIs: remove unused library inclusions after distance_between change
Follow-up to 6efc5ae090
2017-05-11 10:22:00 -07:00
Celtic Minstrel
6efc5ae090 Replace helper.distance_between -> wesnoth.map.distance_between (fixes #1686) 2017-05-11 04:14:03 -04:00
Celtic Minstrel
0539a68eb4 Migrate ai_helper.LS_random_hex to location_set:random 2017-05-10 17:40:21 -04:00
Celtic Minstrel
9b635994e1 Add location_set.(of|to)_triples (migrated from ai_helper) 2017-05-10 17:40:14 -04:00
Celtic Minstrel
5da2d71a20 Move [micro_ai] implementation to data/lua/wml 2017-05-03 02:45:54 -04:00
Celtic Minstrel
8d4cf3cf62 Shorten requires where possible 2017-05-03 02:42:25 -04:00
Celtic Minstrel
f45d795134 fixup 0f01f97b (GNA25615) 2017-03-23 17:00:51 -04:00
Celtic Minstrel
0f01f97b30 Update Micro AIs to use new Lua API functions for altering AI 2017-03-20 12:00:21 +11:00
mattsc
3236a4b085 Micro AIs: fix some MAIs not working under shroud
This is done by ignoring shroud for path finding (while still taking
hidden units into account correctly), consistent with default Wesnoth
AI behavior.
2016-12-09 18:59:52 -08:00
mattsc
acecd77bb4 Lua AIs: use new syntax for iterating over attacks
This is both simpler and faster than the old syntax.
2016-10-22 13:54:32 -07:00
mattsc
93f95f1d4c Fast Micro AI: better recovery from ambushes etc.
This is not necessary for most other Micro AIs, but this AI moves many
units per execution for speed reasons. If an ambush or failed teleport
or similar happens, it is better to reconsider rather than pull through
with the rest of the moves.
2016-10-21 20:57:16 -07:00
mattsc
d375321e64 Fast Micro AI: fix behavior with attack_hidden_enemies=yes
ai_helper.get_attacks() now excludes hidden enemies by default -> they
need to be specifically included if they are to be attacked, as opposed
to having to be excluded when not.
2016-10-21 17:25:11 -07:00