Class: Zarta::Dungeon

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeDungeon

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

#descriptionObject

The description of the dungeon



13
14
15
# File 'lib/zarta/dungeon.rb', line 13

def description
  @description
end

#enemy_listObject

A list of all possible enemy spawns



28
29
30
# File 'lib/zarta/dungeon.rb', line 28

def enemy_list
  @enemy_list
end

#levelObject

The level the player is currently on



19
20
21
# File 'lib/zarta/dungeon.rb', line 19

def level
  @level
end

#max_levelObject

The deepest level of the dungeon



16
17
18
# File 'lib/zarta/dungeon.rb', line 16

def max_level
  @max_level
end

#nameObject

The name of the dungeon



10
11
12
# File 'lib/zarta/dungeon.rb', line 10

def name
  @name
end

#playerObject

The player



34
35
36
# File 'lib/zarta/dungeon.rb', line 34

def player
  @player
end

#roomObject

The current room



37
38
39
# File 'lib/zarta/dungeon.rb', line 37

def room
  @room
end

#room_listObject

An array of all possible room adjectives



22
23
24
# File 'lib/zarta/dungeon.rb', line 22

def room_list
  @room_list
end

#stairs_timeObject

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_listObject

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_filesObject

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