← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~f-thiessen/widelands/barbarian3 into lp:widelands

 

Ferdinand T. has proposed merging lp:~f-thiessen/widelands/barbarian3 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #674839 in widelands: "Some issues of barbarian tutorial 3"
  https://bugs.launchpad.net/widelands/+bug/674839
  Bug #1276247 in widelands: "[6826] Barbarian tutorial 3, second event trigger too fast (again)"
  https://bugs.launchpad.net/widelands/+bug/1276247
  Bug #1298411 in widelands: "No necessity to conquer all military buildings in the third Barbarian Campaign"
  https://bugs.launchpad.net/widelands/+bug/1298411

For more details, see:
https://code.launchpad.net/~f-thiessen/widelands/barbarian3/+merge/227436

This fixes some bugs with the third barbarian campaign:
* Now it is needed to conquer all military buildings of the enemies (bug 1298411)
* Event "Build a Donjohn" triggers now not so early (bug 1276247)
* "explore further" is now active until the "Boldreth shouts out!" event (bug 674839)
-- 
https://code.launchpad.net/~f-thiessen/widelands/barbarian3/+merge/227436
Your team Widelands Developers is requested to review the proposed merge of lp:~f-thiessen/widelands/barbarian3 into lp:widelands.
=== modified file 'campaigns/t03.wmf/scripting/mission_thread.lua'
--- campaigns/t03.wmf/scripting/mission_thread.lua	2014-03-15 13:36:42 +0000
+++ campaigns/t03.wmf/scripting/mission_thread.lua	2014-07-20 14:24:39 +0000
@@ -8,6 +8,16 @@
 fr2 = wl.Game().map:get_field(85,1)
 fr3 = wl.Game().map:get_field(85,11)
 
+function check_conquered_footprints()
+    if p1:seen_field(wl.Game().map:get_field(65, 28))
+    then
+        sleep(2134)
+        if p1:sees_field(wl.Game().map:get_field(65, 28))
+        then return true end
+    end
+    return false
+end
+
 function remember_cattlefarm()
    sleep(100)
 
@@ -36,7 +46,9 @@
       "farm",
       "well",
       "bakery",
+      "sentry",
    }
+
    local o = add_obj(obj_build_small_food_economy)
    while not check_for_buildings(p1, {
          fishers_hut = 1,
@@ -56,8 +68,9 @@
    -- Hunter build and some time passed or expanded east
    local game = wl.Game()
    while true do
-      if (game.time > 900000 and #p1:get_buildings("hunters_hut") > 0)
-         or p1:seen_field(wl.Game().map:get_field(65, 28))
+      if game.time > 900000 and #p1:get_buildings("hunters_hut") > 0
+      then break end
+      if check_conquered_footprints()
       then break end
       sleep(4239)
    end
@@ -85,7 +98,8 @@
    while not check_for_buildings(p1, {donjon=1}) do sleep(2341) end
    o.done = true
    send_msg(order_msg_3_explore_further)
-   o = add_obj(obj_explore_further)
+   -- "explore further" is active untill "Boldreth shout out", so the player always has one open objectve.
+   obexp = add_obj(obj_explore_further)
 
    p1:allow_buildings{"sentry", "barrier"}
 
@@ -99,7 +113,6 @@
 
       sleep(3244)
    end
-   o.done = true
 end
 
 function mining_and_trainingsites()
@@ -125,6 +138,7 @@
       "smelting_works",
       "metalworks",
       "burners_house",
+      "micro-brewery",
    }
 
    timed_scroll(array_reverse(pts), 10)
@@ -163,7 +177,6 @@
       "deeper_goldmine",
       "deeper_oremine",
       "warehouse",
-      "micro-brewery",
       "brewery",
    }
    run(check_warehouse_obj, add_obj(obj_build_a_warehouse))
@@ -231,6 +244,17 @@
    send_msg(story_msg_6)
 end
 
+-- checks if not only defeated (no warehouses), but also checks if all millitary buildings are destroyed
+function check_player_completly_defeated(dp)
+    if #dp:get_buildings("fortress")  > 0 then return false end
+    if #dp:get_buildings("citadel")   > 0 then return false end
+    if #dp:get_buildings("donjon")    > 0 then return false end
+    if #dp:get_buildings("barrier")   > 0 then return false end
+    if #dp:get_buildings("sentry")    > 0 then return false end
+    if #dp:get_buildings("warehouse") > 0 then return false end
+    return true
+end
+
 function kalitath()
    -- While no contact with kalithat
    local map = wl.Game().map
@@ -243,11 +267,15 @@
       p1:seen_field(map:get_field( 96,  30))
       )
    do sleep(7834) end
+   -- "explore further" is done
+   obexp.done = true
 
    send_msg(order_msg_7_destroy_kalitaths_army)
    local o = add_obj(obj_destroy_kalitaths_army)
 
-   while not p2.defeated do sleep(7837) end
+   while not check_player_completly_defeated(p2) do
+        sleep(7837)
+   end
    o.done = true
 end
 
@@ -287,7 +315,7 @@
    timed_scroll(array_reverse(pts))
    sleep(500)
 
-   while not (p3.defeated and p4.defeated) do
+   while not (check_player_completly_defeated(p3) and check_player_completly_defeated(p4)) do
       sleep(6734)
    end
 
@@ -296,7 +324,10 @@
 
 function mission_complete()
    local map = wl.Game().map
-   while not (p2.defeated and p3.defeated and p4.defeated) do
+   while not (
+      check_player_completly_defeated(p2) and
+      check_player_completly_defeated(p3) and
+      check_player_completly_defeated(p4)) do
       sleep(8923)
    end