Module: DungeonGenerator

Included in:
Dungeon
Defined in:
lib/dungeon/dungeon_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate(dungeon_size, party_levels, encounters_difficulty: :medium, rooms_removal_coef: 0.3, lair: nil, output: false) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/dungeon/dungeon_generator.rb', line 5

def generate( dungeon_size, party_levels, encounters_difficulty: :medium, rooms_removal_coef: 0.3, lair: nil, output: false )
  check_params( dungeon_size, party_levels, encounters_difficulty, rooms_removal_coef )
  @dungeon_size = dungeon_size
  @rooms_removal_coef = rooms_removal_coef
  @rooms = {}
  @hallways = HallwaysList.new
  @dungeon_generated = false
  @current_room = nil

  @lair = lair ? lair : Lairs.new( encounters_difficulty, party_levels )

  @output = output
  create_dungeon
  create_entry
  connect_hallways
  delete_rooms
  generate_treasure
  @dungeon_generated = true
end