← Back to team overview

widelands-dev team mailing list archive

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

 

Benedikt Straub has proposed merging lp:~widelands-dev/widelands/fri-01-02-improvements into lp:widelands.

Commit message:
Various improvements to both frisian scenarios

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1792478 in widelands: "Frisians 2: No victory declared"
  https://bugs.launchpad.net/widelands/+bug/1792478

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/fri-01-02-improvements/+merge/355843

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
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fri-01-02-improvements into lp:widelands.
=== 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-28 14:41:56 +0000
@@ -422,6 +422,9 @@
    p1:allow_buildings {"frisians_port", "frisians_weaving_mill", "frisians_shipyard"}
    o = add_campaign_objective(obj_escape)
 
+   sleep(30000)
+   campaign_message_box(rising_water_5)
+
    -- Wait until an expedition ship is ready
    local expedition_ready = false
    while not expedition_ready do
@@ -435,8 +438,22 @@
    end
 
    -- We escaped!
-   scroll_to_field(p1:get_buildings("frisians_port")[1].fields[1])
+   local port = p1:get_buildings("frisians_port")[1]
+   scroll_to_field(port.fields[1])
    sleep(1000)
+   local persist = {}
+   for descr,n in pairs(port:get_soldiers("all")) do
+      persist[descr[1] .. descr[2] .. descr[3]] = n
+   end
+   -- We save a table of all soldiers we can take with us:
+   -- {
+   --    "262" = 5,
+   --    "120" = 2,
+   --    ...
+   -- }
+   -- means 5 soldiers with training levels health-2/attack-6/defense-2 and
+   -- 2 soldiers with health-1/attack-2/defense-0.
+   wl.Game():save_campaign_data("frisians", "fri01", persist)
    campaign_message_box(victory_1)
    p1:reveal_scenario("frisians01")
    -- END OF MISSION 1

=== 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-28 14:41:56 +0000
@@ -129,8 +129,8 @@
       -- TRANSLATORS: Reebaud – Introduction 1
       _([[Welcome to the beautiful isle of Langeness! I am Reebaud, the chieftain of this pristine island.]])
       .. paragraphdivider() ..
-      -- TRANSLATORS: Reebaud – Introduction 1
-      _([[My tribe and I have just arrived from the mainland. There were fights with the Danes in the North, the Vikings in the East… So, I decided to lead my tribe away to start a quiet, peaceful life on this untouched island.]])),
+      -- TRANSLATORS: Reebaud – Introduction 1. The "Schauenburger" and "Holsteiner" are dukedoms.
+      _([[My tribe and I have just arrived from the mainland. There were fights with the Danes in the North, the Schauenburgians and Holsteiners in the East and South… So I decided to lead my tribe away to start a quiet, peaceful life on this untouched island.]])),
 }
 intro_2 = {
    title =_ "Introduction",
@@ -139,13 +139,13 @@
       _([[This is as good a place as any to start building our new home. First of all, we must ensure a stable supply of basic building materials.]])
       .. paragraphdivider() ..
       -- TRANSLATORS: Reebaud – Introduction 2
-      _([[I have asked Hauke, one of my advisors to oversee the construction of our settlement.]])),
+      _([[I have asked Hauke, one of my advisors, to oversee the construction of our settlement.]])),
 }
 intro_3 = {
    title =_ "Introduction",
    body=hauke(_"The first buildings",
-      -- TRANSLATORS: Hauke – Introduction 3
-      _([[Greetings, Chieftain Reebaud! I will start with the colonization of the island straight away.]])
+      -- TRANSLATORS: Hauke – Introduction 3. "Peace" is the traditional frisian greeting
+      _([[Peace, Chieftain Reebaud! I will start with the colonization of the island straight away.]])
       .. paragraphdivider() ..
       -- TRANSLATORS: Hauke – Introduction 3
       _([[Like all Frisians, we build our houses mainly with bricks. We improve them by adding some logs and granite. The roofs are thatched with reed, naturally. Nothing is better suited to keep the rain out.]])
@@ -405,6 +405,12 @@
       _([[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!]]))
       .. new_objectives(obj_escape),
 }
+rising_water_5 = {
+   title =_ "Don’t Forget the Soldiers",
+   body=reebaud(_"Soldiers to the port!",
+      -- TRANSLATORS: Reebaud – rising water
+      _([[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 sails!]])),
+}
 
 victory_1 = {
    title =_ "Victory",

=== 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-28 14:41:56 +0000
@@ -8,6 +8,7 @@
 include "scripting/infrastructure.lua"
 include "scripting/table.lua"
 include "scripting/ui.lua"
+include "scripting/messages.lua"
 
 game = wl.Game()
 p1 = game.players[1] -- Reebaud – player’s tribe
@@ -17,4 +18,16 @@
 p1_start = map.player_slots[1].starting_field
 
 include "map:scripting/texts.lua"
+
+total_soldiers = 25
+takeover_soldiers = 10
+campaign_data = game:read_campaign_data("frisians", "fri01")
+if not campaign_data then
+   campaign_message_box(campaign_data_warning)
+   campaign_data = {}
+   -- If he wants to cheat, let him, but give him a hard time
+   total_soldiers = 5
+   takeover_soldiers = 0
+end
+
 include "map:scripting/mission_thread.lua"

=== 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-28 14:41:56 +0000
@@ -1,4 +1,3 @@
-include "scripting/messages.lua"
 include "scripting/field_animations.lua"
 
 local done_mining = false
@@ -8,12 +7,16 @@
 
 local all_fields = {}
 local mountains = {}
+local useful_fields = {}
 for x=0,map.width - 1 do
    for y=0,map.height - 1 do
       local field = map:get_field(x, y)
       if field.terd:find("mountain") ~= nil then
          table.insert(mountains, field)
       end
+      if field:has_caps("small") or field:has_caps("mine") then
+         table.insert(useful_fields, field)
+      end
       table.insert(all_fields, field)
    end
 end
@@ -87,7 +90,7 @@
    end
    scroll_to_field(wh.fields[1])
    sleep(3000)
-   p2:forbid_buildings {"empire_fortress", "empire_castle", "empire_barrier", "empire_blockhouse", "empire_tower"}
+   p2:forbid_buildings {"empire_fortress", "empire_castle", "empire_blockhouse", "empire_tower"}
    p3:forbid_buildings {"barbarians_citadel", "barbarians_tower"}
    campaign_message_box(supply_murilius_6)
    campaign_message_box(supply_murilius_7)
@@ -99,13 +102,56 @@
    set_objective_done(o)
 
    o = add_campaign_objective(obj_supply_murilius)
+   local o_s = add_campaign_objective(obj_scout)
+   local o_p = nil
    local choice = ""
+   sleep(30000) -- give the player some time to account for nearly completed buildings
    local milbld = count_military_buildings_p1()
+   local scout = nil
    while choice == "" do
-      sleep(2791)
+      sleep(791)
+
+      local milsites = count_military_buildings_p1()
+      if o_p and milsites < milbld then
+         -- the player has dismantled a militarysite, so we assume he understood the poem
+         set_objective_done(o_p)
+         o_p = nil
+      end
+
+      if o_s and not scout then
+         -- let's see if a scout is spying in Murilius's territory
+         for i,house in pairs(p1:get_buildings("frisians_scouts_house")) do
+            for j,field in pairs(house.fields[1]:region(17)) do -- the scout has a radius of 15
+               for k,bob in pairs(field.bobs) do
+                  if bob.descr.name == "frisians_scout" and
+                        field.owner == p2 and
+                        field.brn.owner == p2 and
+                        field.bln.owner == p2 and
+                        field.trn.owner == p2 and
+                        field.tln.owner == p2 and
+                        field.rn.owner == p2 and
+                        field.ln.owner == p2 then
+                     scout = bob
+                     break
+                  end
+               end
+               if scout then break end
+            end
+            if scout then break end
+         end
+      elseif o_s and scout then
+         if scout.field.immovable and scout.field.immovable.descr.name == "frisians_scouts_house" then
+            set_objective_done(o_s)
+            campaign_message_box(expansion_hint)
+            o_p = add_campaign_objective(obj_poem)
+            o_s = nil
+            scout = nil
+         end
+      end
+
       if #(p1:get_buildings("frisians_warehouse_empire")) < 1 then
          choice = "destroy"
-      elseif count_military_buildings_p1() > milbld then
+      elseif milsites > milbld then
          -- It *is* permitted to destroy/dismantle a military building and build a new one elsewhere
          choice = "military"
       else
@@ -126,6 +172,13 @@
          end
       end
    end
+   -- We don’t need the scout/poem objectives anymore
+   if o_s then
+      set_objective_done(o_s)
+   end
+   if o_p then
+      set_objective_done(o_p)
+   end
    set_objective_done(o)
    p2:allow_buildings("all")
    p3:allow_buildings("all")
@@ -222,6 +275,8 @@
    -- If the barbarians already defeated Murilius – well done
    -- Otherwise, Murilius provokes Reebaud into ordering the player to conquer his entire colony
    -- (merely defeating the Empire isn’t enough)
+   -- We don't bother to check water, walkable-only and other useless terrains.
+   -- That would be really too much to ask from our poor player, now wouldn't it?
    if not p2.defeated then
       campaign_message_box(defeat_murilius_1)
       campaign_message_box(defeat_murilius_2)
@@ -230,7 +285,7 @@
       local def = false
       while not def do
          def = true
-         for idx,field in ipairs(all_fields) do
+         for idx,field in ipairs(useful_fields) do
             if field.owner == p2 then
                def = false
                break
@@ -271,8 +326,9 @@
    place_building_in_region(p3, "barbarians_metal_workshop", p1_start:region(7))
    place_building_in_region(p3, "barbarians_well", p1_start:region(7))
    place_building_in_region(p3, "barbarians_rangers_hut", p1_start:region(7))
-   reveal_concentric(p1, p1_start, 9, true, 100)
+   reveal_concentric(p1, p1_start, 10, true, 100)
    scroll_to_field(p1_start)
+   sleep(2000)
    campaign_message_box(intro_2)
    include "map:scripting/starting_conditions.lua"
    sleep(5000)

=== 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-28 14:41:56 +0000
@@ -61,7 +61,50 @@
    frisians_reindeer = 1,
    frisians_charcoal_burner = 3
 }
