Merge lp:~widelands-dev/widelands/fri-01-02-improvements into lp:widelands

Proposed by Benedikt Straub
Status: Merged
Merged at revision: 8867
Proposed branch: lp:~widelands-dev/widelands/fri-01-02-improvements
Merge into: lp:widelands
Diff against target: 386 lines (+201/-12)
6 files modified
data/campaigns/fri01.wmf/scripting/mission_thread.lua (+18/-1)
data/campaigns/fri01.wmf/scripting/texts.lua (+6/-0)
data/campaigns/fri02.wmf/scripting/init.lua (+13/-0)
data/campaigns/fri02.wmf/scripting/mission_thread.lua (+62/-6)
data/campaigns/fri02.wmf/scripting/starting_conditions.lua (+46/-3)
data/campaigns/fri02.wmf/scripting/texts.lua (+56/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/fri-01-02-improvements
Reviewer Review Type Date Requested Status
hessenfarmer test Approve
GunChleoc Approve
Review via email: mp+355843@code.launchpad.net

Commit message

Various improvements to both frisian scenarios

Description of the change

fri01: The player can take some soldiers with him when he escapes from the flood.
fri02:
· 10 of the initial soldiers are chosen from the ones the player took with him
· During the expansion ban, the player can send a scout to spy on Murilius. The scout will discover a helpful hint. Two objectives remind the player of that.
· A number of other small tweaks

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4068. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/434676212.
Appveyor build 3864. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_fri_01_02_improvements-3864.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Some nits for the strings + variable names

Revision history for this message
Benedikt Straub (nordfriese) wrote :

OK, implemented your diff comments and uploaded the string changes to your localization branch

Revision history for this message
GunChleoc (gunchleoc) wrote :

Great, thanks!

Can go in once it's been tested :)

review: Approve
Revision history for this message
hessenfarmer (stephan-lutz) wrote :

Tested all 3 ways (cooperate, destroy warehouse, expand beyond limit)
everything worked fine. Got the victory message although some not useful fields were not conquered.
so this is ready from my side.

review: Approve (test)
Revision history for this message
hessenfarmer (stephan-lutz) wrote :

@bunnybot merge

Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks for testing!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/campaigns/fri01.wmf/scripting/mission_thread.lua'
--- data/campaigns/fri01.wmf/scripting/mission_thread.lua 2018-07-24 11:09:41 +0000
+++ data/campaigns/fri01.wmf/scripting/mission_thread.lua 2018-09-29 08:44:21 +0000
@@ -422,6 +422,9 @@
422 p1:allow_buildings {"frisians_port", "frisians_weaving_mill", "frisians_shipyard"}422 p1:allow_buildings {"frisians_port", "frisians_weaving_mill", "frisians_shipyard"}
423 o = add_campaign_objective(obj_escape)423 o = add_campaign_objective(obj_escape)
424424
425 sleep(30000)
426 campaign_message_box(rising_water_5)
427
425 -- Wait until an expedition ship is ready428 -- Wait until an expedition ship is ready
426 local expedition_ready = false429 local expedition_ready = false
427 while not expedition_ready do430 while not expedition_ready do
@@ -435,8 +438,22 @@
435 end438 end
436439
437 -- We escaped!440 -- We escaped!
438 scroll_to_field(p1:get_buildings("frisians_port")[1].fields[1])441 local port = p1:get_buildings("frisians_port")[1]
442 scroll_to_field(port.fields[1])
439 sleep(1000)443 sleep(1000)
444 local persist = {}
445 for descr,n in pairs(port:get_soldiers("all")) do
446 persist[descr[1] .. descr[2] .. descr[3]] = n
447 end
448 -- We save a table of all soldiers we can take with us:
449 -- {
450 -- "262" = 5,
451 -- "120" = 2,
452 -- ...
453 -- }
454 -- means 5 soldiers with training levels health-2/attack-6/defense-2 and
455 -- 2 soldiers with health-1/attack-2/defense-0.
456 wl.Game():save_campaign_data("frisians", "fri01", persist)
440 campaign_message_box(victory_1)457 campaign_message_box(victory_1)
441 p1:reveal_scenario("frisians01")458 p1:reveal_scenario("frisians01")
442 -- END OF MISSION 1459 -- END OF MISSION 1
443460
=== modified file 'data/campaigns/fri01.wmf/scripting/texts.lua'
--- data/campaigns/fri01.wmf/scripting/texts.lua 2018-07-24 11:09:41 +0000
+++ data/campaigns/fri01.wmf/scripting/texts.lua 2018-09-29 08:44:21 +0000
@@ -405,6 +405,12 @@
405 _([[The storm flood seems to be coming from the west. If we hurry, we will just make it! We only need to build a port and a shipyard – oh, and a weaving mill to weave the durable cloth, which is made from reed and fur, for the sails. Then we can launch an expedition from the port. Pray to the gods and make haste!]]))405 _([[The storm flood seems to be coming from the west. If we hurry, we will just make it! We only need to build a port and a shipyard – oh, and a weaving mill to weave the durable cloth, which is made from reed and fur, for the sails. Then we can launch an expedition from the port. Pray to the gods and make haste!]]))
406 .. new_objectives(obj_escape),406 .. new_objectives(obj_escape),
407}407}
408rising_water_5 = {
409 title =_ "Don’t Forget the Soldiers",
410 body=reebaud(_"Soldiers to the port!",
411 -- TRANSLATORS: Reebaud – rising water
412 _([[I almost forgot in this haste – whereever we will land, we’ll need soldiers to secure and expand our new colony. There’s space for up to 10 soldiers on our ship, if they don’t mind being all crammed up together. Let’s send some to the port when it’s completed, so they can embark when we set sail!]])),
413}
408414
409victory_1 = {415victory_1 = {
410 title =_ "Victory",416 title =_ "Victory",
411417
=== modified file 'data/campaigns/fri02.wmf/scripting/init.lua'
--- data/campaigns/fri02.wmf/scripting/init.lua 2018-03-01 10:06:46 +0000
+++ data/campaigns/fri02.wmf/scripting/init.lua 2018-09-29 08:44:21 +0000
@@ -8,6 +8,7 @@
8include "scripting/infrastructure.lua"8include "scripting/infrastructure.lua"
9include "scripting/table.lua"9include "scripting/table.lua"
10include "scripting/ui.lua"10include "scripting/ui.lua"
11include "scripting/messages.lua"
1112
12game = wl.Game()13game = wl.Game()
13p1 = game.players[1] -- Reebaud – player’s tribe14p1 = game.players[1] -- Reebaud – player’s tribe
@@ -17,4 +18,16 @@
17p1_start = map.player_slots[1].starting_field18p1_start = map.player_slots[1].starting_field
1819
19include "map:scripting/texts.lua"20include "map:scripting/texts.lua"
21
22total_soldiers = 25
23takeover_soldiers = 10
24campaign_data = game:read_campaign_data("frisians", "fri01")
25if not campaign_data then
26 campaign_message_box(campaign_data_warning)
27 campaign_data = {}
28 -- If he wants to cheat, let him, but give him a hard time
29 total_soldiers = 5
30 takeover_soldiers = 0
31end
32
20include "map:scripting/mission_thread.lua"33include "map:scripting/mission_thread.lua"
2134
=== modified file 'data/campaigns/fri02.wmf/scripting/mission_thread.lua'
--- data/campaigns/fri02.wmf/scripting/mission_thread.lua 2018-04-15 18:24:47 +0000
+++ data/campaigns/fri02.wmf/scripting/mission_thread.lua 2018-09-29 08:44:21 +0000
@@ -1,4 +1,3 @@
1include "scripting/messages.lua"
2include "scripting/field_animations.lua"1include "scripting/field_animations.lua"
32
4local done_mining = false3local done_mining = false
@@ -8,12 +7,16 @@
87
9local all_fields = {}8local all_fields = {}
10local mountains = {}9local mountains = {}
10local useful_fields = {}
11for x=0,map.width - 1 do11for x=0,map.width - 1 do
12 for y=0,map.height - 1 do12 for y=0,map.height - 1 do
13 local field = map:get_field(x, y)13 local field = map:get_field(x, y)
14 if field.terd:find("mountain") ~= nil then14 if field.terd:find("mountain") ~= nil then
15 table.insert(mountains, field)15 table.insert(mountains, field)
16 end16 end
17 if field:has_caps("small") or field:has_caps("mine") then
18 table.insert(useful_fields, field)
19 end
17 table.insert(all_fields, field)20 table.insert(all_fields, field)
18 end21 end
19end22end
@@ -87,7 +90,7 @@
87 end90 end
88 scroll_to_field(wh.fields[1])91 scroll_to_field(wh.fields[1])
89 sleep(3000)92 sleep(3000)
90 p2:forbid_buildings {"empire_fortress", "empire_castle", "empire_barrier", "empire_blockhouse", "empire_tower"}93 p2:forbid_buildings {"empire_fortress", "empire_castle", "empire_blockhouse", "empire_tower"}
91 p3:forbid_buildings {"barbarians_citadel", "barbarians_tower"}94 p3:forbid_buildings {"barbarians_citadel", "barbarians_tower"}
92 campaign_message_box(supply_murilius_6)95 campaign_message_box(supply_murilius_6)
93 campaign_message_box(supply_murilius_7)96 campaign_message_box(supply_murilius_7)
@@ -99,13 +102,56 @@
99 set_objective_done(o)102 set_objective_done(o)
100103
101 o = add_campaign_objective(obj_supply_murilius)104 o = add_campaign_objective(obj_supply_murilius)
105 local o_scout = add_campaign_objective(obj_scout)
106 local o_poem = nil
102 local choice = ""107 local choice = ""
108 sleep(30000) -- give the player some time to account for nearly completed buildings
103 local milbld = count_military_buildings_p1()109 local milbld = count_military_buildings_p1()
110 local scout = nil
104 while choice == "" do111 while choice == "" do
105 sleep(2791)112 sleep(791)
113
114 local milsites = count_military_buildings_p1()
115 if o_poem and milsites < milbld then
116 -- the player has dismantled a militarysite, so we assume he understood the poem
117 set_objective_done(o_poem)
118 o_poem = nil
119 end
120
121 if o_scout and not scout then
122 -- let's see if a scout is spying in Murilius's territory
123 for i,house in pairs(p1:get_buildings("frisians_scouts_house")) do
124 for j,field in pairs(house.fields[1]:region(17)) do -- the scout has a radius of 15
125 for k,bob in pairs(field.bobs) do
126 if bob.descr.name == "frisians_scout" and
127 field.owner == p2 and
128 field.brn.owner == p2 and
129 field.bln.owner == p2 and
130 field.trn.owner == p2 and
131 field.tln.owner == p2 and
132 field.rn.owner == p2 and
133 field.ln.owner == p2 then
134 scout = bob
135 break
136 end
137 end
138 if scout then break end
139 end
140 if scout then break end
141 end
142 elseif o_scout and scout then
143 if scout.field.immovable and scout.field.immovable.descr.name == "frisians_scouts_house" then
144 set_objective_done(o_scout)
145 campaign_message_box(expansion_hint)
146 o_poem = add_campaign_objective(obj_poem)
147 o_scout = nil
148 scout = nil
149 end
150 end
151
106 if #(p1:get_buildings("frisians_warehouse_empire")) < 1 then152 if #(p1:get_buildings("frisians_warehouse_empire")) < 1 then
107 choice = "destroy"153 choice = "destroy"
108 elseif count_military_buildings_p1() > milbld then154 elseif milsites > milbld then
109 -- It *is* permitted to destroy/dismantle a military building and build a new one elsewhere155 -- It *is* permitted to destroy/dismantle a military building and build a new one elsewhere
110 choice = "military"156 choice = "military"
111 else157 else
@@ -126,6 +172,13 @@
126 end172 end
127 end173 end
128 end174 end
175 -- We don’t need the scout/poem objectives anymore
176 if o_scout then
177 set_objective_done(o_scout)
178 end
179 if o_poem then
180 set_objective_done(o_poem)
181 end
129 set_objective_done(o)182 set_objective_done(o)
130 p2:allow_buildings("all")183 p2:allow_buildings("all")
131 p3:allow_buildings("all")184 p3:allow_buildings("all")
@@ -222,6 +275,8 @@
222 -- If the barbarians already defeated Murilius – well done275 -- If the barbarians already defeated Murilius – well done
223 -- Otherwise, Murilius provokes Reebaud into ordering the player to conquer his entire colony276 -- Otherwise, Murilius provokes Reebaud into ordering the player to conquer his entire colony
224 -- (merely defeating the Empire isn’t enough)277 -- (merely defeating the Empire isn’t enough)
278 -- We don't bother to check water, walkable-only and other useless terrains.
279 -- That would be really too much to ask from our poor player, now wouldn't it?
225 if not p2.defeated then280 if not p2.defeated then
226 campaign_message_box(defeat_murilius_1)281 campaign_message_box(defeat_murilius_1)
227 campaign_message_box(defeat_murilius_2)282 campaign_message_box(defeat_murilius_2)
@@ -230,7 +285,7 @@
230 local def = false285 local def = false
231 while not def do286 while not def do
232 def = true287 def = true
233 for idx,field in ipairs(all_fields) do288 for idx,field in ipairs(useful_fields) do
234 if field.owner == p2 then289 if field.owner == p2 then
235 def = false290 def = false
236 break291 break
@@ -271,8 +326,9 @@
271 place_building_in_region(p3, "barbarians_metal_workshop", p1_start:region(7))326 place_building_in_region(p3, "barbarians_metal_workshop", p1_start:region(7))
272 place_building_in_region(p3, "barbarians_well", p1_start:region(7))327 place_building_in_region(p3, "barbarians_well", p1_start:region(7))
273 place_building_in_region(p3, "barbarians_rangers_hut", p1_start:region(7))328 place_building_in_region(p3, "barbarians_rangers_hut", p1_start:region(7))
274 reveal_concentric(p1, p1_start, 9, true, 100)329 reveal_concentric(p1, p1_start, 10, true, 100)
275 scroll_to_field(p1_start)330 scroll_to_field(p1_start)
331 sleep(2000)
276 campaign_message_box(intro_2)332 campaign_message_box(intro_2)
277 include "map:scripting/starting_conditions.lua"333 include "map:scripting/starting_conditions.lua"
278 sleep(5000)334 sleep(5000)
279335
=== modified file 'data/campaigns/fri02.wmf/scripting/starting_conditions.lua'
--- data/campaigns/fri02.wmf/scripting/starting_conditions.lua 2018-05-23 05:13:49 +0000
+++ data/campaigns/fri02.wmf/scripting/starting_conditions.lua 2018-09-29 08:44:21 +0000
@@ -61,7 +61,50 @@
61 frisians_reindeer = 1,61 frisians_reindeer = 1,
62 frisians_charcoal_burner = 362 frisians_charcoal_burner = 3
63}63}
64port1:set_soldiers({0,0,0,0}, 25)64
65local trained = 0
66for descr,n in pairs(campaign_data) do
67 if descr ~= "000" then
68 trained = trained + n
69 end
70end
71local soldiers = {}
72if trained > takeover_soldiers then
73 -- We have more soldiers than allowed, so pick 10 at random
74 local remaining = takeover_soldiers
75 repeat
76 local key1 = math.random(0, 2)
77 local key2 = math.random(0, 6)
78 local key3 = math.random(0, 2)
79 for descr,n in pairs(campaign_data) do
80 if descr == (key1 .. key2 .. key3) and n > 0 and not (key1 == 0 and key2 == 0 and key3 == 0) then
81 if n < remaining then
82 soldiers[{key1, key2, key3, 0}] = n
83 remaining = remaining - n
84 else
85 soldiers[{key1, key2, key3, 0}] = remaining
86 remaining = 0
87 end
88 campaign_data[descr] = nil
89 break
90 end
91 end
92 until remaining == 0
93 soldiers[{0, 0, 0, 0}] = total_soldiers - takeover_soldiers
94else
95 -- We have less than 10 soldiers, so take them all plus some new ones
96 for h=0,2 do
97 for a=0,6 do
98 for d=0,2 do
99 if not (h == 0 and a == 0 and d == 0) and campaign_data[h .. a .. d] and campaign_data[h .. a .. d] > 0 then
100 soldiers[{h, a, d, 0}] = campaign_data[h .. a .. d]
101 end
102 end
103 end
104 end
105 soldiers[{0, 0, 0, 0}] = total_soldiers - trained
106end
107port1:set_soldiers(soldiers)
65108
66-- =======================================================================109-- =======================================================================
67-- Player 2110-- Player 2
@@ -157,7 +200,7 @@
157 empire_weaponsmith = 1,200 empire_weaponsmith = 1,
158 empire_geologist = 2201 empire_geologist = 2
159}202}
160hq2:set_soldiers({4,4,0,2}, 30)203hq2:set_soldiers({4,4,0,2}, 40)
161204
162-- =======================================================================205-- =======================================================================
163-- Player 3206-- Player 3
@@ -249,4 +292,4 @@
249 barbarians_blacksmith_master = 1,292 barbarians_blacksmith_master = 1,
250 barbarians_helmsmith = 1293 barbarians_helmsmith = 1
251}294}
252hq3:set_soldiers({3,5,0,2}, 40)295hq3:set_soldiers({3,5,0,2}, 50)
253296
=== modified file 'data/campaigns/fri02.wmf/scripting/texts.lua'
--- data/campaigns/fri02.wmf/scripting/texts.lua 2018-05-07 05:29:12 +0000
+++ data/campaigns/fri02.wmf/scripting/texts.lua 2018-09-29 08:44:21 +0000
@@ -77,6 +77,25 @@
77 p(_([[Otherwise, just destroy the warehouse and risk having Murilius as an enemy. He forbade you to expand your territory until the wares have been handed over.]]))77 p(_([[Otherwise, just destroy the warehouse and risk having Murilius as an enemy. He forbade you to expand your territory until the wares have been handed over.]]))
78 ),78 ),
79}79}
80obj_scout = {
81 name = "scout",
82 title=_"Spy on Murilius",
83 number = 1,
84 body = objective_text(_"Send a Scout to Spy on the Empire",
85 li(_[[Build a scout’s house near the border to discover the Empire’s secrets.]])
86 ),
87}
88obj_poem = {
89 name = "poem",
90 title=_"Decipher the poem",
91 number = 1,
92 body = objective_text(_"Understand the Poem the Scout has Found in the Empire",
93 p(_([[How many sites where soldiers stay,]])) ..
94 p(_([[How many sites where thou hold’st sway,]])) ..
95 p(_([[Though not their whereabouts sees he]])) ..
96 p(_([[Who’s ordering around here thee!]]))
97 ),
98}
80obj_defeat_barbarians = {99obj_defeat_barbarians = {
81 name = "defeat_barbarians",100 name = "defeat_barbarians",
82 title=_"Defeat the Barbarians!",101 title=_"Defeat the Barbarians!",
@@ -90,7 +109,8 @@
90 title=_"Defeat Murilius!",109 title=_"Defeat Murilius!",
91 number = 1,110 number = 1,
92 body = objective_text(_"Defeat the Arrogant Outpost of the Empire",111 body = objective_text(_"Defeat the Arrogant Outpost of the Empire",
93 li(_[[The only way to put an end to the Empire’s desire to steal our liberty is to destroy this outpost once and for all. Conquer its entire land.]])112 li(_[[The only way to put an end to the Empire’s desire to steal our liberty is to destroy this outpost once and for all. Conquer its entire land.]]) ..
113 li_arrow(_[[Conquer every single field that still belongs to Murilius.]])
94 ),114 ),
95}115}
96obj_defeat_both = {116obj_defeat_both = {
@@ -106,6 +126,13 @@
106-- Texts to the user126-- Texts to the user
107-- ==================127-- ==================
108128
129campaign_data_warning = {
130 title = _"Warning",
131 body = p(_[[You appear not to have completed the previous mission. You may still play this scenario, but you will be at a disadvantage. I recommend that you complete the previous scenario first and then restart this mission.]]),
132 w = 450,
133 h = 150,
134}
135
109intro_1 = {136intro_1 = {
110 title =_ "Welcome Back!",137 title =_ "Welcome Back!",
111 body=reebaud(_"A new home",138 body=reebaud(_"A new home",
@@ -291,7 +318,34 @@
291 _([[This is the greatest outrage of all. How dare he order us to stop expanding our territory when all we want is to build a new home, and threaten us with war if we refuse to be his slaves?]])318 _([[This is the greatest outrage of all. How dare he order us to stop expanding our territory when all we want is to build a new home, and threaten us with war if we refuse to be his slaves?]])
292 .. paragraphdivider() ..319 .. paragraphdivider() ..
293 -- TRANSLATORS: Reebaud – Supply Murilius 9320 -- TRANSLATORS: Reebaud – Supply Murilius 9
294 _([[I’d like to say we should attack him right now, but I fear we aren’t strong enough yet to hold our own against him in battle. We should hurry our soldier training while pretending to be gathering his so-called gift. That would buy us some time. As for expansion – I wonder how strictly he can possibly control us…]])),321 _([[I’d like to say we should attack him right now, but I fear we aren’t strong enough yet to hold our own against him in battle. We should hurry our soldier training while pretending to be gathering his so-called gift. That would buy us some time.]])
322 .. paragraphdivider() ..
323 -- TRANSLATORS: Reebaud – Supply Murilius 9
324 _([[As for expansion – I wonder how strictly he can possibly control us. Perhaps we should send a scout to spy on him…]]))
325 .. new_objectives(obj_scout),
326}
327
328expansion_hint = {
329 title =_ "The Scout Discovered Something",
330 body=hauke(_"Our scout returned",
331 -- TRANSLATORS: Hauke – Expansion hint
332 _([[Chieftain Reebaud! Our scout just returned. He has found a poem in the strange tongue this Proconsul speaks. With some difficulty, I have translated it into our language. If I did not mistranslate, it runs as follows:]])
333 .. paragraphdivider() ..
334 -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 1
335 space(10) .. (_([[How many sites where soldiers stay,]]))
336 .. paragraphdivider() ..
337 -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 2
338 space(10) .. (_([[How many sites where thou hold’st sway,]]))
339 .. paragraphdivider() ..
340 -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 3
341 space(10) .. (_([[Though not their whereabouts sees he]]))
342 .. paragraphdivider() ..
343 -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 4
344 space(10) .. (_([[Who’s ordering around here thee!]]))
345 .. paragraphdivider() ..
346 -- TRANSLATORS: Hauke – Expansion hint
347 _([[I don’t know what it means, but I’m sure it’s important. Perhaps you can make some sense of it.]]))
348 .. new_objectives(obj_poem),
295}349}
296350
297supply_murilius_destroy = {351supply_murilius_destroy = {
298352
=== modified file 'data/tribes/wares/sword_broad/idle.png'
299Binary files data/tribes/wares/sword_broad/idle.png 2018-05-17 10:02:26 +0000 and data/tribes/wares/sword_broad/idle.png 2018-09-29 08:44:21 +0000 differ353Binary files data/tribes/wares/sword_broad/idle.png 2018-05-17 10:02:26 +0000 and data/tribes/wares/sword_broad/idle.png 2018-09-29 08:44:21 +0000 differ
=== modified file 'data/tribes/wares/sword_broad/menu.png'
300Binary files data/tribes/wares/sword_broad/menu.png 2018-05-17 10:02:26 +0000 and data/tribes/wares/sword_broad/menu.png 2018-09-29 08:44:21 +0000 differ354Binary files data/tribes/wares/sword_broad/menu.png 2018-05-17 10:02:26 +0000 and data/tribes/wares/sword_broad/menu.png 2018-09-29 08:44:21 +0000 differ

Subscribers

People subscribed via source and target branches

to status/vote changes: