Class: Gemwarrior::Arena
- Inherits:
-
Object
- Object
- Gemwarrior::Arena
- Defined in:
- lib/gemwarrior/arena.rb
Constant Summary collapse
- BONUS_ROX_MULTIPLIER =
CONSTANTS
25
- BONUS_XP_MULTIPLIER =
10
Instance Attribute Summary collapse
-
#player ⇒ Object
Returns the value of attribute player.
-
#world ⇒ Object
Returns the value of attribute world.
Instance Method Summary collapse
-
#initialize(options) ⇒ Arena
constructor
A new instance of Arena.
- #start ⇒ Object
Constructor Details
#initialize(options) ⇒ Arena
Returns a new instance of Arena.
14 15 16 17 |
# File 'lib/gemwarrior/arena.rb', line 14 def initialize() self.world = .fetch(:world) self.player = .fetch(:player) end |
Instance Attribute Details
#player ⇒ Object
Returns the value of attribute player.
12 13 14 |
# File 'lib/gemwarrior/arena.rb', line 12 def player @player end |
#world ⇒ Object
Returns the value of attribute world.
12 13 14 |
# File 'lib/gemwarrior/arena.rb', line 12 def world @world end |
Instance Method Details
#start ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/gemwarrior/arena.rb', line 19 def start print_arena_intro arena_monsters_vanquished = 0 loop do monster = generate_monster battle = Battle.new(world: world, player: player, monster: monster) result = battle.start(is_arena: true) return 'death' if result.eql?('death') arena_monsters_vanquished += 1 print ' Do you wish to continue fighting in the Arena? (y/n) ' answer = gets.chomp.downcase case answer when 'y', 'yes' puts next else bonus_rox = arena_monsters_vanquished * BONUS_ROX_MULTIPLIER bonus_xp = arena_monsters_vanquished * BONUS_XP_MULTIPLIER player.rox = player.rox + bonus_rox player.xp = player.xp + bonus_xp puts puts ' You decided you\'ve had enough of the exhausting Arena for one day and exit the main stage.' puts " You defeated #{arena_monsters_vanquished} monsters!" puts " You have gained #{bonus_rox} rox and #{bonus_xp} XP!" return print_arena_outro end end end |