-port1:set_soldiers({0,0,0,0}, 25)
+
+local trained = 0
+for descr,n in pairs(campaign_data) do
+   if descr ~= "000" then
+      trained = trained + n
+   end
+end
+local soldiers = {}
+if trained > takeover_soldiers then
+   -- We have more soldiers than allowed, so pick 10 at random
+   local remaining = takeover_soldiers
+   repeat
+      local key1 = math.random(0, 2)
+      local key2 = math.random(0, 6)
+      local key3 = math.random(0, 2)
+      for descr,n in pairs(campaign_data) do
+         if descr == (key1 .. key2 .. key3) and n > 0 and not (key1 == 0 and key2 == 0 and key3 == 0) then
+            if n < remaining then
+               soldiers[{key1, key2, key3, 0}] = n
+               remaining = remaining - n
+            else
+               soldiers[{key1, key2, key3, 0}] = remaining
+               remaining = 0
+            end
+            campaign_data[descr] = nil
+            break
+         end
+      end
+   until remaining == 0
+   soldiers[{0, 0, 0, 0}] = total_soldiers - takeover_soldiers
+else
+   -- We have less than 10 soldiers, so take them all plus some new ones
+   for h=0,2 do
+      for a=0,6 do
+         for d=0,2 do
+            if not (h == 0 and a == 0 and d == 0) and campaign_data[h .. a .. d] and campaign_data[h .. a .. d] > 0 then
+               soldiers[{h, a, d, 0}] = campaign_data[h .. a .. d]
+            end
+         end
+      end
+   end
+   soldiers[{0, 0, 0, 0}] = total_soldiers - trained
+end
+port1:set_soldiers(soldiers)
 
 -- =======================================================================
 --                                 Player 2
@@ -157,7 +200,7 @@
    empire_weaponsmith = 1,
    empire_geologist = 2
 }
-hq2:set_soldiers({4,4,0,2}, 30)
+hq2:set_soldiers({4,4,0,2}, 40)
 
 -- =======================================================================
 --                                 Player 3
@@ -249,4 +292,4 @@
    barbarians_blacksmith_master = 1,
    barbarians_helmsmith = 1
 }
-hq3:set_soldiers({3,5,0,2}, 40)
+hq3:set_soldiers({3,5,0,2}, 50)

=== 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-28 14:41:56 +0000
@@ -77,6 +77,25 @@
       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.]]))
    ),
 }
