Skip to content

Commit

Permalink
arena, and path to it, added; arena_door and arena_master added; will…
Browse files Browse the repository at this point in the history
… implement actual arena mechanic later
  • Loading branch information
michaelchadwick committed Jun 24, 2015
1 parent 2541c84 commit ae526e8
Show file tree
Hide file tree
Showing 18 changed files with 150 additions and 20 deletions.
58 changes: 55 additions & 3 deletions data/locations.yml
Expand Up @@ -690,21 +690,73 @@

-
name: 'Plains (South of River)'
description: 'A raging river borders the northern side of this bucolic vista.'
description: 'A raging river borders the northern side of this bucolic vista. Much raucous noise comes from the east.'
danger_level: :low
coords:
x: 5
y: 3
z: 0
locs_connected:
north: false
east: false
east: true
south: true
west: true
monster_level_range:
lo: 2
hi: 3


-
name: 'Plains (South-Southeast)'
description: 'The river continues to flow north of you, as plains stretch out all around. The noise from the east is quite loud, and a building can be seen in the near distance.'
danger_level: :low
coords:
x: 6
y: 3
z: 0
locs_connected:
north: false
east: true
south: false
west: true
monster_level_range:
lo: 2
hi: 3

-
name: 'Plains (Arena Entrance)'
description: 'Well above the noise of the raging river nearby, the din of the mighty Arena reaches its near fever-pitch just outside. The door, and battle, beckons.'
danger_level: :low
coords:
x: 7
y: 3
z: 0
locs_connected:
north: false
east: true
south: false
west: true
monster_level_range:
lo: 2
hi: 3
items:
- ArenaDoor

-
name: 'Arena'
description: 'Dangerous and risky, the Arena allows would-be monster-slayers and adventurers fight against an infinite number of beasts in order to test their mettle and improve their skill...for a small fee, of course.'
danger_level: :none
coords:
x: 8
y: 3
z: 0
locs_connected:
north: false
east: false
south: false
west: true
items:
- ArenaMaster

-
name: 'Plains (South of Bridge)'
description: 'To the north of these fields lies a bridge that may be crossable.'
Expand Down
19 changes: 19 additions & 0 deletions lib/gemwarrior/entities/items/arena_door.rb
@@ -0,0 +1,19 @@
# lib/gemwarrior/entities/items/arena_door.rb
# Item::ArenaDoor

require_relative '../item'

module Gemwarrior
class ArenaDoor < Item
def initialize
self.name = 'arena_door'
self.description = 'The Arena is massive, with its numerous columns and stone walls stretching to the sky, but its entrance door is no slouch, keeping apace. Made of reinforced granite and impossible to break down, it nevertheless opens for you while battles are in session.'
self.atk_lo = nil
self.atk_hi = nil
self.takeable = false
self.useable = false
self.equippable = false
self.equipped = false
end
end
end
48 changes: 48 additions & 0 deletions lib/gemwarrior/entities/items/arena_master.rb
@@ -0,0 +1,48 @@
# lib/gemwarrior/entities/items/arena_master.rb
# Item::ArenaMaster

require_relative '../item'

module Gemwarrior
class ArenaMaster < Item
# CONSTANTS
ARENA_FEE = 50

def initialize
self.name = 'arena_master'
self.description = 'She wears simple clothing, but carries herself with an air of authority. You think she may be the person to talk with if you want to engage in battle.'
self.atk_lo = nil
self.atk_hi = nil
self.takeable = false
self.useable = true
self.equippable = false
self.equipped = false
end

def use(player = nil)
puts 'You approach the Arena Master and ask to fight. She snickers to herself, but sees you have a good spirit about you.'
puts

if player.rox >= 50
puts "She asks for the requisite payment: #{ARENA_FEE} rox. Do you pay up? (Y/N)"
answer = gets.chomp.downcase
case answer
when 'y', 'yes'
puts 'She pockets the money and motions toward the center of the arena. She reminds you that you will be facing an ever-worsening onslaught of monsters. Each one you dispatch nets you a bonus cache of rox in addition to whatever the monster gives you. You will also become more experienced the longer you last. Finally, you can give up at any time between battles.'
puts
puts 'She finishes by wishing you good luck!'

