Merge lp:~widelands-dev/widelands/fri-01-02-improvements into lp:widelands
- fri-01-02-improvements
- Merge into trunk
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 | ||||
Related bugs: |
|
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
bunnybot (widelandsofficial) wrote : | # |
GunChleoc (gunchleoc) wrote : | # |
Some nits for the strings + variable names
Benedikt Straub (nordfriese) wrote : | # |
OK, implemented your diff comments and uploaded the string changes to your localization branch
GunChleoc (gunchleoc) wrote : | # |
Great, thanks!
Can go in once it's been tested :)
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.
hessenfarmer (stephan-lutz) wrote : | # |
@bunnybot merge
GunChleoc (gunchleoc) wrote : | # |
Thanks for testing!
Preview Diff
1 | === modified file 'data/campaigns/fri01.wmf/scripting/mission_thread.lua' |
2 | --- data/campaigns/fri01.wmf/scripting/mission_thread.lua 2018-07-24 11:09:41 +0000 |
3 | +++ data/campaigns/fri01.wmf/scripting/mission_thread.lua 2018-09-29 08:44:21 +0000 |
4 | @@ -422,6 +422,9 @@ |
5 | p1:allow_buildings {"frisians_port", "frisians_weaving_mill", "frisians_shipyard"} |
6 | o = add_campaign_objective(obj_escape) |
7 | |
8 | + sleep(30000) |
9 | + campaign_message_box(rising_water_5) |
10 | + |
11 | -- Wait until an expedition ship is ready |
12 | local expedition_ready = false |
13 | while not expedition_ready do |
14 | @@ -435,8 +438,22 @@ |
15 | end |
16 | |
17 | -- We escaped! |
18 | - scroll_to_field(p1:get_buildings("frisians_port")[1].fields[1]) |
19 | + local port = p1:get_buildings("frisians_port")[1] |
20 | + scroll_to_field(port.fields[1]) |
21 | sleep(1000) |
22 | + local persist = {} |
23 | + for descr,n in pairs(port:get_soldiers("all")) do |
24 | + persist[descr[1] .. descr[2] .. descr[3]] = n |
25 | + end |
26 | + -- We save a table of all soldiers we can take with us: |
27 | + -- { |
28 | + -- "262" = 5, |
29 | + -- "120" = 2, |
30 | + -- ... |
31 | + -- } |
32 | + -- means 5 soldiers with training levels health-2/attack-6/defense-2 and |
33 | + -- 2 soldiers with health-1/attack-2/defense-0. |
34 | + wl.Game():save_campaign_data("frisians", "fri01", persist) |
35 | campaign_message_box(victory_1) |
36 | p1:reveal_scenario("frisians01") |
37 | -- END OF MISSION 1 |
38 | |
39 | === modified file 'data/campaigns/fri01.wmf/scripting/texts.lua' |
40 | --- data/campaigns/fri01.wmf/scripting/texts.lua 2018-07-24 11:09:41 +0000 |
41 | +++ data/campaigns/fri01.wmf/scripting/texts.lua 2018-09-29 08:44:21 +0000 |
42 | @@ -405,6 +405,12 @@ |
43 | _([[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!]])) |
44 | .. new_objectives(obj_escape), |
45 | } |
46 | +rising_water_5 = { |
47 | + title =_ "Don’t Forget the Soldiers", |
48 | + body=reebaud(_"Soldiers to the port!", |
49 | + -- TRANSLATORS: Reebaud – rising water |
50 | + _([[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!]])), |
51 | +} |
52 | |
53 | victory_1 = { |
54 | title =_ "Victory", |
55 | |
56 | === modified file 'data/campaigns/fri02.wmf/scripting/init.lua' |
57 | --- data/campaigns/fri02.wmf/scripting/init.lua 2018-03-01 10:06:46 +0000 |
58 | +++ data/campaigns/fri02.wmf/scripting/init.lua 2018-09-29 08:44:21 +0000 |
59 | @@ -8,6 +8,7 @@ |
60 | include "scripting/infrastructure.lua" |
61 | include "scripting/table.lua" |
62 | include "scripting/ui.lua" |
63 | +include "scripting/messages.lua" |
64 | |
65 | game = wl.Game() |
66 | p1 = game.players[1] -- Reebaud – player’s tribe |
67 | @@ -17,4 +18,16 @@ |
68 | p1_start = map.player_slots[1].starting_field |
69 | |
70 | include "map:scripting/texts.lua" |
71 | + |
72 | +total_soldiers = 25 |
73 | +takeover_soldiers = 10 |
74 | +campaign_data = game:read_campaign_data("frisians", "fri01") |
75 | +if not campaign_data then |
76 | + campaign_message_box(campaign_data_warning) |
77 | + campaign_data = {} |
78 | + -- If he wants to cheat, let him, but give him a hard time |
79 | + total_soldiers = 5 |
80 | + takeover_soldiers = 0 |
81 | +end |
82 | + |
83 | include "map:scripting/mission_thread.lua" |
84 | |
85 | === modified file 'data/campaigns/fri02.wmf/scripting/mission_thread.lua' |
86 | --- data/campaigns/fri02.wmf/scripting/mission_thread.lua 2018-04-15 18:24:47 +0000 |
87 | +++ data/campaigns/fri02.wmf/scripting/mission_thread.lua 2018-09-29 08:44:21 +0000 |
88 | @@ -1,4 +1,3 @@ |
89 | -include "scripting/messages.lua" |
90 | include "scripting/field_animations.lua" |
91 | |
92 | local done_mining = false |
93 | @@ -8,12 +7,16 @@ |
94 | |
95 | local all_fields = {} |
96 | local mountains = {} |
97 | +local useful_fields = {} |
98 | for x=0,map.width - 1 do |
99 | for y=0,map.height - 1 do |
100 | local field = map:get_field(x, y) |
101 | if field.terd:find("mountain") ~= nil then |
102 | table.insert(mountains, field) |
103 | end |
104 | + if field:has_caps("small") or field:has_caps("mine") then |
105 | + table.insert(useful_fields, field) |
106 | + end |
107 | table.insert(all_fields, field) |
108 | end |
109 | end |
110 | @@ -87,7 +90,7 @@ |
111 | end |
112 | scroll_to_field(wh.fields[1]) |
113 | sleep(3000) |
114 | - p2:forbid_buildings {"empire_fortress", "empire_castle", "empire_barrier", "empire_blockhouse", "empire_tower"} |
115 | + p2:forbid_buildings {"empire_fortress", "empire_castle", "empire_blockhouse", "empire_tower"} |
116 | p3:forbid_buildings {"barbarians_citadel", "barbarians_tower"} |
117 | campaign_message_box(supply_murilius_6) |
118 | campaign_message_box(supply_murilius_7) |
119 | @@ -99,13 +102,56 @@ |
120 | set_objective_done(o) |
121 | |
122 | o = add_campaign_objective(obj_supply_murilius) |
123 | + local o_scout = add_campaign_objective(obj_scout) |
124 | + local o_poem = nil |
125 | local choice = "" |
126 | + sleep(30000) -- give the player some time to account for nearly completed buildings |
127 | local milbld = count_military_buildings_p1() |
128 | + local scout = nil |
129 | while choice == "" do |
130 | - sleep(2791) |
131 | + sleep(791) |
132 | + |
133 | + local milsites = count_military_buildings_p1() |
134 | + if o_poem and milsites < milbld then |
135 | + -- the player has dismantled a militarysite, so we assume he understood the poem |
136 | + set_objective_done(o_poem) |
137 | + o_poem = nil |
138 | + end |
139 | + |
140 | + if o_scout and not scout then |
141 | + -- let's see if a scout is spying in Murilius's territory |
142 | + for i,house in pairs(p1:get_buildings("frisians_scouts_house")) do |
143 | + for j,field in pairs(house.fields[1]:region(17)) do -- the scout has a radius of 15 |
144 | + for k,bob in pairs(field.bobs) do |
145 | + if bob.descr.name == "frisians_scout" and |
146 | + field.owner == p2 and |
147 | + field.brn.owner == p2 and |
148 | + field.bln.owner == p2 and |
149 | + field.trn.owner == p2 and |
150 | + field.tln.owner == p2 and |
151 | + field.rn.owner == p2 and |
152 | + field.ln.owner == p2 then |
153 | + scout = bob |
154 | + break |
155 | + end |
156 | + end |
157 | + if scout then break end |
158 | + end |
159 | + if scout then break end |
160 | + end |
161 | + elseif o_scout and scout then |
162 | + if scout.field.immovable and scout.field.immovable.descr.name == "frisians_scouts_house" then |
163 | + set_objective_done(o_scout) |
164 | + campaign_message_box(expansion_hint) |
165 | + o_poem = add_campaign_objective(obj_poem) |
166 | + o_scout = nil |
167 | + scout = nil |
168 | + end |
169 | + end |
170 | + |
171 | if #(p1:get_buildings("frisians_warehouse_empire")) < 1 then |
172 | choice = "destroy" |
173 | - elseif count_military_buildings_p1() > milbld then |
174 | + elseif milsites > milbld then |
175 | -- It *is* permitted to destroy/dismantle a military building and build a new one elsewhere |
176 | choice = "military" |
177 | else |
178 | @@ -126,6 +172,13 @@ |
179 | end |
180 | end |
181 | end |
182 | + -- We don’t need the scout/poem objectives anymore |
183 | + if o_scout then |
184 | + set_objective_done(o_scout) |
185 | + end |
186 | + if o_poem then |
187 | + set_objective_done(o_poem) |
188 | + end |
189 | set_objective_done(o) |
190 | p2:allow_buildings("all") |
191 | p3:allow_buildings("all") |
192 | @@ -222,6 +275,8 @@ |
193 | -- If the barbarians already defeated Murilius – well done |
194 | -- Otherwise, Murilius provokes Reebaud into ordering the player to conquer his entire colony |
195 | -- (merely defeating the Empire isn’t enough) |
196 | + -- We don't bother to check water, walkable-only and other useless terrains. |
197 | + -- That would be really too much to ask from our poor player, now wouldn't it? |
198 | if not p2.defeated then |
199 | campaign_message_box(defeat_murilius_1) |
200 | campaign_message_box(defeat_murilius_2) |
201 | @@ -230,7 +285,7 @@ |
202 | local def = false |
203 | while not def do |
204 | def = true |
205 | - for idx,field in ipairs(all_fields) do |
206 | + for idx,field in ipairs(useful_fields) do |
207 | if field.owner == p2 then |
208 | def = false |
209 | break |
210 | @@ -271,8 +326,9 @@ |
211 | place_building_in_region(p3, "barbarians_metal_workshop", p1_start:region(7)) |
212 | place_building_in_region(p3, "barbarians_well", p1_start:region(7)) |
213 | place_building_in_region(p3, "barbarians_rangers_hut", p1_start:region(7)) |
214 | - reveal_concentric(p1, p1_start, 9, true, 100) |
215 | + reveal_concentric(p1, p1_start, 10, true, 100) |
216 | scroll_to_field(p1_start) |
217 | + sleep(2000) |
218 | campaign_message_box(intro_2) |
219 | include "map:scripting/starting_conditions.lua" |
220 | sleep(5000) |
221 | |
222 | === modified file 'data/campaigns/fri02.wmf/scripting/starting_conditions.lua' |
223 | --- data/campaigns/fri02.wmf/scripting/starting_conditions.lua 2018-05-23 05:13:49 +0000 |
224 | +++ data/campaigns/fri02.wmf/scripting/starting_conditions.lua 2018-09-29 08:44:21 +0000 |
225 | @@ -61,7 +61,50 @@ |
226 | frisians_reindeer = 1, |
227 | frisians_charcoal_burner = 3 |
228 | } |
229 | -port1:set_soldiers({0,0,0,0}, 25) |
230 | + |
231 | +local trained = 0 |
232 | +for descr,n in pairs(campaign_data) do |
233 | + if descr ~= "000" then |
234 | + trained = trained + n |
235 | + end |
236 | +end |
237 | +local soldiers = {} |
238 | +if trained > takeover_soldiers then |
239 | + -- We have more soldiers than allowed, so pick 10 at random |
240 | + local remaining = takeover_soldiers |
241 | + repeat |
242 | + local key1 = math.random(0, 2) |
243 | + local key2 = math.random(0, 6) |
244 | + local key3 = math.random(0, 2) |
245 | + for descr,n in pairs(campaign_data) do |
246 | + if descr == (key1 .. key2 .. key3) and n > 0 and not (key1 == 0 and key2 == 0 and key3 == 0) then |
247 | + if n < remaining then |
248 | + soldiers[{key1, key2, key3, 0}] = n |
249 | + remaining = remaining - n |
250 | + else |
251 | + soldiers[{key1, key2, key3, 0}] = remaining |
252 | + remaining = 0 |
253 | + end |
254 | + campaign_data[descr] = nil |
255 | + break |
256 | + end |
257 | + end |
258 | + until remaining == 0 |
259 | + soldiers[{0, 0, 0, 0}] = total_soldiers - takeover_soldiers |
260 | +else |
261 | + -- We have less than 10 soldiers, so take them all plus some new ones |
262 | + for h=0,2 do |
263 | + for a=0,6 do |
264 | + for d=0,2 do |
265 | + if not (h == 0 and a == 0 and d == 0) and campaign_data[h .. a .. d] and campaign_data[h .. a .. d] > 0 then |
266 | + soldiers[{h, a, d, 0}] = campaign_data[h .. a .. d] |
267 | + end |
268 | + end |
269 | + end |
270 | + end |
271 | + soldiers[{0, 0, 0, 0}] = total_soldiers - trained |
272 | +end |
273 | +port1:set_soldiers(soldiers) |
274 | |
275 | -- ======================================================================= |
276 | -- Player 2 |
277 | @@ -157,7 +200,7 @@ |
278 | empire_weaponsmith = 1, |
279 | empire_geologist = 2 |
280 | } |
281 | -hq2:set_soldiers({4,4,0,2}, 30) |
282 | +hq2:set_soldiers({4,4,0,2}, 40) |
283 | |
284 | -- ======================================================================= |
285 | -- Player 3 |
286 | @@ -249,4 +292,4 @@ |
287 | barbarians_blacksmith_master = 1, |
288 | barbarians_helmsmith = 1 |
289 | } |
290 | -hq3:set_soldiers({3,5,0,2}, 40) |
291 | +hq3:set_soldiers({3,5,0,2}, 50) |
292 | |
293 | === modified file 'data/campaigns/fri02.wmf/scripting/texts.lua' |
294 | --- data/campaigns/fri02.wmf/scripting/texts.lua 2018-05-07 05:29:12 +0000 |
295 | +++ data/campaigns/fri02.wmf/scripting/texts.lua 2018-09-29 08:44:21 +0000 |
296 | @@ -77,6 +77,25 @@ |
297 | 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.]])) |
298 | ), |
299 | } |
300 | +obj_scout = { |
301 | + name = "scout", |
302 | + title=_"Spy on Murilius", |
303 | + number = 1, |
304 | + body = objective_text(_"Send a Scout to Spy on the Empire", |
305 | + li(_[[Build a scout’s house near the border to discover the Empire’s secrets.]]) |
306 | + ), |
307 | +} |
308 | +obj_poem = { |
309 | + name = "poem", |
310 | + title=_"Decipher the poem", |
311 | + number = 1, |
312 | + body = objective_text(_"Understand the Poem the Scout has Found in the Empire", |
313 | + p(_([[How many sites where soldiers stay,]])) .. |
314 | + p(_([[How many sites where thou hold’st sway,]])) .. |
315 | + p(_([[Though not their whereabouts sees he]])) .. |
316 | + p(_([[Who’s ordering around here thee!]])) |
317 | + ), |
318 | +} |
319 | obj_defeat_barbarians = { |
320 | name = "defeat_barbarians", |
321 | title=_"Defeat the Barbarians!", |
322 | @@ -90,7 +109,8 @@ |
323 | title=_"Defeat Murilius!", |
324 | number = 1, |
325 | body = objective_text(_"Defeat the Arrogant Outpost of the Empire", |
326 | - 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.]]) |
327 | + 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.]]) .. |
328 | + li_arrow(_[[Conquer every single field that still belongs to Murilius.]]) |
329 | ), |
330 | } |
331 | obj_defeat_both = { |
332 | @@ -106,6 +126,13 @@ |
333 | -- Texts to the user |
334 | -- ================== |
335 | |
336 | +campaign_data_warning = { |
337 | + title = _"Warning", |
338 | + 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.]]), |
339 | + w = 450, |
340 | + h = 150, |
341 | +} |
342 | + |
343 | intro_1 = { |
344 | title =_ "Welcome Back!", |
345 | body=reebaud(_"A new home", |
346 | @@ -291,7 +318,34 @@ |
347 | _([[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?]]) |
348 | .. paragraphdivider() .. |
349 | -- TRANSLATORS: Reebaud – Supply Murilius 9 |
350 | - _([[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…]])), |
351 | + _([[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.]]) |
352 | + .. paragraphdivider() .. |
353 | + -- TRANSLATORS: Reebaud – Supply Murilius 9 |
354 | + _([[As for expansion – I wonder how strictly he can possibly control us. Perhaps we should send a scout to spy on him…]])) |
355 | + .. new_objectives(obj_scout), |
356 | +} |
357 | + |
358 | +expansion_hint = { |
359 | + title =_ "The Scout Discovered Something", |
360 | + body=hauke(_"Our scout returned", |
361 | + -- TRANSLATORS: Hauke – Expansion hint |
362 | + _([[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:]]) |
363 | + .. paragraphdivider() .. |
364 | + -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 1 |
365 | + space(10) .. (_([[How many sites where soldiers stay,]])) |
366 | + .. paragraphdivider() .. |
367 | + -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 2 |
368 | + space(10) .. (_([[How many sites where thou hold’st sway,]])) |
369 | + .. paragraphdivider() .. |
370 | + -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 3 |
371 | + space(10) .. (_([[Though not their whereabouts sees he]])) |
372 | + .. paragraphdivider() .. |
373 | + -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 4 |
374 | + space(10) .. (_([[Who’s ordering around here thee!]])) |
375 | + .. paragraphdivider() .. |
376 | + -- TRANSLATORS: Hauke – Expansion hint |
377 | + _([[I don’t know what it means, but I’m sure it’s important. Perhaps you can make some sense of it.]])) |
378 | + .. new_objectives(obj_poem), |
379 | } |
380 | |
381 | supply_murilius_destroy = { |
382 | |
383 | === modified file 'data/tribes/wares/sword_broad/idle.png' |
384 | Binary 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 |
385 | === modified file 'data/tribes/wares/sword_broad/menu.png' |
386 | Binary 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 |
Continuous integration builds have changed state:
Travis build 4068. State: passed. Details: https:/ /travis- ci.org/ widelands/ widelands/ builds/ 434676212. /ci.appveyor. com/project/ widelands- dev/widelands/ build/_ widelands_ dev_widelands_ fri_01_ 02_improvements -3864.
Appveyor build 3864. State: success. Details: https:/