def build_test_game(): M = GameMaker() # The goal commands = ["go east", "insert carrot into chest"] # Create a 'bedroom' room. R1 = M.new_room("bedroom") R2 = M.new_room("kitchen") M.set_player(R1) path = M.connect(R1.east, R2.west) path.door = M.new(type='d', name='wooden door') path.door.add_property("open") carrot = M.new(type='f', name='carrot') M.inventory.add(carrot) # Add a closed chest in R2. chest = M.new(type='c', name='chest') chest.add_property("open") R2.add(chest) quest1 = M.new_quest_using_commands(commands) quest1.reward = 2 quest2 = M.new_quest_using_commands(commands + ["close chest"]) quest2.set_winning_conditions( [M.new_fact("in", carrot, chest), M.new_fact("closed", chest)]) M._quests = [quest1, quest2] game = M.build() return game
def build_test_game(): M = GameMaker() # Create a 'bedroom' room. R1 = M.new_room("bedroom") R2 = M.new_room("kitchen") M.set_player(R1) path = M.connect(R1.east, R2.west) path.door = M.new(type='d', name='wooden door') path.door.add_property("open") carrot = M.new(type='f', name='carrot') M.inventory.add(carrot) # Add a closed chest in R2. chest = M.new(type='c', name='chest') chest.add_property("open") R2.add(chest) commands = ["go east", "insert carrot into chest"] quest1 = M.new_quest_using_commands(commands) quest1.reward = 2 commands = ["go east", "insert carrot into chest", "close chest"] event = M.new_event_using_commands(commands) quest2 = Quest(win_events=[event]) M.quests = [quest1, quest2] game = M.build() return game