Commit Graph

1024 Commits

Author SHA1 Message Date
Gothyoba
8a8fe5b0a8 Remove instance of 4 repeated exclamation marks 2025-02-21 12:20:51 -05:00
Toom
eb4312ffb8
Convert hex to new format, closes #9799 (#9801) 2025-01-28 12:47:08 -06:00
Toom
aa379157c9 Fix parameter name re #9799 2025-01-25 21:52:51 +01:00
Wedge009
ca8a0aede8 Typography update. Closes #8000.
[ci skip]
2024-10-06 09:13:10 +11:00
Celtic Minstrel
233237be1e [Lua] Add some TODO notes on things to come back to later. 2024-08-13 08:54:04 -04:00
Celtic Minstrel
a277073e36 [Lua] Remove some internal implementation functions from the external ai_helper interface.
There are no callers in mainline. The functions are not meant to be called directly at all – for each, there are wrapper functions that are intended to be called instead, which are still exposed.
2024-08-13 08:54:04 -04:00
Celtic Minstrel
9e79a627c3 [Lua] Fix some accidental global warnings 2024-08-13 08:54:04 -04:00
Celtic Minstrel
dd24051c17 [Lua] Mark location_set.values as private 2024-08-13 08:54:04 -04:00
Celtic Minstrel
8d5ca809f4 [Lua] Update obsolete location functions in ai_helper to return a proper named tuple and access locations as x,y instead of [1],[2] 2024-05-19 12:54:35 -04:00
Celtic Minstrel
058d0502e5 [Lua] Update obsolete use of [1],[2] to refer to locations, and simplify some code by leveraging the fact that any object with x,y qualifies as a location; also use moves_left for reachmaps instead of [3] 2024-05-19 12:54:35 -04:00
Celtic Minstrel
f5c4f2e841 [Lua] Update obsolete usage of [1],[2] to refer to a tag's name and contents 2024-05-19 12:54:35 -04:00
Celtic Minstrel
0f6fe67477 [Lua] Use wml.tag to construct WML tables 2024-05-19 12:54:35 -04:00
Celtic Minstrel
a2c9d2627e [Lua] Fix obviously broken functions in ai_helper.
These functions are not used anywhere, and they have other issues besides the one fixed in this commit – they're implied to return all moves, but they only return one move for each possibly destination hex. However, this will make them at least be minimally usable.
2024-02-26 13:24:38 -05:00
Celtic Minstrel
c2f50062d2 [Lua] Suppress nodiscard warning 2024-02-26 13:24:38 -05:00
Celtic Minstrel
8276fd2e4b [Lua] Fix incorrect function name 2024-02-26 13:24:37 -05:00
Celtic Minstrel
1fd17d94ba [Lua] Fix missing parameter warning when passing empty filter 2024-02-26 13:24:37 -05:00
Celtic Minstrel
1efc2fbe4d [Lua] Avoid reusing no-longer-needed variables for different meanings
This raises Lua warnings about mismatched types
2024-02-26 13:24:36 -05:00
Toom
0e99d4b38b Revert renaming of ai_helper.checked_move_core
@CelticMinstrel #fixes #8412
2024-02-16 15:32:00 +01:00
Celtic Minstrel
f7ef5e1362 [LuaDoc] Convert all the ai_helper documentation to LuaDoc format, and add LuaDoc for all previously-undocumented functions. 2024-02-13 19:29:21 -05:00
Celtic Minstrel
94adca0fff [LuaDoc] Fix some non-nullable warnings by adding explicit type annotations on local variables 2024-02-13 19:29:21 -05:00
Celtic Minstrel
b506010a8f [LuaDoc] Correct some dumb errors 2024-02-13 19:29:21 -05:00
Celtic Minstrel
4b5a8e25e8 [LuaDoc] Suppress some diagnostics 2024-02-13 19:29:21 -05:00
Celtic Minstrel
a9c0d37525
[Lua] Prevent divide by 0 in rushers recruit AI 2024-02-07 20:13:13 -05:00
Celtic Minstrel
d19858a150 [Lua] Fix missing parentheses in rusher recruit AI
Fixes #8297
2024-02-07 19:06:47 -05:00
Celtic Minstrel
dc75045eea [LuaDoc] Add comments for micro_ai_helper.lua 2024-02-06 19:04:01 -05:00
Celtic Minstrel
795bb22be9 [LuaDoc] Add annotations for micro_ai_self_data.lua 2024-02-06 19:04:00 -05:00
Celtic Minstrel
9eefcda17a Deprecate ai_helper.split
I used level 3 deprecation because this is something that was intended for internal use in the ai_helper module, and the ai_helper module itself is not an officially stable API
2024-02-04 13:28:19 -05:00
gfgtdf
e08676d6a8 Fix Lua errors when checking abilities #7890
Nowdays ability.value and similar attributes can also contain formulas
(That for example make a heal amount dependent on the remaining hitpointsthe unit has
)
With this the lua ai code should no longer crash in these cases.
2023-12-24 00:51:57 +01:00
Wedge009
45e537505f Use 'curly' quotes as per typography standard.
[ci skip]
2023-10-23 09:44:50 +02:00
Wedge009
4037e2a138 Replace non-standard spacing.
[ci skip]
2023-10-23 09:44:50 +02:00
Wedge009
94b48615f0 Use em-dash as per typography standard.
[ci skip]
2023-10-23 09:44:50 +02:00
Wedge009
93df584adb po hints
[ci skip]
2023-10-21 09:35:25 +11:00
Steve Cotton
49ebbb9709 Make fix_whitespace complain about mixing tabs and spaces
Ensures that files either use tabs for indentation or spaces for indentation,
but don't switch between the two within the same file.

