Class: Den_east

Inherits:
Object
  • Object
show all
Defined in:
lib/denofshadows.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = 'eastern cavern', commands = ['look', 'take', 'leave'], inventory = ['club', 'wicker shield']) ⇒ Den_east

Returns a new instance of Den_east.



140
141
142
143
144
# File 'lib/denofshadows.rb', line 140

def initialize(name = 'eastern cavern', commands = ['look', 'take', 'leave'], inventory = ['club', 'wicker shield'])
	@name = name
	@commands = commands
	@inventory = inventory
end

Instance Attribute Details

#commandsObject

Returns the value of attribute commands.



138
139
140
# File 'lib/denofshadows.rb', line 138

def commands
  @commands
end

#inventoryObject

Returns the value of attribute inventory.



138
139
140
# File 'lib/denofshadows.rb', line 138

def inventory
  @inventory
end

#nameObject

Returns the value of attribute name.



138
139
140
# File 'lib/denofshadows.rb', line 138

def name
  @name
end

Instance Method Details

#introductionObject



146
147
148
# File 'lib/denofshadows.rb', line 146

def introduction
	puts 'You walk into the small cavern.'
end

#leaveObject



157
158
159
# File 'lib/denofshadows.rb', line 157

def leave
	$player.position.delete_at (0)
end

#lookObject



151
152
153
154
155
# File 'lib/denofshadows.rb', line 151

def look
	puts 'On the floor before you lies a poorly made wicker shield.' if self.inventory.include? 'wicker shield'
	puts 'Leaning against the far wall is a crude looking club.' if self.inventory.include? 'club'
	puts 'The room is small and damp. There is nothing here of any interest.' if self.inventory.length == 0
end