player: { hp: 100, inventory: [ { id: "dagger", x: 0, y: 0, name: "Swiss army knife", description: "Your trustworthy army knife will never let you down", useTimes: infinite, value: 5, actions: {} }, { id: "potion", x: 0, y: 0, name: "Small healing potion", description: "Will recover you from small injuries", useTimes: 5, value: 5, actions: {} } ] } levels: [ { layout: { | * * * * * * * | * s . . . e * | * * * * * * * }, items: [], entities: [] }, { layout: { | x x * * * x x x x | x x * . * x x x x | * * * . * * * * * | * s . . . . . e * | * * * * * * * * * }, items: [ { id: "key", x: 3, y: 3, name: "Secret key", description: "What if this key opens a secret door?", useTimes: 1, value: 0, actions: { [not(inventoryFull())] retrieveItem(key), [] leave() } } ], entities: [ { id: "door", x: 4, y: 1, name: "Secret door", description: "This door can only be opened with a secret key", direction: left, actions: { [inventoryContains(key)] useItem(key), [] leave() } } ] }, { layout: { | * * * * * * * * * * * | * . . . . . . . . . * | * * * * * * * * * . * | * e . . . . . . . s * | * * * * * * * * * . * | x x x x x x x x * . * | * * * * * * * * * . * | * . . . . . . . . . * | * * * * * * * * * * * }, items: [ { id: "key", x: 1, y: 1, name: "Key to sturdy door", description: "You have proven worthy", useTimes: 1, value: 0, actions: { [not(inventoryFull())] retrieveItem(key), [] leave() } }, { id: "sword", x: 1, y: 7, name: "Mighty sword", description: "Slayer of evil", useTimes: 3, value: 100, actions: { [not(inventoryFull())] retrieveItem(sword), [] leave() } } ], entities: [ { id: "door", x: 8, y: 5, name: "Sturdy door", description: "I wonder what's behind it?", direction: right, actions: { [inventoryContains(key)] useItem(key), [] leave() } }, { id: "devil", x: 6, y: 1, name: "Evil powers", description: "Certainly from hell", hp: 55, value: 10, actions: { [inventoryContains(dagger)] decreaseHp(devil, dagger), [inventoryContains(sword)] decreaseHp(devil, sword), [] leave() } } ] } ]