78464 Commits

Author SHA1 Message Date
Celtic Minstrel
a12de1f90f Fix several races using the Markov name generator instead of the new CFG generator 2021-03-05 09:29:11 -05:00
Celtic Minstrel
93398ae3a4
Fix another syntax error 2021-03-04 23:43:24 -05:00
Celtic Minstrel
86c3c30c46
Fix a syntax error 2021-03-04 23:33:33 -05:00
Celtic Minstrel
3a7eef0310 Merge pull request #4580 from wesnoth/lua_gamemap
Refactor the game map to permit exposing it to Lua
2021-03-04 14:00:43 -05:00
mattsc
28ea6e82c6 Multipack Wolves MAI: fix error when a wolf is surrounded 2021-03-03 17:41:41 -08:00
mattsc
ea4657c6d4 Goto Micro AI: add remove_movement option
By default, the MAI removes movement points from units even when they cannot find a hex to move to.  When this option is set to 'no' (default is 'yes'), this step is skipped, so that other candidate actions can take over.

This implements feature request #5580
2021-03-03 12:49:35 -08:00
mattsc
7e8cedaea8
Merge pull request #5573 from mattsc/ca_retreat_injured
AI: Improve behavior of the retreat_injured CA
2021-03-03 08:22:21 -08:00
mattsc
043ee7a80b 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-03 08:14:46 -08:00
Steve Cotton
0035b776d7
Handle empty children in patch_movetype (#5582)
In movetype::write, the children might not be created if that child has an
empty config; there might be no child at all for movetypes such as "none". The
movetype "none" is a real movetype defined in units.cfg for units that
shouldn't be able to move.

The original_cfg local variable was only used once anyway, removing it and the
comment made the code clearer.

This wasn't caught in the 1.15 testing, but with 1.14 it resulted in a
"mandatory WML child missing" warning.
2021-03-03 02:57:01 -05:00
doofus-01
0e449be887
UtBS - undead variations set for the rider/mounted Quenoths
Merge pull request #5584
2021-03-02 19:12:25 -08:00
Celtic Minstrel
7d7e367a8e Boost.Optional was still used in some places 2021-03-02 20:54:24 -05:00
doofus-01
ac7dc6f3e6 UtBS - undead variations for the rider/mounted Quenoths 2021-03-02 16:41:37 -08:00
Charles Dang
ba5f0d386f Fixed build on GCC 11 (fixes #5581) 2021-03-02 06:39:27 -05:00
nemaara
2845d34097 Add SotA balance to changelog 2021-03-02 02:36:45 -05:00
nemaara
3e59f2ef5b SotA: rebalance campaign 2021-03-02 02:36:20 -05:00
nemaara
d1461370aa Add SotBE balance to changelog 2021-03-02 00:36:03 -05:00
nemaara
df10b80cae SotBE: balance campaign 2021-03-02 00:35:40 -05:00
Steve Cotton
3522eb2c2a Support [terrain_defaults]'s original subtag names
This is preparation for backporting 0ba433203e, with the idea that both sets
of names will be supported in both branches.

No deprecation messages are added. While config::get_attribute_value() has a
config::get_old_attribute_value(), there isn't currently a similar utility for
config::child(); maybe I should add one now, but it feels too large a change
for a backport.
2021-03-02 00:22:32 +01:00
Elvish_Hunter
c1c80e3a7f wmllint: implemented Xol terrain conversion 2021-03-01 20:30:07 +01:00
Elvish_Hunter
780797e3bc wmllint: enable checks inside Lua [args] tags
Completes PR #5470
2021-03-01 18:43:03 +01:00
doofus-01
edd405fbff
Update Corpse_Soulless.cfg 2021-03-01 04:27:06 -08:00
doofus-01
1527f3174a
Update Corpse_Walking.cfg 2021-03-01 04:26:01 -08:00
doofus-01
69ad6cac51
Update changelog.md 2021-02-28 20:15:58 -08:00
doofus-01
17093158b1
Merge pull request #5551 from doofus-01/beastmountWC_20210215
units - Walking Corpse beast-rider (taurus) variation
2021-02-28 20:09:52 -08:00
doofus-01
a834c78728 units - soulless beastrider sprite, animations, and portrait 2021-02-28 19:26:19 -08:00
Celtic Minstrel
c7b2dcca3f Oh look, a deprecated thing that was missed sometime in the past 2021-02-28 18:16:33 -05:00
Celtic Minstrel
9d3bf196b0 Update everything to use the new wesnoth.map module
- get_terrain and set_terrain replaced with direct indexing operations
- get_map_size mostly replaced with either the iterator or an on_board call.
  Only a few cases really needed to know the size of the map for some other purpose.
- shroud and fog operations, village owner, time areas, and location filters
- get_terrain_info replaced with terrain_types table
- Map generation functions create_map and create_filter
2021-02-28 18:16:33 -05:00
Celtic Minstrel
6558c7981b Add a wesnoth.terrain_types table 2021-02-28 18:16:33 -05:00
Celtic Minstrel
cf71af4e11 Add a terrain hex reference API
This adds a metatable to all locations returned from wesnoth.map.find.
2021-02-28 18:16:32 -05:00
Celtic Minstrel
9cea078f9b Implement a map iterator 2021-02-28 18:16:32 -05:00
Celtic Minstrel
2054cf4acb Add on_board and on_border map methods 2021-02-28 18:16:32 -05:00
Celtic Minstrel
5a129cb570 Add wesnoth.map.get_hexes_in_radius 2021-02-28 18:16:31 -05:00
Celtic Minstrel
f8f49102fa Add wesnoth.map.get_label 2021-02-28 18:16:31 -05:00
Celtic Minstrel
90e6db0330 Rename two functions for consistency of terminology 2021-02-28 18:16:31 -05:00
Celtic Minstrel
7e1414e249 Rename existing map functions in the map generation kernel 2021-02-28 18:16:31 -05:00
Celtic Minstrel
2d5ea6312e Move various functions into the map module 2021-02-28 18:16:31 -05:00
Celtic Minstrel
e6efc7de6c Refactor the game map to permit exposing it to Lua via wesnoth.current.map
The method of accessing terrain on the map has drastically changed.
- wesnoth.get_terrain and wesnoth.set_terrain are both deprecated
- wesnoth.terrain_mask still works but is moved into the wesnoth.map module and now takes the map object as the first parameter
- The map's terrain is now accessed exclusively via indexing on the map object, ie map[{x,y}]
- You set terrain by assigning a terrain code; the position of ^ in the terrain code now determines the merge mode
- The replace_if_failed option is now manifested as a function that converts any terrain code into a special value that, when assigned to a location on the map, uses the replace if failed logic.

The map object has a few attributes in it:
- width and height are the total size, including borders
- playable_width and playable_height are the values returned from wesnoth.get_map_size, which is now deprecated
- border_size is the third value from wesnoth.get_map_size
- data converts the map to a string
- Special locations are now part of the map object. The length operator is deprecated.
- other than that, wesnoth.map is treated as if it were the metatable of the map object
2021-02-28 18:16:30 -05:00
Celtic Minstrel
51cf2621f7 Add a utility function to extract a location from the front of a variadic parameter pack
The purpose of this is to make it easy for functions implemented in Lua to handle locations
in the same way as functions implemented in C++.

The location_set module has been updated to make use of this functionality in its setter functions.

Usage example:

Imagine a function foo with the following signature:

foo(bar : string, home : location, mode : string, target : location, moo : boolean) -> boolean

With the new read_location function it could be implemented as follows:

function foo(...)
	-- First argument goes in bar
	local bar = ...
	-- Read location starting at the second argument
	local home, n = wesnoth.mP.read_location(select(2, ...))
	-- note: n will be 0 if a location wasn't found at that position
	-- This could be an error, or it could be handled as an optional parameter
	-- Next argument after that goes in mode
	local mode = select(n + 2, ...)
	-- Then read a location into target
	local target, m = wesnoth.map.read_location(select(n + 2, ...))
	-- Finally, read a parameter into moo
	local moo = select(m + n + 2, ...)
	-- Do stuff with all these parameters
	return true
end

With that code, all the following invocations of foo work:

foo('a', 'b', true) -- both optional locations omitted
foo('a', 1, 2, 'q', 5, 6, false) -- locations given as separate integer parameters
foo('a', 'm', {1, 7},  true) -- first location omitted, second given as 2-element array
foo('a', some_unit, 'z', {x = 5, y = 10}, false) -- a unit also functions as a location
foo('a', 7, 12, 'q', my_leader, true) -- mixing different forms also works
2021-02-28 18:16:30 -05:00
Celtic Minstrel
dacd5b323e Add some utility functions to help clarify the merge mode being used when assigning terrains 2021-02-28 18:16:30 -05:00
Celtic Minstrel
b075bbf0c1 Fix some typos 2021-02-28 18:16:29 -05:00
mattsc
287530a43f Goto Micro AI: change how avoid_map is taken into account
There were two issues with the previous method:
- ai_helper.get_avoid_map() never returns nil, but at most an empty location set. Thus, the 'else' clause in that conditional was never reached.
- The presence of an [avoid] tag should not prevent the keys ignoring enemies from taking effect. Instead, [avoid] needs to be taken into account for all possible code paths.
2021-02-28 10:22:11 -08:00
mattsc
94bd2ec993 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-02-28 10:15:07 -08:00
mattsc
fd0c00cfb0 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-02-28 10:11:49 -08:00
Celtic Minstrel
dff7b7d90d fix a compiler warning 2021-02-28 11:53:56 -05:00
Steve Cotton
37bf7f9333 Update the schema for [terrain_mask] 2021-02-28 15:47:00 +01:00
Celtic Minstrel
9e1677612b Add some unit tests for [terrain_mask] 2021-02-27 21:24:47 -05:00
Celtic Minstrel
f473aabe99 Add another note in [test_condition] for a simple case of using [have_location] to verify that a hex has a particular terrain 2021-02-27 21:24:01 -05:00
Celtic Minstrel
3e31fdb7fb Fix [terrain_mask][rule]layer= 2021-02-27 20:20:48 -05:00
Celtic Minstrel
a97a04e2e9 Update [test_condition] to be a little more verbose and make use of newer features 2021-02-27 19:43:42 -05:00
Celtic Minstrel
ef39108f08 Add an option to the test runner to disable batching of tests 2021-02-27 18:58:28 -05:00