Commit graph

114 commits

Author SHA1 Message Date
Wedge009
45e537505f Use 'curly' quotes as per typography standard.
[ci skip]
2023-10-23 09:44:50 +02:00
Pentarctagon
5eae1b6199 Reorganize unit tests. 2022-12-21 12:30:04 -06:00
Celtic Minstrel
2d95c0f7d3 AI: Convert the FormulaAI example scenario to do all the same things using Lua
- Unit formulas are replaced by inline MicroAIs or candidate actions placed in the unit's [ai] tag.
  - The stationed_guardian MicroAI was chosen as the closest match to the guardian FormulaAI. It's not a perfect fit, but it's pretty close.
  - The goto and patrol MicroAIs are fairly obvious substitutes for the respective unit formulas.
  - The priority test in unit formulas is replaced by fairly basic inline non-external CAs with differing scores.
- The side formulas (opening.fai) have been converted to a separate Lua stage using a new opening.lua. However, that's only a partial conversion. The move and attack functionalities of opening.fai are missing from opening.lua; instead the built-in move, move leader to keep, and combat CAs are used.
- The scouting FormulaAI CA has been ported to Lua. It remains a very basic AI, probably not well-suited to genera use.
- The level up attack FormulaAI CA has been ported to Lua. Like the new scouting CA, this is mostly intended to serve as an example.
2021-09-04 22:20:28 -04:00
Celtic Minstrel
f145dc2bba Replace uses of the moved interface functions 2021-06-19 12:09:46 -05:00
Celtic Minstrel
0c42cdc038
Enable translation mark validation by the schema (#5800)
- The t_string type is now a schema built-in type and no longer attempts a regex match.
- You can also specify that non-t_string types may be optionally-translatable; this case supports a regex match on the string (but note that the translation mark is not part of the match).
- Error messages involving keys with very large values ( > 128 characters) will now truncate the value.
- To account for occasional cases where the schema is intentionally violated, the --validate command-line option now automatically defines the SCHEMA_VALIDATION preprocessor define.

A key validates as type t_string if one of the following is true:
- The key is not present
- The key has at least one segment with a translation mark
- The key is blank (an empty string)

Any type other than t_string is not allowed to be translatable by default, unless you specify allow_translatable=yes in the [type] tag.

An optionally-translatable string could also be defined as a union of t_string and some other type.
2021-06-14 23:59:52 -04:00
Severin Glöckner
6da85e9042 switch from map_data to map_file in SP 2019-10-02 02:54:25 +02:00
Steve Cotton
3420bb17ea 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 10:10:53 -04:00
Celtic Minstrel
02da99638a Fix a few schema issues in some of the interactive test scenarios 2018-10-23 22:49:37 -04:00
Celtic Minstrel
79eed95f98 Embrace turns=unlimited as a way of specifying unlimited turns 2018-10-23 22:39:29 -04:00
mattsc
1c88a6d8c8 Do not load helper.lua where it is not used any more
(cherry-picked from commit 4b6681a300)
2018-10-07 03:21:10 +00:00
mattsc
cb1bc56478 Remove unnecessary inclusions of helper.set_wml_action_metatable {}
(cherry-picked from commit 1684e2f5da)
2018-10-07 03:21:10 +00:00
mattsc
49b1ef9549 Lua code: remove deprecated helper.set_wml_var_metatable() call
It’s not needed here.

(cherry-picked from commit 08a000a7da)
2018-10-07 03:21:09 +00:00
mattsc
05d5afa6a9 Lua code: replace deprecated wesnoth.get_variable() calls
(cherry-picked from commit f1764d182f)
2018-10-07 03:21:06 +00: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
cfb2aa8050 AIs: idle_ai is not a "Dev AI", fixes #1955
As indicated in the comment of the idle_ai config file, an AI needs to
contain at least one stage, otherwise the default AI will be injected
under certain circumstances. Unlike indicated in the comment, this now
also applies to loading a mid-scenario save. (I will add that to the
comment in the next commit.)

As this AI was in data/ai/dev/, it was previously only loaded when
Wesnoth was started in debug mode. The config was thus not available
when playing in no-debug mode, causing the default AI to be injected on
reload. This caused issue #1955.

While not strictly necessary, we keep a redirect in data/ai/dev for
backward compatibility, in case the file is included in add-ons.
2017-10-04 16:48:08 -07:00
mattsc
ba6973f543 High XP Attack CA test scenario: use new syntax for [option] 2016-10-17 17:59:02 -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
f76e2d0c59 High XP attack CA: remove a debug message
Also remove a related message from the test scenario.
2016-09-03 16:47:15 -07:00
mattsc
6950ee1dd0 New high_xp_attack candidate action for default AI
This CA performs attacks on enemy units so close to leveling that the
default AI's combat CA would not attack them (with some exceptions).
This is meant to keep players from being able to exploit this known
weakness of the default AI.
2016-09-02 20:22:17 -07:00
mattsc
91130a3df2 Fix error in Formula AI test scenario 2016-03-30 07:33:37 -07:00
Celtic Minstrel
678444133e Suppress end turn confirmation in all interactive test scenarios 2016-03-27 15:13:24 -04:00
Celtic Minstrel
ba5eb7bc91 Move some AI test scenarios from data/ to data/ai/scenarios/
(And update them to modern syntax)
2016-03-27 15:13:23 -04:00
mattsc
df5714801c AI Arena: fix the menus 2016-03-25 14:15:34 -07:00
mattsc
09ee5c7a4b AI Arena: update [option] tags to new syntax 2016-03-25 13:58:52 -07:00
mattsc
202aa804bb AI Arena: remove akihara_recruitment test
Since akihara_recruitment has been removed.
2016-03-24 19:34:12 -07:00
Celtic Minstrel
d48060bc00 Fix external Lua CA example for new syntax 2016-03-24 17:49:02 -04:00
mattsc
dd2d193cbd Remove move_to_targets test scenario
This was useful when the composite AI was introduced (in Wesnoth 1.7),
but does not serve a purpose any more now.
2016-03-24 10:56:45 -07:00
mattsc
be505342bf Lua AI test scenarios: rename files 2016-03-24 08:16:03 -07:00
mattsc
5774872e04 Lua AI test scenarios: update id= and name= keys 2016-03-24 08:09:59 -07:00
mattsc
961d134ee2 Fix and simplify Lua AI test scenario 2016-03-24 08:07:01 -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
Celtic Minstrel
9859091c7c Convert test scenario maps to new format 2015-10-07 14:19:48 -04:00
mattsc
c0ee2c8e87 Add wmllint spelling exceptions for files in data/ai/ 2013-11-02 20:20:10 -07:00
Espreon
3f20785d02 Split all of the AI-related strings (except for the AI controller's) into a new 'wesnoth-ai' textdomain. Includes a pot-update for 'wesnoth' as a side effect. 2013-05-22 22:19:43 -04:00
Espreon
edcf801caa Ran wmlindent. 2013-05-22 22:19:42 -04:00
Espreon
cadb752ccf Made various strings translatable; disambiguated and split some strings; eliminated an Earth name. 2013-05-22 22:19:42 -04:00
Espreon
5203d7d7b5 Filter for id instead of name; converted some tabs to spaces. 2013-05-22 18:02:43 -04:00
Matthias Schoeck
665fe20f79 AI Arena test scenario: minor changes to two messages
In order to make wmllint happy: add wesnoth-icon.png as image
to two messages and change the way one message is wrapped.
2013-03-04 21:11:29 +00:00
Matthias Schoeck
1c5a1aeba4 AI test scenarios: Add missing translation marks
As found by wmllint
2013-03-04 20:48:27 +00:00
Matthias Schoeck
4410fd190f AI test scenario files: remove trailing whitespaces 2013-03-04 20:40:01 +00:00
Alexander van Gessel
f4ab3722dc Apply patch #3570 by mattsc 2012-11-26 23:50:17 +01:00
Dmitry Kovalenko
51e818b43b LuaAI: wesnoth.debug_ai() slightly refactored,
...now provides access to the ai.* table, the Lua engine table and the
component tree
2012-08-14 07:26:58 +00:00
Dmitry Kovalenko
83d0e06ee8 AI: exposure of the component tree to the AI developers in debug mode 2012-08-06 17:22:47 +00:00
Riss Aline
104a28654d Adding new files concerning new AI...
...(ai/akihara/recruitment.?pp) and new scenario for the ai_arena_small.
2012-07-13 08:38:01 +00:00
Dmitry Kovalenko
b207a1b1ca LuaAI: the need to define an engine is now deprecated.
All CAs can be store in external .lua files. If the scenario config
lacks an [engine] tag for the Lua AI engine, but still tries to use CA
with engine=lua, a dummy engine will be automatically generated,
providing the needed functionality
2012-06-12 12:36:06 +00:00
Dmitry Kovalenko
a72febe0e4 LuaAI: first draft of the external candidate action system,
...with on-the-fly file reloading, if you use the --debug-lua launch argument
2012-06-07 09:53:19 +00:00
Dmitry Kovalenko
57aa197583 LuaAI:
(1) Lua CA_wrapper slightly refactored, in preparation for adding CA
definitons using external files

(2) --debug_lua command line argument added. Unused at the moment, but
will be used for Lua debug mechanisms
2012-06-01 12:57:14 +00:00
Dmitry Kovalenko
d7f6b2c26e LuaAI: fixed bug that always cause ai.attack() to use -1 as the weapon 2012-05-30 13:15:47 +00:00
Dmitry Kovalenko
e810953bea Removed an unneeded function introduced in 2012-04-16T20:49:02Z!nephro.wes@gmail.com 2012-04-17 19:30:15 +00:00
Dmitry Kovalenko
f54f2b0e75 LuaAI:
(1) added wesnoth.is_debug_mode();

(2) disabled the LuaAI debug library usage for non-debug launch modes
2012-04-16 20:49:02 +00:00