Class: GamesAndRpgParadise::Mud::Door

Inherits:
Mud::Object
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/mud/objects/doors/door.rb

Direct Known Subclasses

SteelDoor

Instance Method Summary collapse

Constructor Details

#initializeDoor

#

initialize

#


28
29
30
# File 'lib/games_and_rpg_paradise/mud/objects/doors/door.rb', line 28

def initialize
  reset
end

Instance Method Details

#end_listening_on_the_doorObject

#

end_listening_on_the_door

#


89
90
91
# File 'lib/games_and_rpg_paradise/mud/objects/doors/door.rb', line 89

def end_listening_on_the_door
  actor.no_longer_receive_input_from_this_room(self)
end

#resetObject

#

reset (reset tag)

#


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/games_and_rpg_paradise/mud/objects/doors/door.rb', line 35

def reset
  # ======================================================================= #
  # === @thickness
  #
  # The thickness of the door.
  # ======================================================================= #
  @thickness = 5 # 5 cm.
  # ======================================================================= #
  # === @room_size
  #
  # How big is the room where this door is connected to?
  # ======================================================================= #
  @room_size = :medium
  set_material(:wood)
end

#scramble_randomly(difficulty = 50) ⇒ Object

#

scramble_randomly

#


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/games_and_rpg_paradise/mud/objects/doors/door.rb', line 67

def scramble_randomly(
    difficulty = 50
  )
  _ = ''.dup
  self.each {|character| 
    if skill_check(:awareness, difficulty)
      _ << character
    else
      case random(4)+1
      when 1 then _ << ' '
      when 2 then _ << '*'
      when 3 then _ << ''
      when 4 then _ << get_random_character()
      end
    end
  }
  return _
end

#start_to_listen_on_the_door(which_door_object = nil) ⇒ Object

#

start_to_listen_on_the_door

#


54
55
56
57
58
59
60
61
62
# File 'lib/games_and_rpg_paradise/mud/objects/doors/door.rb', line 54

def start_to_listen_on_the_door(
    which_door_object = nil
  )
  actor.receive_input_from_this_room(which_door_object.exit?)
  words = get_input_from_door_room
  words.scramble_randomly(
    80 - actor.intelligence_value?
  ) # difficulty must be adjusted.
end