Class: Gemwarrior::Game
- Inherits:
-
Object
- Object
- Gemwarrior::Game
- Includes:
- PlayerLevels
- Defined in:
- lib/gemwarrior/game.rb
Constant Summary collapse
- PLAYER_DESC_DEFAULT =
CONSTANTS PLAYER DEFAULTS
'Picked to do battle against a wizened madman for a shiny something or other for world-saving purposes.'
- PLAYER_INVENTORY_DEFAULT =
Inventory.new
- PLAYER_INVENTORY_DEBUG =
Inventory.new([Herb.new])
- PLAYER_ROX_DEFAULT =
0
- PLAYER_ROX_DEBUG =
300
Instance Attribute Summary collapse
-
#eval ⇒ Object
Returns the value of attribute eval.
-
#repl ⇒ Object
Returns the value of attribute repl.
-
#world ⇒ Object
Returns the value of attribute world.
Instance Method Summary collapse
-
#initialize(options) ⇒ Game
constructor
A new instance of Game.
Methods included from PlayerLevels
Constructor Details
#initialize(options) ⇒ Game
Returns a new instance of Game.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/gemwarrior/game.rb', line 32 def initialize() # create new world and player self.world = World.new start_stats = PlayerLevels::get_level_stats(1) world.debug_mode = .fetch(:debug_mode) world.use_wordnik = .fetch(:use_wordnik) world.sound = .fetch(:sound) world.player = Player.new({ :description => PLAYER_DESC_DEFAULT, :level => start_stats[:level], :xp => start_stats[:xp_start], :hp_cur => start_stats[:hp_max], :hp_max => start_stats[:hp_max], :stam_cur => start_stats[:stam_max], :stam_max => start_stats[:stam_max], :atk_lo => start_stats[:atk_lo], :atk_hi => start_stats[:atk_hi], :defense => start_stats[:defense], :dexterity => start_stats[:dexterity], :inventory => world.debug_mode ? PLAYER_INVENTORY_DEBUG : PLAYER_INVENTORY_DEFAULT, :rox => world.debug_mode ? PLAYER_ROX_DEBUG : PLAYER_ROX_DEFAULT, :cur_coords => world.location_coords_by_name('Home'), :god_mode => .fetch(:god_mode), :beast_mode => .fetch(:beast_mode), :use_wordnik => .fetch(:use_wordnik) }) # create the console self.eval = Evaluator.new(world) self.repl = Repl.new(world, eval) # enter Jool! repl.start('look') end |
Instance Attribute Details
#eval ⇒ Object
Returns the value of attribute eval.
30 31 32 |
# File 'lib/gemwarrior/game.rb', line 30 def eval @eval end |
#repl ⇒ Object
Returns the value of attribute repl.
30 31 32 |
# File 'lib/gemwarrior/game.rb', line 30 def repl @repl end |
#world ⇒ Object
Returns the value of attribute world.
30 31 32 |
# File 'lib/gemwarrior/game.rb', line 30 def world @world end |