DM S20: Improve leveling of units and give player a note about it

Fixes #4219
This commit is contained in:
sigurdfdragon 2019-08-17 14:16:07 -04:00
parent e761acbaa4
commit c75e33246e
2 changed files with 28 additions and 15 deletions

View file

@ -137,6 +137,10 @@
bonus=yes
carryover_percentage=80
[/gold_carryover]
[note]
description=_ "As a generation has passed, all your elvish units have gained a level and some experience."
[/note]
[/objectives]
[/event]

View file

@ -535,12 +535,24 @@
race=elf
[/not]
[/kill]
[modify_unit]
[filter]
side=1
[/filter]
type=""
[/modify_unit]
[lua]
code=<<
local helper = wesnoth.require "helper"
local units = wesnoth.get_units( { side = 1 } )
for i = 1, #units do
-- pick an advancement randomly, and remove others so advance() doesn't show the dialog
if units[i].advances_to[1] ~= nil then
local r = wesnoth.random ( 1, #units[i].advances_to )
local t = { }; t[1] = units[i].advances_to[r]
units[i].advances_to = t
end
-- level the unit and give it a random amount of experience up to half of max
units[i].experience = units[i].max_experience
units[i]:advance( )
units[i].experience = wesnoth.random ( 0, helper.round( units[i].max_experience / 2 ) )
end
>>
[/lua]
[heal_unit]
[filter]
side=1
@ -551,15 +563,12 @@
restore_attacks=yes
restore_statuses=yes
[/heal_unit]
[modify_unit]
[filter]
side=1
[not]
id=Kalenz,Chantal
[/not]
[/filter]
x,y=recall,recall
[/modify_unit]
[put_to_recall_list]
side=1
[not]
id=Kalenz,Chantal
[/not]
[/put_to_recall_list]
#Lowel and Eldred are the enemy humans when this fires
[kill]
race=human