78646 Commits

Author SHA1 Message Date
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
Celtic Minstrel
d74b8c3a52 Fix WML test runner crashing if none of the tests are expected to pass 2021-02-27 16:53:49 -05:00
mattsc
f67a5b269e AI retreat_injured CA: fix retreat_enemy_weight use
Only enemy threats are to be multiplied by this factor, not the ally support.
2021-02-27 08:56:14 -08:00
Nils Kneuper
2191911cc1 updated British English translation 2021-02-27 13:19:36 +01:00
Nils Kneuper
bb035ea19d updated Italian translation 2021-02-27 13:18:26 +01:00
Nils Kneuper
0d59bd832b move map overlay for Hungarian to correct location 2021-02-27 13:15:58 +01:00
nemaara
3d49124c1d Add SoF balance to changelog 2021-02-27 05:26:24 -05:00
nemaara
672628aa07 SoF: rebalance patch 2021-02-27 05:25:40 -05:00
Celtic Minstrel
c645856974
Add a Wesnoth MSVC visualization file for config and t_string (#5571)
* Add a Wesnoth natvis file

The change to t_string is just to make the textdomain map visible to the debugger, since it can't see variables with static linkage.

* Update tstring.hpp

* Update tstring.cpp
2021-02-27 01:08:31 -05:00
mattsc
f799269fa1 AI retreat_injured CA: improve retreat location evaluation
This includes several improvements to the retreat hex evaluation:
- Enemy threats are not the dominant rating contribution any more
- Enemy threats are based mostly on HP balance, rather than simply enemy number
- Enemy threat assessment can be modified with the retreat_enemy_weight aspect
- By default, only healing locations are considered as retreat locations, but this can be overridden with the retreat_enemy_weight aspect
2021-02-26 17:03:06 -08:00
mattsc
663a0ef8ec AI retreat_injured CA: 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-02-26 16:27:43 -08:00
mattsc
fe316aec3a Add new AI aspect retreat_enemy_weight 2021-02-26 13:57:13 -08:00
Pentarctagon
fa53539f37
Rename query output column 2021-02-26 13:59:30 -06:00
mattsc
903e03d68a AI retreat_injured CA: improve retreat threshold calculation
The main problem was that the previous calculation was based on the 'caution' aspect. While that is not technically wrong, caution is also used for other purposes and there are mainline (and presumably UMC) scenarios that use large values for caution. In those cases, units retreated that were barely injured. This, again, might even be desirable for some use cases, but it needs to be decoupled from the other uses of caution. Thus, the new 'retreat_factor' aspect is used now.

In addition, the calculation is now based on a unit's maximum hitpoints, rather than its level.
2021-02-26 06:49:37 -08:00
mattsc
efe5a4d497 Add new AI aspect retreat_factor 2021-02-25 20:25:16 -08:00
Celtic Minstrel
1ff1ada25c Don't refresh addon cache if running without addons
This allows WML unit tests to be successfully run locally even if you have a local addon that does not have an _info.cfg or _server.pbl.
2021-02-24 20:19:13 -05:00
Steve Cotton
c46a2171f2 Improve the Load dialog's UX when there are no save files or corrupted files
Re-add the popup that appears when "Load" is pressed on the title screen if
there are no files, but now check for files from previous versions too.

Improve handling of switching from a version with files to a version without
files, disabling buttons on the load dialog when there are no files in the
current directory. Versions with no files will still be shown in the drop-down.

This adds a todo about the error path at the start of evaluate_summary_string,
this path is reached by creating empty files in the save dir. The dialog's state
is reasonable, so it seemed a low priority and I don't want to introduce new
bugs by refactoring this path now.

Deleting all files now doesn't automatically close the dialog.
2021-02-24 21:18:48 +01:00
Pentarctagon
6c980d12dc Clear the list of scenario content before getting the next list of content.
Otherwise each scenario keeps appending additional and usually duplicate content being sent to the server.
2021-02-23 22:11:22 -06:00
Pentarctagon
387f4ae448 Don't return a replay URL for private games.
The URL wouldn't work anyway.
2021-02-23 22:11:22 -06:00