Skip to content

Commit

Permalink
Bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCoffey committed Oct 17, 2014
1 parent c294033 commit 9932458
Showing 1 changed file with 71 additions and 39 deletions.
110 changes: 71 additions & 39 deletions dungeon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,6 @@
Room = Struct.new(:reference, :name, :description, :connections)
=end

gretting = puts "Elf: Wellcome strainger do you have any name ?\n"
puts "Yes my name is .. :"
@name = gets.chomp!.capitalize

while @name.length <= 0
puts "Elf: What is your name strainger:"
@name = gets.chomp!.capitalize
end


puts "\nElf: So your name is #{@name} uuhh!, dude! do have any idea of where on earth are you?, this isn't a place for racional people, best if you run away...\n "

early_choise = false
while early_choise == false
puts "What you wanna do ?\n"

puts "1. Leave"
puts "2. Keep on"

option = gets.chomp.to_i

if option == 1
puts "You: OMG! i didn't notice, see ya! faggot"
puts "Game Over"
early_choise = true
exit
elsif option == 2
puts "You: Shut up, and get out of my way!"
early_choise = true
end
end



class Dungeon
attr_accessor :player

Expand All @@ -47,6 +13,7 @@ def initialize(player_name)
@rooms = []
end


#This add a new Room to @rooms array
def add_room(reference, name, description, connections)
@rooms << Room.new(reference, name, description, connections)
Expand Down Expand Up @@ -82,8 +49,38 @@ class Player
def initialize(name)
@name = name
end

def type_player
player_class_choise = false

while player_class_choise == false
puts "#{@name}, you must chose a class !"

puts "1. Warrior"
puts "2. Wizzard"
puts "3. Dwarf"

warrior_choise = gets.chomp.to_i

case warrior_choise
when 1
puts "You are a Human, class warrior"
player_class_choise = true
when 2
puts "You are an Elf, class wizzard"
player_class_choise = true
when 3
puts "You are a Dwarf, class support"
player_class_choise = true
else
"unknown"
end
end
end
end



class Room
attr_accessor :reference, :name, :description, :connections

Expand All @@ -101,15 +98,50 @@ def full_description
end


gretting = puts "Elf: Wellcome strainger do you have any name ?\n"
puts "Yes my name is .. :"
@name = gets.chomp!.capitalize

while @name.length <= 0
puts "Elf: What is your name strainger:\n"
@name = gets.chomp!.capitalize
end


puts "\nElf: So your name is #{@name} uuhh!, dude! do have any idea of where on earth are you?, this isn't a place for racional people, best if you run away...\n "

early_choise = false
while early_choise == false
puts "What you wanna do ?\n"

puts "1. Leave"
puts "2. Keep on"

option = gets.chomp.to_i

if option == 1
puts "You: OMG! i didn't notice, see ya! faggot"
puts "Game Over"
early_choise = true
exit
elsif option == 2
puts "You: Shut up, and get out of my way!"
early_choise = true
end
end



puts "Elf: Well done strainger!, it's time to chose your class\n"

new_player = Dungeon::Player.new("#{@name}")
puts new_player.type_player


# Create the main dungeon object
my_dungeon = Dungeon.new("#{@name}")
# Add rooms to the dungeon
my_dungeon.add_room(:largecave, "Large Cave", "a large cavernous cave", { :west => :smallcave })
my_dungeon.add_room(:smallcave, "Small Cave", "a small, claustrophobic cave", { :east => :largecave })

# Start the dungeon by placing the player in the large cave
my_dungeon.start(:largecave)




0 comments on commit 9932458

Please sign in to comment.