Class: Zarta::Dungeon
- Inherits:
-
Object
- Object
- Zarta::Dungeon
- Defined in:
- lib/zarta/dungeon.rb
Overview
Keeps track of the dungeon. Mostly, this guy is used for passing all the other objects to each other and keeping track of a few things because I’m not allowed to use class variables for some reason…
Instance Attribute Summary collapse
-
#description ⇒ Object
The description of the dungeon.
-
#enemy_list ⇒ Object
A list of all possible enemy spawns.
-
#level ⇒ Object
The level the player is currently on.
-
#max_level ⇒ Object
The deepest level of the dungeon.
-
#name ⇒ Object
The name of the dungeon.
-
#player ⇒ Object
The player.
-
#room ⇒ Object
The current room.
-
#room_list ⇒ Object
An array of all possible room adjectives.
-
#stairs_time ⇒ Object
The number of rooms passed through since the last set of stairs.
-
#weapon_list ⇒ Object
A list of all possible weapon drops.
Instance Method Summary collapse
-
#initialize ⇒ Dungeon
constructor
A new instance of Dungeon.
-
#load_yaml_files ⇒ Object
Moved him out for clarity and ease of editing.
Constructor Details
#initialize ⇒ Dungeon
Returns a new instance of Dungeon.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/zarta/dungeon.rb', line 39 def initialize load_yaml_files @name = 'The Legendary Dungeon of ZARTA' @description = 'The testiest test dungeon that ever tested!' @max_level = 10 @level = 1 @stairs_time = 0 @player = Zarta::Player.new(self) @room = Zarta::Room.new(self) end |
Instance Attribute Details
#description ⇒ Object
The description of the dungeon
13 14 15 |
# File 'lib/zarta/dungeon.rb', line 13 def description @description end |
#enemy_list ⇒ Object
A list of all possible enemy spawns
28 29 30 |
# File 'lib/zarta/dungeon.rb', line 28 def enemy_list @enemy_list end |
#level ⇒ Object
The level the player is currently on
19 20 21 |
# File 'lib/zarta/dungeon.rb', line 19 def level @level end |
#max_level ⇒ Object
The deepest level of the dungeon
16 17 18 |
# File 'lib/zarta/dungeon.rb', line 16 def max_level @max_level end |
#name ⇒ Object
The name of the dungeon
10 11 12 |
# File 'lib/zarta/dungeon.rb', line 10 def name @name end |
#player ⇒ Object
The player
34 35 36 |
# File 'lib/zarta/dungeon.rb', line 34 def player @player end |
#room ⇒ Object
The current room
37 38 39 |
# File 'lib/zarta/dungeon.rb', line 37 def room @room end |
#room_list ⇒ Object
An array of all possible room adjectives
22 23 24 |
# File 'lib/zarta/dungeon.rb', line 22 def room_list @room_list end |
#stairs_time ⇒ Object
The number of rooms passed through since the last set of stairs.
31 32 33 |
# File 'lib/zarta/dungeon.rb', line 31 def stairs_time @stairs_time end |
#weapon_list ⇒ Object
A list of all possible weapon drops
25 26 27 |
# File 'lib/zarta/dungeon.rb', line 25 def weapon_list @weapon_list end |
Instance Method Details
#load_yaml_files ⇒ Object
Moved him out for clarity and ease of editing. I know enemy isn’t plural. It bugs me as well. It’s on my list.
53 54 55 56 57 |
# File 'lib/zarta/dungeon.rb', line 53 def load_yaml_files @room_list = YAML.load_file(__dir__ + '/rooms.yml') @weapon_list = YAML.load_file(__dir__ + '/weapons.yml') @enemy_list = YAML.load_file(__dir__ + '/enemy.yml') end |