Commit graph

189 commits

Author SHA1 Message Date
jostephd
3a3b752881 WML: Support [filter_side] in [item]. (#3533)
* WML: Support [filter_side] in [item].

If [filter_side] is present then "team_name" is ignored.

Fixes #1477.

* WML: Compare [item]team_name to [side]team_name using intersection.

Fixes problems with substrings and when one or the other is a
comma-separated list. See #3533

* WML: Rename [item][filter_side] to [item][filter_team]

* Add changelog entry
2018-09-21 21:11:08 -04:00
gfgtdf
3591e82586 add game_config.combat experience
and make [harm_unit] use these values instead of hardcoded 8*level for
killing and level for combat.
2018-09-10 22:09:50 +02:00
newfrenchy83
7d6e2b2a10 Lua API: implicitly clear animator after playing it (#3536)
This prevents the animator from holding a strong reference to the target unit, which was keeping the unit object alive and thus preventing the unit halo, if any, from disappearing.
2018-09-09 18:47:56 +03:00
newfrenchy83
3541629197 [heal_unit]: clear the animation after playing it (#3526)
Fixes another case of unit halo remaining after death.
2018-09-07 19:35:39 +03:00
Jyrki Vesterinen
e63bd35f9d [animate_unit]: clear the animation after playing it
This avoids a reference to the unit from being leaked, which prevented the
unit's halo (if any) from disappearing when the unit died.

Fixes #3509. Closes #3520.
2018-09-06 20:16:00 +03:00
josteph
045d331da8 WML: Don't add a \n before condition=lose objectives if there are no objectives listed before them. 2018-07-05 12:46:44 +11:00
Andras Szell
1ea4149a44 Fix: add redraw to narrator's message so village count is refreshed
Fixes: https://forums.wesnoth.org/viewtopic.php?f=21&t=48370

In the tutorial when we occupy the first village the message tells us the
village count got incremented, but in the old version it was incremented
only afterwards. Non-narrator messages were updated properly. By adding the
redraw, narrator messages triggered by capture event produce the same
result as other speakers.
2018-06-26 18:45:17 +11:00
Iris Morelle
051182fa1c Fall back to the unit type name for [message] captions for nameless units
Fixes #3211.
2018-06-05 04:44:28 -04:00
Iris Morelle
4e37cdc713 Don't allow [kill] animate=yes to scroll to units through fog and shroud
Restores 1.12's behaviour.
2018-06-04 16:15:37 -04:00
Iris Morelle
8ae38ac19f Do not allow [message] to scroll to units through fog/shroud
This was a regression from 1.12.
2018-05-21 23:23:06 -04:00
Celtic Minstrel
4a3508f13f
Support [break], [continue], and [return] in [random_placement] 2018-05-19 00:42:23 -04:00
mattsc
ce7faae4f4 Lua code: replace deprecated wesnoth.set_variable() calls 2018-05-13 20:35:20 -07:00
mattsc
f1764d182f Lua code: replace deprecated wesnoth.get_variable() calls 2018-05-13 20:03:34 -07:00
mattsc
138107c8f6 Lua code: replace deprecated wesnoth.tovconfig() calls 2018-05-13 19:54:14 -07:00
Celtic Minstrel
07e465e57b Support male_voice and female_voice in [message] 2018-04-28 23:09:29 -04:00
Jyrki Vesterinen
76ed49a45f [heal_unit]: ensure that heal amount is an integer 2018-04-16 20:55:23 +03:00
Jyrki Vesterinen
f2284e2e79 Revert "Display amount healed as an integer in [heal_unit]"
This reverts commit 0294bd81b2.

Changing display is unnecessary when the healed amount itself is forced
to be an integer (next commit).
2018-04-16 20:54:20 +03:00
Celtic Minstrel
0294bd81b2
Display amount healed as an integer in [heal_unit] 2018-04-16 01:27:12 -04:00
Celtic Minstrel
b062b19e10 Add [move_unit]clear_shroud= as an attempt to clear shroud as the unit moves (untested) 2018-04-11 22:46:48 -04:00
Celtic Minstrel
68b33cf6bd Allow [move_unit]dir= to perform relative movements 2018-04-11 22:46:48 -04:00
Celtic Minstrel
622db9d08b Allow [move_unit]to_location to take a list of waypoints 2018-04-11 22:46:48 -04:00
gfgtdf
0f756b8189 fix [message] side_for= not working for the last side.
fixes #2776
2018-04-05 10:39:52 +11:00
Celtic Minstrel
ea0bcec92f Support facing in [role][auto_recall] 2018-03-30 18:39:11 -04:00
Celtic Minstrel
7a3d6f958a Support root=cube and root=int in [set_variable] 2018-03-30 18:38:47 -04:00
Celtic Minstrel
15ae9fcb0c Use wesnoth.format instead of string.format for translateable strings in [objectives] 2018-03-30 18:38:37 -04:00
Celtic Minstrel
c835e5b7e6 Nicer handling of some Pango formatting attributes in [message] 2018-03-30 18:38:25 -04:00
Celtic Minstrel
2bd2a8b1b6 Handle speaker=id directly in [message] instead of relying on SUF 2018-03-30 18:38:03 -04:00
Celtic Minstrel
beb5dc75aa Support [set_variable]round=trunc 2018-03-30 18:37:39 -04:00
Celtic Minstrel
79bc18fe95
Fix unintended change to the semantics of [modify_side]income= 2018-03-30 11:05:31 -04:00
Celtic Minstrel
229d2f0483 Allow percentages in [random_placement]num_items= 2018-03-25 20:56:11 -04:00
Celtic Minstrel
e4a2c14177 Allow WFL for [random_placement]num_items= 2018-03-25 20:51:03 -04:00
Celtic Minstrel
4427ee1936
Fix typo in 1dd411a84e 2018-03-25 19:52:22 -04:00
Celtic Minstrel
1dd411a84e Support to_location in [move_unit] 2018-03-24 18:32:10 -04:00
Celtic Minstrel
a314876bf2 Use new persistent tags interface for [object] [objectives] [item] 2018-03-17 17:16:23 -04:00
Celtic Minstrel
08ec9017b5 Lua API: Some tweaks of the experimental wml module 2018-03-17 16:48:00 -04:00
Charles Dang
0103959c36 Cleaned up deprecated API usage in core Lua
[ci skip]
2018-03-13 16:55:36 +11:00
Charles Dang
3489dac642 [heal_unit]: don't play healed animation if no healing is done
[ci skip]

Addresses #2530. Not closing that though, since the behavior might still be tweaked.

The healer will still play their own animation, if applicable (behavior option 2 in
the bug report).
2018-03-05 15:44:42 +11:00
Celtic Minstrel
aa0a3bebd1 Add suffix= and prefix= operations to [set_variable] 2018-03-04 22:03:16 -05:00
Celtic Minstrel
5fc9d8d173 Use new deprecated_message() function wherever possible (C++)
This also covers handling of legacy DescriptionWML for [set_menu_item],
and tweaks its handling in the other cases (mainly [multiplayer_side]).

I added the next_dev_version constant intending to use it, but then
decided not to do so; however I left it in in case someone finds it useful.
2018-03-04 21:21:33 -05:00
Celtic Minstrel
29942eec35 Expose side_name attribute to Lua API and [modify_side] 2018-02-18 12:53:00 -05:00
Charles Dang
c8abb8d5d9 Add formula= option to [set_variable] (change by @celticminstrel)
[ci skip]
2018-02-02 15:40:44 +11:00
vgaming
728204665c fix code problems found by luacheck (#2388)
fix code problems found by luacheck

Second iteration of the process, now handling data/lua/wml/*.lua

luacheck command used to find bugs:
  luacheck ./*.lua --globals wesnoth wml --codes --ignore 542 213
Additionally, error code 211 (unused variables) could be ignored,
as using underscore convention `_` is controversial in
wesnoth ( see https://github.com/wesnoth/wesnoth/pull/2380#discussion_r162519341 )

Actual bugs found:
* items.lua, access of global `write_name` instead of local `cfg.write_name`
* kill.lua, typo `primary_unit` -> `primary`
* bad code style: global `i` instead of local `i`
  (would conflict with 3-rd party code if it would use global `i`, too)
2018-01-23 13:35:04 -06:00
Jyrki Vesterinen
d81f230680 Clear unit death animation after killing the unit
This is another and much better way to fix the unit halo remaining.
2017-12-28 12:02:29 +02:00
Jyrki Vesterinen
f50c7d3f2a Revert "Work around unit halo not disappearing with [kill] animate=yes"
This reverts commit 70b468070b.

As I said in the commit message, the fix is not pretty, and
@CelticMinstrel said in IRC that a different fix would definitely be
better. I'll fix the problem by having an animation automatically
release the unit when done, instead (next commit).
2017-12-28 11:48:12 +02:00
Jyrki Vesterinen
70b468070b Work around unit halo not disappearing with [kill] animate=yes
The problem was that the kill animation retained a reference to the unit.
Triggering a Lua garbage collection (which destroys the animation object)
fixes it, although it's definitely not a pretty fix.

Closes pull request #2313.
2017-12-25 18:35:01 +02:00
Jyrki Vesterinen
e0e59ac463 Fix exception when [harm_unit] is used without an attacking unit
Regression from commit 38e31aa61f.
In particular, it broke WML unit tests.
2017-12-21 20:24:48 +02:00
Gregory A Lundberg
38e31aa61f Do not access non-existent unit
The [kill] tag can run animations. But it can also fire the `last breath` event, which can call [kill]. When we get back to the original [kill], the unit is gone, causing an error attempting to run the animations.

Added a check to ensure the unit is still on the map before we attempt to run the animations.

The Issue also requested that [harm_unit] pass the unit causing the harm into the [kill] tag so that `last breath` could use the secondary (killing) unit available like it does elsewhere.

Closes #2298
2017-12-19 15:05:24 -06:00
Jyrki Vesterinen
f064f50f1b [heal_unit]: Turn on floating text with animate=yes
I also moved the animation to be played *before* healing, which is the same
order as in C++ code. In the previous order, the animation isn't played for
some reason.

Fixes #2295.
2017-12-18 23:28:45 +02:00
Jyrki Vesterinen
d80d47eb8a [heal_unit]: fix wrong value of "hits" parameter
Only "hit", "miss" and "kill" are allowed.
2017-12-18 22:04:35 +02:00
sigurdfdragon
23c23b7a55 WML: Add [show_if] usage in [objectives] subtag [gold_carryover] 2017-11-22 20:27:13 -05:00