Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const checkGet: (dungeon: Dungeon) => IAction = (dungeon: Dungeon) => {
- if (dungeon.currentRoom.things.length < 1) {
- return {
- type: ACTION_TEXT,
- text: 'You get down.'
- } as ITextAction;
- }
- let invCount = dungeon.inventory.length + 1;
- if (dungeon.trophyCount === invCount) {
- return {
- type: ACTION_WON,
- item: dungeon.currentRoom.things[0],
- room: dungeon.currentRoom
- } as IWonAction;
- }
- return {
- type: ACTION_GET,
- item: dungeon.currentRoom.things[0],
- room: dungeon.currentRoom
- } as IInventoryAction;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement