Class: Gemwarrior::Game
- Inherits:
-
Object
- Object
- Gemwarrior::Game
- 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_LEVEL_DEFAULT =
1- PLAYER_XP_DEFAULT =
0- PLAYER_HP_CUR_DEFAULT =
30- PLAYER_HP_MAX_DEFAULT =
30- PLAYER_STAM_CUR_DEFAULT =
20- PLAYER_STAM_MAX_DEFAULT =
20- PLAYER_ATK_LO_DEFAULT =
1- PLAYER_ATK_HI_DEFAULT =
2- PLAYER_DEFENSE_DEFAULT =
5- PLAYER_DEXTERITY_DEFAULT =
5- PLAYER_INVENTORY_DEFAULT =
Inventory.new
- PLAYER_ROX_DEFAULT =
0
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.
Constructor Details
#initialize(options) ⇒ Game
Returns a new instance of Game.
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 |
# File 'lib/gemwarrior/game.rb', line 33 def initialize() # create new world and player self.world = World.new world.player = Player.new({ :description => PLAYER_DESC_DEFAULT, :level => PLAYER_LEVEL_DEFAULT, :xp => PLAYER_XP_DEFAULT, :hp_cur => PLAYER_HP_CUR_DEFAULT, :hp_max => PLAYER_HP_MAX_DEFAULT, :stam_cur => PLAYER_STAM_CUR_DEFAULT, :stam_max => PLAYER_STAM_MAX_DEFAULT, :atk_lo => PLAYER_ATK_LO_DEFAULT, :atk_hi => PLAYER_ATK_HI_DEFAULT, :defense => PLAYER_DEFENSE_DEFAULT, :dexterity => PLAYER_DEXTERITY_DEFAULT, :inventory => PLAYER_INVENTORY_DEFAULT, :rox => PLAYER_ROX_DEFAULT, :cur_coords => world.location_coords_by_name('Home'), :god_mode => .fetch(:god_mode), :beast_mode => .fetch(:beast_mode) }) # 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.
31 32 33 |
# File 'lib/gemwarrior/game.rb', line 31 def eval @eval end |
#repl ⇒ Object
Returns the value of attribute repl.
31 32 33 |
# File 'lib/gemwarrior/game.rb', line 31 def repl @repl end |
#world ⇒ Object
Returns the value of attribute world.
31 32 33 |
# File 'lib/gemwarrior/game.rb', line 31 def world @world end |