Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wesnoth/wesnoth
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Oct 13, 2020
2 parents 555d8b6 + 1bae9d7 commit 0069942
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 116 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@
* All other dialog functions (such as wesnoth.get_dialog_value and wesnoth.set_dialog_value) are now deprecated.
### Miscellaneous and Bug Fixes
* Removed font-analysis utils: codecomp codeextract codeglyphs codelist
* [harm_unit] now calculates liminal damage by using the 1.15 algorithm
### Terrain
* New wall variation: Overgrown stone walls ('Xof')
### WML Engine
* Fix a bug with [set_variables][join] failing on boolean (yes/no) values

## Version 1.15.5
### Add-ons client
Expand Down
205 changes: 94 additions & 111 deletions data/campaigns/Secrets_of_the_Ancients/utils/zombie-utils.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,81 +13,97 @@
#define ZOMBIE_INIT
[event]
name=prestart
#wmllint: markcheck off
# TODO: Most of the sota_variation strings could probably reuse race names from core and just add the parentheses in the Lua code
# sota_variation will be used in the zombie recruit dialog
[set_variables]
name=zombies
[split]
list="SotA Flying Corpse_Bat,
SotA Walking Corpse_Rat,
SotA Walking Corpse_Wolf,
SotA Walking Corpse_Human,
SotA Walking Corpse_Mounted,
SotA Walking Corpse_Wolf Rider,
SotA Swimming Corpse,
SotA Walking Corpse_Saurian,
SotA Walking Corpse_Wose,
SotA Walking Corpse_Goblin,
SotA Flying Corpse_Gryphon,
SotA Walking Corpse_Spider,
SotA Walking Corpse_Troll,
SotA Walking Corpse_Dwarf"
key=type
separator=","
[/split]
[/set_variables]
# This string will be used in the zombie recruit dialog box.
[set_variables]
name=zombies
mode=merge
[split]
list= _ "(Bat),
(Rat),
(Wolf),
(Human),
(Mounted),
(Wolf Rider),,
(Saurian),
(Wose),
(Goblin),
(Gryphon),
(Spider),
(Troll),
(Dwarf)" # po: The extra comma after (Wolf Rider) is for the swimming corpse. Since there is only one of those, it would be redundant to label it in English. You can add (Swimmer) before the second comma if it makes more sense in your language to do so. Be careful not to delete any commas!
key=sota_variation
separator=","
[/split]
[/set_variables]
[set_variables]
name=zombies
mode=merge
[split]
list= _ "You can now raise bat corpses!,
You can now raise rat corpses!,
You can now raise wolf corpses!,
You can now raise human corpses!,
You can now raise mounted corpses!,
You can now raise wolf rider corpses!,
You can now raise swimming corpses!,
You can now raise saurian corpses!,
You can now raise wose corpses!,
You can now raise goblin corpses!,
You can now raise gryphon corpses!,
You can now raise spider corpses!,
You can now raise troll corpses!,
You can now raise dwarf corpses!" # po: Be careful not to delete any commas!
key=allow_recruit_message
separator=","
[/split]
[/set_variables]
[set_variables]
name=zombies
mode=merge
[split]
# The player starts out with no zombies available.
list="no,no,no,no,no,no,no,no,no,no,no,no,no,no"
key=allow_recruit
separator=","
[/split]
[value]
type=SotA Flying Corpse_Bat
sota_variation= _ "(Bat)"
allow_recruit_message= _ "You can now raise bat corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Rat
sota_variation= _ "(Rat)"
allow_recruit_message= _ "You can now raise rat corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Wolf
sota_variation= _ "(Wolf)"
allow_recruit_message= _ "You can now raise wolf corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Human
sota_variation= _ "(Human)"
allow_recruit_message= _ "You can now raise human corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Mounted
sota_variation= _ "(Mounted)"
allow_recruit_message= _ "You can now raise mounted corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Wolf Rider
sota_variation= _ "(Wolf Rider)"
allow_recruit_message= _ "You can now raise wolf rider corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Swimming Corpse
sota_variation= _ "(Merfolk)"
allow_recruit_message= _ "You can now raise merfolk corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Saurian
sota_variation= _ "(Saurian)"
allow_recruit_message= _ "You can now raise saurian corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Wose
sota_variation= _ "(Wose)"
allow_recruit_message= _ "You can now raise wose corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Goblin
sota_variation= _ "(Goblin)"
allow_recruit_message= _ "You can now raise goblin corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Flying Corpse_Gryphon
sota_variation= _ "(Gryphon)"
allow_recruit_message= _ "You can now raise gryphon corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Spider
sota_variation= _ "(Spider)"
allow_recruit_message= _ "You can now raise spider corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Troll
sota_variation= _ "(Troll)"
allow_recruit_message= _ "You can now raise troll corpses!"
allow_recruit=no
[/value]
[value]
type=SotA Walking Corpse_Dwarf
sota_variation= _ "(Dwarf)"
allow_recruit_message= _ "You can now raise dwarf corpses!"
allow_recruit=no
[/value]
[/set_variables]
#wmllint: markcheck on
[/event]
#enddef

