1
0
Fork 0
mirror of https://gitlab.com/Oreolek/black_phone.git synced 2024-06-01 07:48:23 +03:00
black_phone/lib/character.coffee
2016-02-10 20:38:27 +07:00

22 lines
441 B
CoffeeScript

class Character
constructor: (spec) ->
@inventory = []
@take = (thing) =>
@inventory.push thing
@drop = (thing) =>
for i in @inventory
if i.name == thing
index = @objects.indexOf(thing)
@inventory.splice(index, 1)
for index, value of spec
this[index] = value
return this
character = (spec) ->
spec ?= {}
return( new Character(spec) )
module.exports = character