Пример #1
0
 def open_chest(self, chest: Chest):
     loot = chest.loot_table.generate_loot()
     chest_position = chest.world_entity.get_position()
     self._put_loot_on_ground(chest_position, loot)
     chest.has_been_opened = True
     visual_effects = [
         VisualRect((200, 0, 200), chest.world_entity.get_center_position(),
                    50, 100, Millis(100), 2),
         VisualRect((200, 0, 200), chest.world_entity.get_center_position(),
                    50, 100, Millis(180), 3)
     ]
     self.game_state.visual_effects += visual_effects
Пример #2
0
 def open_chest(self, chest: Chest):
     increased_money_chance = self.game_state.player_state.increased_loot_money_chance
     increased_rare_or_unique_chance = self.game_state.player_state.increased_loot_rare_or_unique_chance
     loot_table = get_loot_table(chest.loot_table)
     loot = loot_table.generate_loot(increased_money_chance,
                                     increased_rare_or_unique_chance,
                                     self.game_state.is_dungeon)
     chest_position = chest.world_entity.get_position()
     self._put_loot_on_ground(chest_position, loot)
     chest.has_been_opened = True
     visual_effects = [
         VisualRect((200, 0, 200), chest.world_entity.get_center_position(),
                    50, 100, Millis(100), 2),
         VisualRect((200, 0, 200), chest.world_entity.get_center_position(),
                    50, 100, Millis(180), 3)
     ]
     self.game_state.game_world.visual_effects += visual_effects
Пример #3
0
def create_chest(pos: Tuple[int, int]) -> Chest:
    # TODO Allow for other loot in chests (Currently all chests are equal)
    return Chest(WorldEntity(pos, CHEST_ENTITY_SIZE, Sprite.CHEST), CHEST_LOOT)