Really gain items.
authorSimon Cross <hodgestar@gmail.com>
Sat, 5 Mar 2016 19:22:57 +0000 (21:22 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 5 Mar 2016 19:22:57 +0000 (21:22 +0200)
koperkapel/scenes/level.py
koperkapel/world.py

index 0cde6515992a4dd49717719a38d7e14c54bd8da8..9b54435df80fb43151737a6c9f7d6421bb905cdf 100644 (file)
@@ -169,6 +169,14 @@ class GameLevelScene(BaseLevelScene):
         world.roaches.append(build_roach(world))
         self._vehicle_changed()
 
+    @defer_to_update
+    def _gain_item(self, world, item):
+        if item.item_type == "serum":
+            world.serums.append(item.item_data["serum"])
+        elif item.item_type == "weapon":
+            world.weapons.current = item.item_data["weapon"]
+        self._vehicle_changed()
+
     @defer_to_update
     def _change_vehicle(self, world):
         vehicle = Vehicle.random()
@@ -242,6 +250,7 @@ class GameLevelScene(BaseLevelScene):
             item = self._level.item_at(x, y)
             self._level.remove_item(item)
             self._items.remove(item)
+            self._gain_item(item)
         elif self._level.is_exit(x, y):
             next_level = self._level.get_exit_level()
             return [
index 1558917b56628ec339e2c37d8ec5fa777b1688c4..14746f530760e6a092345b7f78abf834430a7598 100644 (file)
@@ -23,9 +23,7 @@ class World:
         state["roaches"] = [
             build_roach(self, "roupert"),
         ]
-        state["serums"] = [
-            "smart", "strong", "fast",
-        ]
+        state["serums"] = []
         state["vehicles"] = {
             "current": "walking",
             "walking": {