Commit graph

128 commits

Author SHA1 Message Date
Severin Glöckner
6da85e9042 switch from map_data to map_file in SP 2019-10-02 02:54:25 +02:00
Steve Cotton
06dd9a140c Add [find_path] option "nearest_by", and simple_find_path test
Adding this is issue 2 of #4177, changing the behavior when [find_path]
is given a SLF which matches multiple hexes.

The map and tests here should be easy enough for manually editing them. It
duplicates some of the functionality of the existing characterize_pathfinding
tests, however those tests need their expected values to be calculated and
can't be changed by hand.

'''nearest_by''': {DevFeature1.15|2} possible values "movement_cost"
(default), "steps", "hexes". If the [destination] SLF matches multiple hexes,
the one that would need the least movement points to reach may not be the one
that's closest as measured by '''hexes''', or closest as measured by steps,
from the starting point.

Behavior in 1.14 depended on which hex was checked first.
2019-09-11 11:17:56 +02:00
Steve Cotton
1c123fb3fa Allow '1-infinity' in ranges, and tighten the schema's validation of ranges
Fixes #4253.

The schema's validation of ranges now rejects negative numbers, because the C++
code doesn't support them (both before and after this commit):
* utils::parse_range("-7") will return {0,0}, because std::stoi("") throws invalid_argument.
* src/map/location.cpp will parse it as -7, but that will never match an on-map coordinate
2019-08-29 22:28:22 +02:00
FranPrin
4819846910 Dunefolk faction rework by various people
Changelog provided by @ghype below. Additional credits at the end.
=================================================================================================

*Art*
Most of units were reworked - some more some less - but our goal was to make them fit for mainline all together.
If any changes are needed to any unit, then we gladly execute those. There have been months worth of progress
documented in the according art thread for this project.

Base Units: https://forums.wesnoth.org/viewtopic.php?f=9&t=49075
Extra Units: https://forums.wesnoth.org/viewtopic.php?f=9&t=49625

*Balance*
The main reason why this project started in the first place. Here as well we have all the progress for balancing
Dunefolk documented and all developers and users interested in this project and seemed to agree on the current
state of balance. Thats the reason why we will not enlist all the changes here. If there are any problems with
the balance, then we too are willing to provide alternatives that can be discussed either here or on forum.

Balance Thread: https://forums.wesnoth.org/viewtopic.php?f=15&t=49627

*Alignment*
The balance of this faction was based on the newly proposed liminal alignment which works as +0/+0/+25/+0/+0/+25
instead of the old -25/-25/+0/-25/-25/+0

*Weapon Portraits*
As Dunefolk features entirely new units, we found some weapon portraits that fits the attacks of certain units.
The portrait - called „blade-curved“ is a franken but a convincing one. As the current blow pipe for UtbS is a
franken as well, this new weapon portrait should good enough to be mainlined as well. If this request get’s denied,
then we are free to provide alternatives as well. It just fits very well the theme of exotic Naga weapon
craftsmanship without relying on the orcish theme. It used for the following two units:

Lv2 Naga Bladewhirler
Lv3 Naga Dervish

*Descriptions*
New unit concepts require changes and new units require entirely new descriptions. We enlisted all problems and
inconsistencies that resulted with the rework and provided either solutions for them or new descriptions. Yumi
already started doing them but for those who want to see the initial conflicts, here you can find all the problems
displayed:

Unit Descriptions: https://forums.wesnoth.org/viewtopic.php?f=32&t=49867#p642698

*Female Dunefolk Names*
With the introduction of female units to this faction, we would require female names as well. Apparently this was
already coded in mainline, but simple not used.

*Future Plans - Animations*
There are some recourses from past works that allow us to - more or less - easily animate most of Dunefolk units.
The animations range from idle to attack-only, while other units will be fully animated. Some of the units that
are harder to animate will first receive single attack/defend frames until animation concepts were agreed upon.
Our goal is to make Dunefolk as alive as possible.

*Future Plans - Theme, Sound FX*
Rather unimportant to most people but I am interested to add some new sound fx that can start with different hit/death
sounds or new weapon sounds for scimitars. Those are just example and I do not know what I will end up with. But I know
that I will compose a Dunefolk Theme at some point. Using your feedback, I am sure I can manage to create something that
fits the faction the best.

*Future Plans - Wyvern Rider*
This is the only unit is the only one that did not get touched or reworked. The wyvern on it self looks amazing an does
not need any rework but the rider does not really fit thematically anymore, not to mention the weapon is too oversized
and not the usual Wesnoth style. But I won’t touch this sprite until it actually will be needed, most likely - IF -
there is ever going to be a mainline Dunefolk campaign.

*Credits*
I don’t know how detailed you need this to be but here all contributors.
ghype, Hejnewar, Krogen, The_Gnat, Lordlewis, EarthCake, Tom_Of_Wesnoth

It is however important to mention that the amount of contributions of each varies a lot in different categories. I will
organise it a bit and you make use of this info how ever you want. The names are in order of the amount of work put in.

Art: ghype, The_Gnat, Lordlewis
Balance: Hejnewar, Krogen, ghype, The_Gnat
Descriptions: Tom_Of_Wesnoth, Hejnewar

Earthcake joined us in the end and helped us finishing this project by cleaning/finishing the codes and doing all the git
stuff together with The_Gnat. Although none of his work can be categorised in one of the three categories, he still deserves
to be credit in one way or another.

Thanks for your time and efforts.
2019-08-11 07:02:58 +11:00
Steve Cotton
358f564301 Add unit tests for movement and vision costs
Includes changing the terrain costs, and aliased terrains.

Can be cleanly cherry-picked to 1.14.
2019-07-22 17:18:20 +02:00
Jyrki Vesterinen
81d0d2214a Lua API: Allow WML tags with leading underscore (#3877)
@gfgtdf said that it's more consistent to allow them across the board,
which IMHO is a strong enough argument for the API change in master.
2019-01-19 15:02:10 +02:00
mattsc
afb394c4b1
Merge pull request #3723 from mattsc/rca_ai_changes
Default AI changes
2018-12-02 08:42:42 -08:00
pentarctagon
7034c8f97b Run WML schema validation in travis. Fixes #3709
This adds running the WML schema validation in travis.  It also updates the schema itself and fixes a few WML errors so that core and all campaigns under all difficulties pass the schema validation.
2018-11-24 10:35:22 -06:00
mattsc
f901a0fd81 Unit tests: change attack_depth to leader_value for aspect tests
attack_depth has been removed
2018-11-16 06:48:01 -08:00
Celtic Minstrel
639787e1c9 Merge pull request #2562 from wesnoth/schema 2018-11-11 13:52:19 -05:00
Toom
53be0fef39 Add WML unit test for unupgradable (#3336)
* Add WML unit test for unupgradable

* Follow [do_command] requirements

(cherry picked from commit 739df85e1d)
2018-10-28 02:53:08 +00:00
josteph
2f266dde90 Add test for #3663 2018-10-27 20:40:03 +00:00
Celtic Minstrel
8b9d317d72 WML Unit Tests: Fix issues found by the schema validator
With this, the WML unit tests are as clean of schema errors as they can get
The two remaining errors are unit tests for dealing with invalid input,
so they are intentionally violating the schema.
2018-10-23 22:49:45 -04:00
josteph
00c2ed6aa9 Healing: Perform rest healing on turn 2. 2018-10-21 17:35:59 +00:00
josteph
2f62302dc7 Healing: Add a unit test. 2018-10-21 17:34:52 +00:00
Jyrki Vesterinen
21999b1fc9 Extend the first CVE-2018-1999023 unit test to also try loadstring()
Like @gfgtdf pointed out, loadstring() is still supported by Lua in the
name of backwards compatibility, even though it was deprecated in Lua 5.2
and is no longer mentioned in Lua manual. Thus, as of committing this it's
actually possible to load Lua bytecode.

Let's unit test this to ensure that we don't reintroduce this
vulnerability.

(cherry-picked from commit aa73b83600)
2018-10-07 03:23:50 +00:00
Jyrki Vesterinen
81d6970195 check_utf8.sh: don't check the Lua bytecode file
This avoids one of the two files which are currently causing macOS SCons
builds to fail in the master branch.

(cherry-picked from commit 8dc60ae98f)
2018-10-07 03:23:46 +00:00
gfgtdf
a414703946 wml test for cve-2018-1999023
this test whether we succesfully prevent the exceution and parsing of
precompiled lua chunks, which can be used to break the lua sandbox.
This test does not cover all affected functions in particular not the ai
code that loads lua chunks.

(cherry-picked from commit 6b13a63bb0)
2018-10-07 03:23:46 +00:00
gfgtdf
2709456d2f disallow attacking with disabled attacks via [do_command]
this fixes some rare cheats in mp.

(cherry-picked from commit 26b5ca55e4)
2018-10-07 03:23:03 +00:00
mattsc
841e5c6b06 Replace remaining uses of FOREACH macro
(cherry-picked from commit 66b9e11a2d)
2018-10-07 03:21:12 +00: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
f48f566afd Lua code: replace deprecated helper.[gs]et_variable_array() calls
(cherry-picked from commit 3c792fc7d7)
2018-10-07 03:21:09 +00:00
mattsc
a0decde7b9 Lua code: replace deprecated wesnoth.get_all_vars() calls
(cherry-picked from commit 64f7ad2560)
2018-10-07 03:21:08 +00:00
mattsc
0e017d9f7c Lua code: replace deprecated wesnoth.set_variable() calls
(cherry-picked from commit ce7faae4f4)
2018-10-07 03:21:07 +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
Celtic Minstrel
1123c8a707 Remove some uses of set_wml_tag_metatable
(cherry-picked from commit 3939c332b9)
2018-10-07 03:18:29 +00:00
Charles Dang
0cb9f0d622 Data/Test: wmlindent run
[ci skip]

Addresses some of the whitespace issues mentioned in #2613
2018-03-09 11:22:00 +11:00
Jyrki Vesterinen
4500fa6412 Add a unit test to ensure that Lua API rejects dollar signs in tag names 2018-02-10 08:54:23 +02:00
Matthias Krüger
b11d3fdcbe fix a bunch of typos found by codespell in data directory.
https://github.com/lucasdemarchi/codespell
2018-02-06 23:03:06 +11:00
Jyrki Vesterinen
1386e3945c Added unit tests about which WML tag names Lua API accepts 2018-01-17 23:23:13 +02:00
Charles Dang
8ae99bc86a Added some event unit tests by @Pentarctagon
Tests event execution order and events with variable names.
2018-01-11 13:12:28 -05:00
Gregory A Lundberg
eaccef65f8 Add WML unit tests for [for] tag 2017-06-21 21:18:24 -05:00
Celtic Minstrel
b6eedd3df6 Allow launching test scenarios from the titlescreen
Unit test scenarios are excluded. There is no button and no default hotkey.
2017-05-04 19:20:44 -04:00
Celtic Minstrel
8d4cf3cf62 Shorten requires where possible 2017-05-03 02:42:25 -04:00
Jyrki Vesterinen
0fe2fd4c00 Fix the modify_ai_change_default_facet unit test
The test changes the default facet, which takes effect only if no other
facet takes priority. Thus, in turns 7 and 8, the test should expect attack
depth of 7, not 8.

Thanks to @CelticMinstrel for help.
2017-03-02 19:44:50 +02:00
Celtic Minstrel
4e7a2072f0 Fix a unit test still using experimental syntax 2017-02-28 14:11:45 -05:00
Gregory A Lundberg
f4e2cc6681 Fix a unit test
For some reason the macro RESULT causes the test to crash Lua.

Don't see why. Don't know why this fixes it. But this gets the tests working.
2016-10-18 09:01:45 -05:00
Spixi
5588642c81 Allow firing an event by id instead of name. 2016-07-23 12:23:19 +02:00
gfgtdf
68e5e7d7dc fix travis tests 2016-05-20 15:36:51 +02:00
Celtic Minstrel
106f1510d3 Fix unit test 2016-03-24 12:59:59 -04:00
Celtic Minstrel
cb0fad078a WML unit tests for simple aspects 2016-03-22 07:22:22 -07:00
Celtic Minstrel
240b5f61a7 Output formula errors in unit filters to WML error stream
(And consider them to match no units)
2016-03-17 23:27:03 -04:00
Celtic Minstrel
26a2638f2c Make the formula and Lua views of a unit coincide more closely
Several keys were either missing or misnamed in the formula view.
These have been changed to match the Lua and WML names for the keys.
This affects canrecruit, moves, and max_moves, as well as status.

In addition, a large number of keys were missing entirely from the formula view.
Most of these keys have now been added and can be accessed from formulas.
A few that have little use in filters (such as image_mods or profile) are still missing.

The Lua view missed a few keys that the formula view did provide.
Although these could in principle have been obtained by using the special __cfg key,
they have now been added to the Lua view anyway.
2016-03-17 23:27:03 -04:00
Celtic Minstrel
64ddd50895 Fix [for] loop not iterating the correct number of times
(when the array length changes during the loop)
2015-12-29 23:40:36 -05:00
gfgtdf
7f13156c28 Revert "Rename team_name/user_team_name to team_id/team_name (old syntax still valid)"
And related commits.

This reverts commit 545253ec2b.
This reverts commit 1215f65eb8.
This reverts commit 11664f4024.
This reverts commit e948df3424.
This reverts commit 3781e7839f.

This commits were reverted to exclude them from wesnoth 1.13.2 release because:
1) We are still unsure about the best name oftthese attributes
2) This breaks multiple campaigns, including LoW and the tutorial.
Feel free to revert this revert after 1.13.2 when thse issues can be solved..
2015-12-10 21:29:52 +01:00
gfgtdf
0241f5687e fix failing lua_get_sides test 2015-12-09 02:26:39 +01:00
aquileia
88d4c15c87 Exclude test strings from gettext 2015-12-02 00:37:14 +01:00
Charles Dang
e948df3424 Updated unit tests to use new team id/name syntax 2015-10-26 13:40:44 +11:00
Celtic Minstrel
f224e2a073 Fix WML unit tests 2015-10-07 20:09:57 -04:00