From ae526e8112acf34a956a598dbfd18df5c3b995ad Mon Sep 17 00:00:00 2001 From: Michael Chadwick Date: Wed, 24 Jun 2015 15:28:55 -0700 Subject: [PATCH] arena, and path to it, added; arena_door and arena_master added; will implement actual arena mechanic later --- data/locations.yml | 58 ++++++++++++++++++- lib/gemwarrior/entities/items/arena_door.rb | 19 ++++++ lib/gemwarrior/entities/items/arena_master.rb | 48 +++++++++++++++ lib/gemwarrior/entities/items/bed.rb | 2 +- lib/gemwarrior/entities/items/couch.rb | 2 +- lib/gemwarrior/entities/items/floor_tile.rb | 2 +- lib/gemwarrior/entities/items/gun.rb | 2 +- lib/gemwarrior/entities/items/herb.rb | 2 +- lib/gemwarrior/entities/items/ladder.rb | 2 +- lib/gemwarrior/entities/items/massive_door.rb | 4 +- lib/gemwarrior/entities/items/rope.rb | 2 +- lib/gemwarrior/entities/items/snowman.rb | 2 +- lib/gemwarrior/entities/items/sparklything.rb | 2 +- lib/gemwarrior/entities/items/tent.rb | 2 +- lib/gemwarrior/entities/items/tower_switch.rb | 2 +- lib/gemwarrior/entities/items/waterfall.rb | 2 +- lib/gemwarrior/evaluator.rb | 15 ++++- lib/gemwarrior/misc/version.rb | 2 +- 18 files changed, 150 insertions(+), 20 deletions(-) create mode 100644 lib/gemwarrior/entities/items/arena_door.rb create mode 100644 lib/gemwarrior/entities/items/arena_master.rb diff --git a/data/locations.yml b/data/locations.yml index 5a64e76..148e6f0 100644 --- a/data/locations.yml +++ b/data/locations.yml @@ -690,7 +690,7 @@ - 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 @@ -698,13 +698,65 @@ 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.' diff --git a/lib/gemwarrior/entities/items/arena_door.rb b/lib/gemwarrior/entities/items/arena_door.rb new file mode 100644 index 0000000..fb0f08c --- /dev/null +++ b/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 diff --git a/lib/gemwarrior/entities/items/arena_master.rb b/lib/gemwarrior/entities/items/arena_master.rb new file mode 100644 index 0000000..efda4cd --- /dev/null +++ b/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 diff --git a/lib/gemwarrior/entities/items/bed.rb b/lib/gemwarrior/entities/items/bed.rb index 9bb7771..96e14e8 100644 --- a/lib/gemwarrior/entities/items/bed.rb +++ b/lib/gemwarrior/entities/items/bed.rb @@ -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.' diff --git a/lib/gemwarrior/entities/items/couch.rb b/lib/gemwarrior/entities/items/couch.rb index 582533b..716f498 100644 --- a/lib/gemwarrior/entities/items/couch.rb +++ b/lib/gemwarrior/entities/items/couch.rb @@ -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} diff --git a/lib/gemwarrior/entities/items/floor_tile.rb b/lib/gemwarrior/entities/items/floor_tile.rb index 938ac9e..d6318f3 100644 --- a/lib/gemwarrior/entities/items/floor_tile.rb +++ b/lib/gemwarrior/entities/items/floor_tile.rb @@ -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 diff --git a/lib/gemwarrior/entities/items/gun.rb b/lib/gemwarrior/entities/items/gun.rb index bafb7af..1ff8c52 100644 --- a/lib/gemwarrior/entities/items/gun.rb +++ b/lib/gemwarrior/entities/items/gun.rb @@ -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 diff --git a/lib/gemwarrior/entities/items/herb.rb b/lib/gemwarrior/entities/items/herb.rb index c9efbe4..20c2a6d 100644 --- a/lib/gemwarrior/entities/items/herb.rb +++ b/lib/gemwarrior/entities/items/herb.rb @@ -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)} diff --git a/lib/gemwarrior/entities/items/ladder.rb b/lib/gemwarrior/entities/items/ladder.rb index 7ef13f4..aca8bb7 100644 --- a/lib/gemwarrior/entities/items/ladder.rb +++ b/lib/gemwarrior/entities/items/ladder.rb @@ -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 diff --git a/lib/gemwarrior/entities/items/massive_door.rb b/lib/gemwarrior/entities/items/massive_door.rb index f23cfa3..3870baf 100644 --- a/lib/gemwarrior/entities/items/massive_door.rb +++ b/lib/gemwarrior/entities/items/massive_door.rb @@ -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 diff --git a/lib/gemwarrior/entities/items/rope.rb b/lib/gemwarrior/entities/items/rope.rb index 2f18a6b..4dc5505 100644 --- a/lib/gemwarrior/entities/items/rope.rb +++ b/lib/gemwarrior/entities/items/rope.rb @@ -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 diff --git a/lib/gemwarrior/entities/items/snowman.rb b/lib/gemwarrior/entities/items/snowman.rb index 2f492ca..e740295 100644 --- a/lib/gemwarrior/entities/items/snowman.rb +++ b/lib/gemwarrior/entities/items/snowman.rb @@ -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 diff --git a/lib/gemwarrior/entities/items/sparklything.rb b/lib/gemwarrior/entities/items/sparklything.rb index da32935..ce682df 100644 --- a/lib/gemwarrior/entities/items/sparklything.rb +++ b/lib/gemwarrior/entities/items/sparklything.rb @@ -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} diff --git a/lib/gemwarrior/entities/items/tent.rb b/lib/gemwarrior/entities/items/tent.rb index 3be4d8e..f39a3eb 100644 --- a/lib/gemwarrior/entities/items/tent.rb +++ b/lib/gemwarrior/entities/items/tent.rb @@ -16,7 +16,7 @@ def initialize self.equipped = false end - def use(inventory = nil) + def use(player = nil) {:type => 'action', :data => 'rest'} end end diff --git a/lib/gemwarrior/entities/items/tower_switch.rb b/lib/gemwarrior/entities/items/tower_switch.rb index a8d6f00..d26ff3c 100644 --- a/lib/gemwarrior/entities/items/tower_switch.rb +++ b/lib/gemwarrior/entities/items/tower_switch.rb @@ -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 diff --git a/lib/gemwarrior/entities/items/waterfall.rb b/lib/gemwarrior/entities/items/waterfall.rb index 091356f..c53f57c 100644 --- a/lib/gemwarrior/entities/items/waterfall.rb +++ b/lib/gemwarrior/entities/items/waterfall.rb @@ -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 diff --git a/lib/gemwarrior/evaluator.rb b/lib/gemwarrior/evaluator.rb index 6790aad..19d2631 100644 --- a/lib/gemwarrior/evaluator.rb +++ b/lib/gemwarrior/evaluator.rb @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/lib/gemwarrior/misc/version.rb b/lib/gemwarrior/misc/version.rb index f0327a9..e8b30b1 100644 --- a/lib/gemwarrior/misc/version.rb +++ b/lib/gemwarrior/misc/version.rb @@ -2,5 +2,5 @@ # Version of Gem Warrior module Gemwarrior - VERSION = "0.7.8" + VERSION = "0.7.9" end