Expand All @@ -104,47 +120,14 @@
# This macro saves the currently recruitable zombies into a string that can be used in a
# [set_variables] statement later to restore the list. (LOAD_ZOMBIE_LIST does that.)
#define SAVE_ZOMBIE_LIST VARIABLE
[foreach]
array=zombies
[do]
[if]
[variable]
name=this_item.allow_recruit
boolean_equals=yes
[/variable]
[then]
[set_variable]
name={VARIABLE}
value=${VARIABLE}| + "yes,"
[/set_variable]
[/then]
[else]
[set_variable]
name={VARIABLE}
value=${VARIABLE}| + "no,"
[/set_variable]
[/else]
[/if]
[/do]
[/foreach]
# Remove the trailing comma from the string.
[set_variable]
name={VARIABLE}
value="$(substring( '${VARIABLE}', 0, (length('${VARIABLE}')-1) ))"
name=ardonna_zombies
[join]
variable=zombies
key=allow_recruit
separator=","
[/join]
[/set_variable]

# This *should* work, but doesn't as of 1.14.5. It causes a lua error because of
# concatenation of a boolean, presumably because the strings are all either
# "yes" or "no". If that changes, this code can be uncommented, and the code
# above removed.
# [set_variable]
# name=ardonna_zombies
# [join]
# variable=zombies
# key=allow_recruit
# separator=","
# [/join]
# [/set_variable]
#enddef

#define LOAD_ZOMBIE_LIST VARIABLE
Expand Down
8 changes: 4 additions & 4 deletions data/lua/wml/harm_unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function wml_actions.harm_unit(cfg)
elseif alignment == "chaotic" then
damage_multiplier = damage_multiplier - tod_bonus
elseif alignment == "liminal" then
damage_multiplier = damage_multiplier - math.abs( tod_bonus )
damage_multiplier = damage_multiplier + math.max(0, wesnoth.get_max_liminal_bonus() - math.abs(tod_bonus))
else -- neutral, do nothing
end
local resistance_modified = resistance * modifier
Expand Down Expand Up @@ -171,10 +171,10 @@ function wml_actions.harm_unit(cfg)
and wesnoth.sides.is_enemy( unit_to_harm.side, harmer.side )
then
if kill ~= false and unit_to_harm.hitpoints <= 0 then
harmer.experience = harmer.experience + calc_xp( unit_to_harm.__cfg.level )
harmer.experience = harmer.experience + calc_xp( unit_to_harm.level )
else
unit_to_harm.experience = unit_to_harm.experience + harmer.__cfg.level
harmer.experience = harmer.experience + wesnoth.game_config.combat_experience * unit_to_harm.__cfg.level
unit_to_harm.experience = unit_to_harm.experience + harmer.level
harmer.experience = harmer.experience + wesnoth.game_config.combat_experience * unit_to_harm.level
end
end

Expand Down
11 changes: 10 additions & 1 deletion data/lua/wml/set_variable.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,16 @@ function wesnoth.wml_actions.set_variable(cfg, variables)
if #string_to_join > 0 then
string_to_join = string_to_join .. separator
end
string_to_join = string_to_join .. element[key_name]
local elem = element[key_name]
if type(elem) == 'boolean' then
-- Use yes/no instead of true/false for booleans
elem = elem and 'yes' or 'no'
elseif getmetatable(elem) ~= 'translatable string' then
-- Not entirely sure if this branch is necessary, since it probably only triggers for numbers
-- It certainly can't hurt, though.
elem = tostring(elem)
end
string_to_join = string_to_join .. elem
end
end

Expand Down

0 comments on commit 0069942

Please sign in to comment.