add difficulcy level slider to dark forecast mp scenario

unfortunateley the 'description' (the tooltip of the widget in the mp
configure dialog) doesn't show in current master. This is likeley to be
a bug related to gui internals.
This commit is contained in:
gfgtdf 2016-02-18 23:07:21 +01:00
parent f507418655
commit 39eb8feaf1
2 changed files with 13 additions and 1 deletions

View file

@ -234,4 +234,15 @@ The weather will also change randomly, affecting the layout of the map.
message= _ "The enemy cheers as a dark mist rises from the land, engulfing you. As ghostly wisps drain away your will, you realize that your time in this land is over."
[/message]
[/event]
[options]
[slider]
id = "enemey_gold_factor"
default = 0
min = -30
max = 30
step = 10
name = "Difficulty"
description = "Changes the gold worth of the enemy spawns by a certain perentage"
[/slider]
[/options]
[/multiplayer]

View file

@ -100,6 +100,7 @@ end
-- @a base_gold_amount, gold_increment: used to cauculate the amount of gold available for each timed spawn
-- @a units_amount, gold_per_unit_amount: used to cauculate the number of units spawned in each timed spawn
local function create_timed_spaws(interval, num_spawns, base_gold_amount, gold_increment, units_amount, gold_per_unit_amount)
local configure_gold_factor = (wesnoth.get_variable("enemey_gold_factor") + 100)/100
local final_turn = math.ceil(((num_spawns - 1) * interval + 40 + wesnoth.random(2,4))/2)
local end_spawns = 0
for spawn_number = 1, num_spawns do
@ -128,7 +129,7 @@ local function create_timed_spaws(interval, num_spawns, base_gold_amount, gold_i
wesnoth.set_variable("timed_spawn[" .. (spawn_number - 1) .. "]", {
units = math.ceil(units),
turn = turn,
gold = gold,
gold = helper.round(gold * configure_gold_factor),
})
else
wesnoth.set_variable("timed_spawn[" .. (spawn_number - 1) .. "]", {