+obj_scout = {
+   name = "scout",
+   title=_"Spy on Murilius",
+   number = 1,
+   body = objective_text(_"Send a Scout to Spy on the Empire",
+      li(_[[Build a scout’s house near the border to discover the Empire’s secrets.]])
+   ),
+}
+obj_poem = {
+   name = "poem",
+   title=_"Decipher the poem",
+   number = 1,
+   body = objective_text(_"Understand the Poem the Scout has Found in the Empire",
+      p(_([[How many sites where soldiers stay,]])) ..
+      p(_([[How many sites where thou hold’st sway,]])) ..
+      p(_([[Though not their whereabouts sees he]])) ..
+      p(_([[Who’s ordering around here thee!]]))
+   ),
+}
 obj_defeat_barbarians = {
    name = "defeat_barbarians",
    title=_"Defeat the Barbarians!",
@@ -90,7 +109,8 @@
    title=_"Defeat Murilius!",
    number = 1,
    body = objective_text(_"Defeat the Arrogant Outpost of the Empire",
-      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.]])
+      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.]]) ..
+      li_arrow(_[[Conquer every single field that still belongs to Murilius.]])
    ),
 }
 obj_defeat_both = {
@@ -106,6 +126,13 @@
 -- Texts to the user
 -- ==================
 
+campaign_data_warning = {
+   title = _"Warning",
+   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.]]),
+   w = 450,
+   h = 150,
+}
+
 intro_1 = {
    title =_ "Welcome Back!",
    body=reebaud(_"A new home",
@@ -247,8 +274,8 @@
 supply_murilius_4 = {
    title =_ "We Are Not Alone",
    body=reebaud(_"Strangers",
-      -- TRANSLATORS: Reebaud – Supply Murilius 4
-      _([[Greetings, representative of the Empire! I am Reebaud, the chieftain of this tribe. All we want is to settle down here, build our home and live our lives in peace. We do not seek trouble, but we aren’t afraid to fight, either.]])),
+      -- TRANSLATORS: Reebaud – Supply Murilius 4. "Peace" is the traditional frisian greeting, nothing more.
+      _([[Peace, representative of the Empire! I am Reebaud, the chieftain of this tribe. All we want is to settle down here, build our home and live our lives in peace. We do not seek trouble, but we aren’t afraid to fight, either.]])),
 }
 supply_murilius_5 = {
    title =_ "We Are Not Alone",
@@ -291,7 +318,34 @@
       _([[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?]])
       .. paragraphdivider() ..
       -- TRANSLATORS: Reebaud – Supply Murilius 9
-      _([[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…]])),
+      _([[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.]])
+      .. paragraphdivider() ..
+      -- TRANSLATORS: Reebaud – Supply Murilius 9
+      _([[As for expansion – I wonder how strictly he can possibly control us. Perhaps we should send a scout to spy on him…]]))
+      .. new_objectives(obj_scout),
+}
+
+expansion_hint = {
+   title =_ "The Scout Discovered Something",
+   body=hauke(_"Our scout returned",
+      -- TRANSLATORS: Hauke – Expansion hint
+      _([[Chieftain Reebaud! Our scout just returned. He has found a poem in the strange tongue this Proconsule speaks. With some difficulty, I have translated it into our language. If I did not mistranslate, it runs as follows:]])
+      .. paragraphdivider() ..
+      -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 1
+      space(10) .. (_([[How many sites where soldiers stay,]]))
+      .. paragraphdivider() ..
+      -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 2
+      space(10) .. (_([[How many sites where thou hold’st sway,]]))
+      .. paragraphdivider() ..
+      -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 3
+      space(10) .. (_([[Though not their whereabouts sees he]]))
+      .. paragraphdivider() ..
+      -- TRANSLATORS: Hauke – Expansion hint. A poem, verse 4
+      space(10) .. (_([[Who’s ordering around here thee!]]))
+      .. paragraphdivider() ..
+      -- TRANSLATORS: Hauke – Expansion hint
+      _([[I don’t know what it means, but I’m sure it’s important. Perhaps you can make some sense of it.]]))
+      .. new_objectives(obj_poem),
 }
 
 supply_murilius_destroy = {

=== modified file 'data/tribes/wares/sword_broad/idle.png'
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-28 14:41:56 +0000 differ
=== modified file 'data/tribes/wares/sword_broad/menu.png'
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-28 14:41:56 +0000 differ

Follow ups