From 9d3fee60d4fb75d183d6db5af8468c2d9dbf9e85 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sat, 5 Mar 2016 21:22:57 +0200 Subject: [PATCH] Really gain items. --- koperkapel/scenes/level.py | 9 +++++++++ koperkapel/world.py | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/koperkapel/scenes/level.py b/koperkapel/scenes/level.py index 0cde651..9b54435 100644 --- a/koperkapel/scenes/level.py +++ b/koperkapel/scenes/level.py @@ -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 [ diff --git a/koperkapel/world.py b/koperkapel/world.py index 1558917..14746f5 100644 --- a/koperkapel/world.py +++ b/koperkapel/world.py @@ -23,9 +23,7 @@ class World: state["roaches"] = [ build_roach(self, "roupert"), ] - state["serums"] = [ - "smart", "strong", "fast", - ] + state["serums"] = [] state["vehicles"] = { "current": "walking", "walking": { -- 2.34.1