This doesn't fix the whitespace, it's a simple check to flag it up
on the assumption that it's better to use an editor or code formatter
to clean up the file.

Elsewhere in the CI we use the luacheck tool - while that can detect
mixing tabs and spaces in a single line's indent, it doesn't check for
inconsistent indentation within a file.
2023-02-05 02:22:53 +01:00
Pentarctagon
5eae1b6199 Reorganize unit tests. 2022-12-21 12:30:04 -06:00
mattsc
507aa62e83 Lua AI: speed up battle_calcs.battle_outcome in extreme cases
The method used in the battle_outcome() function is somewhat simplified compared to the default engine calculation and faster in the vast majority of cases, but it can become extremely slow when the combined number of strikes of the attacker and defender is very large.
2022-08-31 12:42:10 -07:00
mattsc
2424d5705f Micro AI CAs: add handle_user_interact calls 2022-07-12 22:57:16 -04:00
mattsc
c7b3393a9d ai_helper: add handle_user_interact calls 2022-07-12 22:57:16 -04:00
mattsc
b1b521f582 Lua AI CAs: add handle_user_interact calls
Insert these calls in loops that do expensive calculations for the CAs of the default and experimental AIs.
2022-07-12 22:57:16 -04:00
mattsc
6ed684af73 move-to-any-enemy CA: stop eval if no enemies
Otherwise there is an error caused by one of the sort functions later in the code.
2022-07-03 06:48:47 -07:00
mattsc
90f1c01f41 AI: improve efficiency of move-to-any-enemy CA
The new method avoids a lot of path finding that the previous method did, esp. on large maps with many units and/or enemies, leading to significant speed improvements in some cases.

This fixes #6504
2022-07-01 18:56:00 -07:00
mattsc
0092c141d2 Micro AIs: fix image paths 2022-06-27 20:21:28 -07:00
mattsc
2f3f70a709 Micro AIs: add warning messages if invalid parameters are used 2022-06-27 20:21:21 -07:00
mattsc
21475ced4f Micro AIs: add error messages if parameters are of wrong type
Fixes #6408.
2022-06-27 20:20:06 -07:00
mattsc
a70ecf1ff5
Merge pull request #6783 from mattsc/expai_updates
Some fixes to the Experimental AI
2022-06-24 16:37:59 -07:00
mattsc
6796ac3d56
Merge pull request #6792 from mattsc/retreat_allied_villages
Fix retreat injured CA taking allied villages
2022-06-24 16:31:15 -07:00
mattsc
b55148ce91 Retreat injured CA: fix for regenerate ability without value key
The ability does not need to contain a value key if it only heals poison.
2022-06-24 16:03:51 -07:00
mattsc
c1d1ff517a ExpAI recruit rushers: include unit types from extra_recruit
This fixes #4924. Note, however, that the recruit rushers CA is set up for single-leader sides and does not work with multiple leaders, so this is of limited use.
2022-06-22 16:31:39 -07:00
mattsc
7877218158 Deprecate generic_recruit_engine.lua 2022-06-22 16:31:39 -07:00
mattsc
45ac8de582 ExpAI recruit rushers: new parameter reset_cache_each_turn
Many of the operations of the recruit rushers CA are expensive and are therefore cached. For the most part, this cache can be kept from turn to turn, but in case there are events that change, for example, the map or the recruit list, this parameter can be used to force a reset of the cache each turn.
2022-06-22 16:31:39 -07:00
mattsc
561314b0f6 ExpAI recruit rushers: do not parse side __cfg each eval 2022-06-22 16:31:38 -07:00