return {:type => 'arena', :data => nil}
else
puts 'She gives you a dirty look, as you have obviously wasted her time. You are told not to mess around with her anymore, and she turns away from you.'
puts
return {:type => nil, :data => nil}
end
else
puts 'She can tell you seem particularly poor today and says to come back when that has changed.'
puts
return {:type => nil, :data => nil}
end
end
end
end
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/bed.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
Animation::run({:phrase => '** ZZZZZ **'})
puts 'You unmake the bed, get under the covers, close your eyes, and begin to think about all the things you need to do today. You realize sleep is not one of them and quickly get back up, remake the bed, and get on about your day.'
puts '>> You regain a few hit points.'
Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/couch.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'Your body comes to rest somewhere below the surface of the cloudy apparatus, almost as if it were floating *amongst* the couch. The feeling is heavenly, and you actually feel somewhat better after getting back up.'
puts '>> You regain a hit point.'
{:type => 'rest', :data => 1}
Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/floor_tile.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'You slowly lower your foot onto the tile, and then gently depress it, through the floor. Your whole body begins to feel light, lifeless. You black out.'
puts

Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/gun.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'You pull the trigger on the gun, but realize there are no bullets in it. So, it does not do much except cause a barely audible *click* sound.'
{:type => nil, :data => nil}
end
Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/herb.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'You place the herb in your mouth, testing its texture. The mysterious herb is easily chewable, and you are able to swallow it without much effort. Slight tingles travel up and down your spine.'
puts '>> You regain a few hit points.'
{:type => 'health', :data => rand(3..5)}
Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/ladder.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'You grab onto the shaky, rough-hewn, wooden ladder with all your might and start to descend, being extra careful not to loose your grip, which with every moment becomes shakier and shakier.'
puts

Expand Down
4 changes: 2 additions & 2 deletions lib/gemwarrior/entities/items/massive_door.rb
Expand Up @@ -16,9 +16,9 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'You attempt to open the seriously massive door that separates you from Emerald himself.'
if inventory.has_item?('keystone')
if player.inventory.has_item?('keystone')
puts 'The keystone in your inventory glows as you approach the incredibly titanic-sized door, so you naturally pull it out and thrust it into the stone-shaped depression within the cloudy obstruction. The door "opens" in a way and you can now pass through.'
{:type => 'move', :data => 'Sky Tower (Throne Room)'}
else
Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/rope.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'You hold on to the rope with both hands and begin to climb upwards towards the small opening in the ceiling.'
puts

Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/snowman.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'You go to touch the snowy softness of the snowman when it magically comes to life! The frozen homunculus grabs you by the wrist and tosses you to the ground, only to follow this up by jumping onto you with its full, freezing, force. Your body, and mind, go numb.'
puts

Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/sparklything.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'Everything, and I mean *everything*, begins to sparkle. Huh.'
puts
{:type => nil, :data => nil}
Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/tent.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
{:type => 'action', :data => 'rest'}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/tower_switch.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'You move the switch from "No" to "Yes". Suddenly, a great wind picks up and you are gently lifted up by it. The ground moves away and your whole body begins to gently drift towards Emerald\'s compound high in the stratosphere.'
puts

Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/items/waterfall.rb
Expand Up @@ -16,7 +16,7 @@ def initialize
self.equipped = false
end

def use(inventory = nil)
def use(player = nil)
puts 'You stretch out your hand and touch the waterfall. It stings you with its cold and forceful gushing. Your hand is now wet and rougher than before. In time, it will dry.'
{:type => 'dmg', :data => rand(0..1)}
end
Expand Down
15 changes: 13 additions & 2 deletions lib/gemwarrior/evaluator.rb
Expand Up @@ -171,6 +171,15 @@ def evaluate(input)
end
end
end
when 'rox', 'r', '$'
unless param2.nil?
param2 = param2.to_i
if param2.is_a? Numeric
if param2 >= 0
world.player.rox = param2
end
end
end
else
return ERROR_DEBUG_STAT_PARAM_INVALID
end
Expand Down Expand Up @@ -257,7 +266,7 @@ def evaluate(input)
location_inventory.each do |i|
if i.name.eql?(item_name)
if i.useable
result = i.use(world.player.inventory)
result = i.use(world.player)
else
return ERROR_USE_PARAM_UNUSEABLE
end
Expand All @@ -269,7 +278,7 @@ def evaluate(input)
player_inventory.each do |i|
if i.name.eql?(item_name)
if i.useable
result = i.use(world.player.inventory)
result = i.use(world.player)
else
return ERROR_USE_PARAM_UNUSEABLE
end
Expand Down Expand Up @@ -299,6 +308,8 @@ def evaluate(input)
if result[:data].eql?('rest')
world.player.rest(world)
end
when 'arena'
return 'You enter the arena and fight some battles. It was cool, but not as cool as if it were actually implemented.'
else
return
end
Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/misc/version.rb
Expand Up @@ -2,5 +2,5 @@
# Version of Gem Warrior

module Gemwarrior
VERSION = "0.7.8"
VERSION = "0.7.9"
end

0 comments on commit ae526e8

Please sign in to comment.