UNPKG

kraft

Version:

A mysterious command line game with lots of secrets

30 lines (25 loc) 1.89 kB
/** * Created by vanraar on 24/09/16. */ const Locations = require(__base+'model/data/locations'); const Buildings = require(__base+'model/data/Buildings'); const Items = require(__base+'model/data/Items'); const Config = require(__base+'config/Config'); const Lenses = require(__base+'helpers/Lenses'); // Player properties exports.location = Lenses.create(['player', 'location']); exports.locationDescription = () => Locations[exports.location.view()].description; exports.locationBuildings = (location) => Lenses.create(['player', 'buildings', location]); exports.actionType = Lenses.create(['player', 'action', 'type']); exports.actionStart = Lenses.create(['player', 'action', 'start']); exports.actionEnd = Lenses.create(['player', 'action', 'end']); exports.actionArguments = Lenses.create(['player', 'action', 'arguments']); exports.resources = Lenses.create(['player', 'resources']); exports.resource = (resource) => Lenses.create(['player', 'resources', resource]); exports.building = (location, building) => Lenses.create(['player', 'buildings', location, building]); exports.buildingResource = (location, building, resource) => Lenses.create(['player', 'buildings', location, building, 'resources', resource]); exports.buildingResources = (location, building) => Lenses.create(['player', 'buildings', location, building, 'resources']); exports.buildingActionType = (location, building) => Lenses.create(['player', 'buildings', location, building, 'action', 'type']); exports.buildingActionStart = (location, building) => Lenses.create(['player', 'buildings', location, building, 'action', 'start']); exports.buildingActionEnd = (location, building) => Lenses.create(['player', 'buildings', location, building, 'action', 'end']); exports.buildingActionArguments = (location, building) => Lenses.create(['player', 'buildings', location, building, 'action', 'arguments']);