Commit graph

777 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
9b6008be54 ExpAI: fix bug in finding hexes next to healers
The CA was supposed to mark hexes next to healers as potential healing locations, but because of this bug that did not work.
2021-03-14 08:59:09 -07:00
mattsc
0421a524f9 ai_helper.get_closest_location: bug fix for border hexes
If a unit is passed as the last argument to this function, the returned hex is supposed to be passable for that unit. Hexes on the map border need to be excluded in this case.

This specifically also fixes a bug in the Messenger Escort Micro AI. Previously, waypoints right at the map border could sometimes lead to the AI showing an on-screen error message and becoming inactive.
2020-09-26 14:06:17 -07:00
mattsc
e20f0c67db Micro AI test scenarios: add missing side controllers
Fixes #4890
2020-05-12 08:19:49 -07:00
mattsc
9020c92498 AI retreat CA: bug fix for cure-only abilities
That is, those that cure poison, but do not provide any healing.
2020-02-11 12:33:39 -08: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
ecbb41b0ae Experimental AI: fix use of 1.15 syntax
Commit f528188c67 backported a bug fix from Wesnoth 1.15 and accidentally introduced Wesnoth 1.15-only syntax.
2020-01-15 19:51:46 -08:00
mattsc
450e3d1a48 Experimental AI: do not use village hunt CA
The algorithm used in this CA is too simple to work reliably in a general setting, it tends to send whole groups of units toward small numbers of villages, or even individual ones. In its current version, it should not be used at all, not even in the Experimental AI. The recommended way to emphasize village hunting is to set the village_value aspect to a larger-than-default value and let the move-to-targets CA take care of it.

An updated version of this CA's code is, however, left in place for potential future work as an external CA in Wesnoth 1.15.
2020-01-01 19:22:11 -08:00
mattsc
8fc6cabf7d Experimental AI: fix village_hunt CA bug
This is really just a work around for a CA that is very much sub-par though.  I will remove this CA from the ExpAI next.
2020-01-01 19:12:37 -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
f528188c67 Experimental AI castle switch: bug fix for units on keep check
This also fixes the score assignment, with the 'break' being in the wrong part of the conditional.
2019-12-16 07:27:07 -08:00
mattsc
bf6b66a789 battle_calcs.lua: fix bug in relative_damage_map() 2019-12-16 07:21:13 -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
71464b1a7c Lua AI utility functions: 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.
2019-10-05 20:22:24 -07:00
mattsc
f77dbe4804 Herding Micro AI: fix variables not being local 2019-10-05 20:17:00 -07:00
mattsc
882ba311c6 Experimental AI recruiting: fix eval debug output 2019-10-05 20:13:23 -07:00
mattsc
2436195012 Lua AIs: replace print() by std_print() 2019-10-05 20:05:12 -07:00
mattsc
d98b7f6746 Lua AIs: remove unused debug output 2019-10-05 20:01:04 -07:00
mattsc
91b84539de Experimental AI: fix poisoners ignoring [avoid] tag 2019-10-05 07:21:28 -07:00
mattsc
da080dd94c Experimental AI: fix guardians being used for village actions 2019-09-18 19:41:12 -07:00
mattsc
ac2e90faca ai_helper: get_unit functions should only return live units
Live beiing defined as in get_live_units(), that is, non-petrified units
2019-09-18 16:27:18 -07:00
Steve Cotton
f3419b7f86 Test scenario High XP Attack: use the map that it expects
This scenario uses the huge final map from THoT, with different situations
split across different rooms of the map. THoT's final scenario was redesigned
with a completely new map in 457d9d17f, so this gives the test code its own
copy of the map.

There's a one-hex change to the original: the test puts side 1's leader in a
wall, isolated from the action. To clarify that that's intentional, the map
copy changes that hex to be passable, still surrounded by wall.
2019-03-23 13:49:01 +01: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
mattsc
4d43b218ee AI configuration: invert mp_rank based ordering
This is supposed to be equivalent to the campaign rank, so it should be in ascending order.
2018-12-18 07:19:31 -08:00
mattsc
a2c30ea665 AI configuration: new optional parameter mp_rank=
This parameter determines in which order the available AIs are shown in the MP computer player selection menu. This can be used for eras, modifications or cores to change which AI is first in the list.
2018-12-18 07:13:41 -08:00
mattsc
aa93baacbf ExpAI recruiting: fix AI crash for unit type with unknown race 2018-11-13 06:58:06 -08:00
mattsc
4450da2b80 ai_helper.move_unit_out_of_way: prevent potential for divide-by-zero
dx = dy = 0 is a perfectly acceptable choice of values when there is no preferred direction.
2018-10-21 19:25:46 -07: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
mattsc
fb364cf2b7 AI helper: improve efficiency of get_unit functions
The old method is very slightly faster in some circumstances (e.g. for
simple filters and when all units have moves/attacks/etc. left), but we
are talking fractions of micro seconds. By contrast, depending on the
filter used, the new method can save large amounts of evaluation time
once some units have move or attacked.
2018-06-06 20:23:56 -07:00
mattsc
84837f0a91 Experimental AI recruiting: use math.huge instead of 9e99 2018-05-20 07:36:05 -07:00
mattsc
d5a910c358 Experimental AI: clear recruit cache when no recruit action found 2018-05-19 18:46:59 -07:00
mattsc
09fe71911f Fix Experimental AI not working without enemy units
An example are the first two turns of Dark Forecast.
2018-05-19 18:39:45 -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
28cb5f9e9d Fix a few schema issues in some of the interactive test scenarios 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