Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. const checkGet: (dungeon: Dungeon) => IAction = (dungeon: Dungeon) => {
  2. if (dungeon.currentRoom.things.length < 1) {
  3. return {
  4. type: ACTION_TEXT,
  5. text: 'You get down.'
  6. } as ITextAction;
  7. }
  8.  
  9. let invCount = dungeon.inventory.length + 1;
  10. if (dungeon.trophyCount === invCount) {
  11. return {
  12. type: ACTION_WON,
  13. item: dungeon.currentRoom.things[0],
  14. room: dungeon.currentRoom
  15. } as IWonAction;
  16. }
  17. return {
  18. type: ACTION_GET,
  19. item: dungeon.currentRoom.things[0],
  20. room: dungeon.currentRoom
  21. } as IInventoryAction;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement