adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[adonthell-wastesedge-commits] Release_0-3-1 6087908 137/237: ADDED Bjar


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-1 6087908 137/237: ADDED Bjarn's schedule
Date: Mon, 25 Jul 2016 18:15:06 +0000 (UTC)

tag: Release_0-3-1
commit 6087908ab5d33a6a5f042e0967ce66755d227529
Author: adondev <adondev>
Commit: adondev <adondev>

    ADDED Bjarn's schedule
---
 scripts/init.py                             |    1 +
 scripts/schedules/mapcharacters/Makefile.am |    3 +-
 scripts/schedules/mapcharacters/bjarn.py    |   79 +++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 1 deletion(-)

diff --git a/scripts/init.py b/scripts/init.py
index 4101492..2a822c9 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -985,6 +985,7 @@ class title_screen:
         bjarn.jump_to (7, 3, 6)
         bjarn.set_action ("talk")
         bjarn.stand_west ()
+        bjarn.set_schedule ("bjarn")
         bjarn.set_portrait ("bjarn.pnm")
 
         silverhair = gamedata_get_character ("Imoen Silverhair")
diff --git a/scripts/schedules/mapcharacters/Makefile.am 
b/scripts/schedules/mapcharacters/Makefile.am
index d7ae1d2..82e7a0c 100644
--- a/scripts/schedules/mapcharacters/Makefile.am
+++ b/scripts/schedules/mapcharacters/Makefile.am
@@ -2,6 +2,7 @@ pkgdatadir = $(gamedatadir)/scripts/schedules/mapcharacters
 
 pkgdata_DATA = alek.py erek.py frostbloom.py janesta.py jelom.py \
        keyboard_control.py oliver.py orloth.py sarin.py silverhair.py \
-       talan.py tristan.py fellnir.py to_cellar.py lucia.py intro.py
+       talan.py tristan.py fellnir.py to_cellar.py lucia.py intro.py \
+       bjarn.py
 
 EXTRA_DIST = $(pkgdata_DATA)
diff --git a/scripts/schedules/mapcharacters/bjarn.py 
b/scripts/schedules/mapcharacters/bjarn.py
new file mode 100644
index 0000000..4e0ce91
--- /dev/null
+++ b/scripts/schedules/mapcharacters/bjarn.py
@@ -0,0 +1,79 @@
+#
+#  (C) Copyright 2001 Kai Sterker <address@hidden>
+#  Part of the Adonthell Project http://adonthell.linuxgames.com
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License.
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY.
+#
+#  See the COPYING file for more details
+#
+
+# -- Movement schedule for Bjarn Fingolson
+#
+#    He'll busy himself in his room
+
+import adonthell
+import random
+
+class bjarn:
+
+    def __init__ (self, mapcharacterinstance):
+        self.myself = mapcharacterinstance
+        self.speech = ["Ha! A tradesman is an honourable person, they say!", \
+                       "Why don't they just take that Silverhair woman to 
prison!?", \
+                       "Elves! Their heads in the sky and their minds full of 
clouds!"]
+
+        self.coords = [(7, 5, adonthell.STAND_WEST), \
+                       (2, 4, adonthell.STAND_SOUTH), \
+                       (7, 3, adonthell.STAND_NORTH), \
+                       (3, 6, adonthell.STAND_WEST)]
+
+    def run (self):
+        myself = self.myself
+
+        # -- Get at the proper place when Erek lets the player into the room
+        #    and at the end of the game.
+        if adonthell.gamedata_get_quest ("demo").get_val("the_end") == 1 or \
+           adonthell.gamedata_get_quest ("demo").get_val("bjarn_door_open") == 
2:
+            myself.jump_to (myself.submap (), 3, 6)
+            myself.stand_west ()
+            myself.set_val ("delay", 150)
+            return
+
+        todo = myself.get_val ("todo")
+
+        # -- waiting
+        if todo == 0:
+            delay = myself.get_val ("delay")
+            # If standing delay expired, move around next time
+            if delay == 0:
+                myself.set_val ("todo", 1)
+            else:
+                myself.set_val ("delay", delay - 1)
+
+        # -- engage a new movement
+        elif todo == 1:
+            x, y, dir = self.coords[random.randint (0, 3)]
+
+            myself.set_goal (x, y, dir)
+            myself.set_val ("todo", 2)
+
+        # -- moving
+        elif todo == 2:
+            if myself.follow_path () == 1:
+                # -- the time we stay at the same place
+                delay = random.randint (30, 60) * 25
+
+                myself.set_val ("delay", delay)
+                myself.set_val ("todo", 0)
+
+
+        # -- utter a random remark
+        tmp = myself.get_val ("say_something")
+        myself.set_val ("say_something", tmp - 1)
+        if tmp <= 0:
+            myself.speak (self.speech[random.randint (0, 2)])
+            delay = random.randint (20, 40) * 40
+            myself.set_val ("say_something", delay)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]