Skip to content

Commit

Permalink
shifty_woman has a quest associated with her now and the sand_jewel i…
Browse files Browse the repository at this point in the history
…tem has been added to the game; she will now appear at the beginning of the emerald fight if you've given her what she wants (but that encounter needs work); added debug command to see and change world instance_variables; bug fixes
  • Loading branch information
michaelchadwick committed Aug 26, 2015
1 parent 04f7d31 commit 4c47e5d
Show file tree
Hide file tree
Showing 10 changed files with 237 additions and 88 deletions.
61 changes: 38 additions & 23 deletions data/default_world.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,19 @@ locations:
begin: 5
end: 20
excl: false
items: []
items:
- !ruby/object:Gemwarrior::SandJewel
equipped: false
consumable: false
used: false
number_of_uses:
talkable: false
name: sand_jewel
name_display: Sand Jewel
description: As blue (or is it violet? or brown?) as it is brittle, this shiny rock feels warm to the touch.
takeable: true
useable: true
equippable: false
monsters_abounding: []
bosses_abounding:
- !ruby/object:Gemwarrior::Garynetty
Expand Down Expand Up @@ -1274,15 +1286,15 @@ locations:
- !ruby/object:Gemwarrior::Location
name: plains-south_southeast
name_display: Plains (South-Southeast)
description: The river continues to flow north of you, as plains stretch out all
description: A path north of you descends into a valley, but otherwise the plains stretch out all
around. The noise from the east is quite loud, and a building can be seen in the
near distance.
coords:
:x: 6
:y: 3
:z: 0
locs_connected:
:north: false
:north: true
:east: true
:south: false
:west: true
Expand Down Expand Up @@ -1472,15 +1484,14 @@ locations:
name: plains-north_of_bridge
name_display: Plains (North of Bridge)
description: North of the river feels similar to south of the river, as you continue
to be surrounded by grass and grass and, well, grass. A path to the east stretches
out into a valley.
to be surrounded by grass and grass and, well, grass.
coords:
:x: 4
:y: 5
:z: 0
locs_connected:
:north: false
:east: true
:east: false
:south: true
:west: true
danger_level: :low
Expand All @@ -1493,19 +1504,19 @@ locations:
bosses_abounding: []
checked_for_monsters: false
- !ruby/object:Gemwarrior::Location
name: peridover_valley-outskirts_west
name_display: Peridover Valley (Outskirts (West))
name: peridover_valley-south
name_display: Peridover Valley (South)
description: The road slopes down slightly here, but in the near distance you can
see that it slopes way more slopily.
see that it slopes way more slopily. A mighty river ends in a bay to your west.
coords:
:x: 5
:y: 5
:x: 6
:y: 4
:z: 0
locs_connected:
:north: false
:east: true
:south: false
:west: true
:north: true
:east: false
:south: true
:west: false
danger_level: :low
monster_level_range: !ruby/range
begin: 2
Expand All @@ -1527,8 +1538,8 @@ locations:
locs_connected:
:north: false
:east: true
:south: false
:west: true
:south: true
:west: false
danger_level: :moderate
monster_level_range: !ruby/range
begin: 3
Expand All @@ -1539,8 +1550,8 @@ locations:
bosses_abounding: []
checked_for_monsters: false
- !ruby/object:Gemwarrior::Location
name: peridover_valley-outskirts_east
name_display: Peridover Valley (Outskirts (East))
name: peridover_valley-northeast
name_display: Peridover Valley (Northeast)
description: Sloping way down to the west, but leveling off here, a din of civilization
calls from the north.
coords:
Expand Down Expand Up @@ -1749,7 +1760,7 @@ locations:
number_of_uses:
talkable: true
name: shifty_woman
name: Shifty Woman
name_display: Shifty Woman
description: Sharply dressed with impeccable style, you still can't shake the feeling that this
otherwise ordinary woman is up to something. It might be the way she almost impulsively looks
back and forth along the town street while rubbing her hands together menacingly.
Expand Down Expand Up @@ -2104,11 +2115,11 @@ locations:
hands: tantalizing
mood: enraged
level: 15
hp_cur: 32
hp_max: 32
hp_cur: 100
hp_max: 100
atk_lo: 28
atk_hi: 44
defense: 5
defense: 6
dexterity: 9
inventory: !ruby/object:Gemwarrior::Inventory
armor:
Expand All @@ -2131,6 +2142,8 @@ locations:
ha ha ha! Prepare yourself fool: today your whole life crumbles!'
is_boss: true
is_dead: false
talkable: true
useable: true
checked_for_monsters: false
- !ruby/object:Gemwarrior::Location
name: sky_tower-lounge
Expand Down Expand Up @@ -2299,4 +2312,6 @@ player: !ruby/object:Gemwarrior::Player
rests_taken: 0
deaths: 0
emerald_beaten: false
shifty_jeweled: false
shifty_to_jewel: false
duration:
31 changes: 22 additions & 9 deletions lib/gemwarrior/battle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class Battle
BEAST_MODE_ATTACK = 100
ESCAPE_TEXT = '** POOF **'

attr_accessor :world, :player, :monster, :player_is_defending
attr_accessor :world,
:player,
:monster,
:player_is_defending

def initialize(options)
self.world = options.fetch(:world)
Expand All @@ -19,12 +22,13 @@ def initialize(options)
self.player_is_defending = false
end

def start(is_arena = nil, is_event = nil)
def start(is_arena = false, is_event = false)
Audio.play_synth(:battle_start)

# begin battle!
print_battle_header unless is_arena

# print opponent announcement, depending on reason for battle
if is_arena
print ' Your opponent is now...'
Animation.run(phrase: "#{monster.name.upcase}", speed: :slow, oneline: true)
Expand All @@ -37,12 +41,21 @@ def start(is_arena = nil, is_event = nil)

puts " #{monster.name} cries out: \"#{monster.battlecry}\""

# first strike!
unless is_arena
if monster_strikes_first?(is_event)
puts " #{monster.name} strikes first!".colorize(:yellow)
monster_attacks_player
# first strike! (unless arena or emerald)
# shifty woman time, if emerald
if monster.name.eql?('emerald')
if world.shifty_to_jewel && !world.shifty_has_jeweled
puts
puts ' Suddenly, the Shifty Woman appears out of nowhere, and stands between you and Emerald!'
STDIN.getc
Person.new.speak('Hey! The developer hasn\'t figured out what I\'m here to do, but I really hope you can defeat Emerald! Also, thanks for the shiny jewel!')
STDIN.getc
puts ' The Shifty Woman\'s perplexing speech now over, she disappears.'
world.shifty_has_jeweled = true
end
elsif monster_strikes_first?(arena_battle: is_arena, event_battle: is_event)
puts " #{monster.name} strikes first!".colorize(:yellow)
monster_attacks_player
end

# main battle loop
Expand Down Expand Up @@ -259,8 +272,8 @@ def take_damage(entity, dmg)
end

# MONSTER
def monster_strikes_first?(is_event = nil)
if (monster.dexterity > player.dexterity) || is_event
def monster_strikes_first?(arena_battle = false, event_battle = false)
if (monster.dexterity > player.dexterity) || event_battle || !arena_battle
return true
else
dex_diff = player.dexterity - monster.dexterity
Expand Down
2 changes: 1 addition & 1 deletion lib/gemwarrior/entities/creature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def initialize
self.used = false
end

def use
def use(world)
'That creature does not seem to want to talk to you right now.'
end

Expand Down
21 changes: 21 additions & 0 deletions lib/gemwarrior/entities/items/sand_jewel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# lib/gemwarrior/entities/items/sand_jewel.rb
# Entity::Item::SandJewel

require_relative '../item'

module Gemwarrior
class SandJewel < Item
def initialize
super

self.name = 'sand_jewel'
self.name_display = 'Sand Jewel'
self.description = 'As blue (or is it violet? or brown?) as it is brittle, this shiny rock feels warm to the touch.'
end

def use(world)
puts 'You lift the sand jewel to the sky; rays of sunlight refract through it and nearly blind you.'
{ type: nil, data: nil }
end
end
end
8 changes: 6 additions & 2 deletions lib/gemwarrior/entities/monster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ module Gemwarrior
class Monster < Creature
ITEM_POOL = [Herb.new, Bullet.new]

attr_accessor :battlecry,
:is_boss,
attr_accessor :battlecry,
:is_boss,
:is_dead

def initialize
super

self.inventory = Inventory.new
self.useable = true
self.talkable = true
self.is_dead = false
3.times do
if [true, false].sample
Expand All @@ -43,6 +45,8 @@ def describe_detailed
desc_text << "DEX : #{dexterity}\n".colorize(:white)
desc_text << "ROX : #{rox}\n".colorize(:white)
desc_text << "INV : #{inventory.list_contents}\n".colorize(:white)
desc_text << "TALK? #{talkable}\n".colorize(:white)
desc_text << "USE? #{useable}\n".colorize(:white)
desc_text
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/gemwarrior/entities/monsters/bosses/emerald.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def initialize
self.mood = 'enraged'

self.level = 15
self.hp_cur = rand((level * 3)..(level * 4))
self.hp_cur = rand((level * 6)..(level * 7))
self.hp_max = hp_cur
self.atk_lo = rand(level..(level * 2.5).floor)
self.atk_hi = rand((level * 2.5).floor..(level * 3).floor)
Expand All @@ -32,6 +32,8 @@ def initialize
self.rox = rand((level * 9)..(level * 11))
self.xp = rand((level * 13)..(level * 15))

self.talkable = true
self.useable = true
self.is_boss = true
end

Expand Down
45 changes: 42 additions & 3 deletions lib/gemwarrior/entities/people/shifty_woman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

module Gemwarrior
class ShiftyWoman < Person
# CONSTANTS
SHOO_TEXT = '** BAMF **'

def initialize
super

Expand All @@ -16,11 +19,47 @@ def initialize
def use(world)
if self.used
puts 'Attempting a friendly overture again, the woman turns and looks directly at you. Her brown eyes glint in the sun, almost turning an ochre hue. Her look burns you to the core, causing you to physically recoil a little.'
puts
puts 'You step back a few paces and quickly look elsewhere.'
STDIN.getc
puts 'She then growls in a low voice at you:'
speak('Have you heard of Emerald, the good-for-nothing wizard that doomed our little world of Jool by absconding with the SparklyThing(tm)?')
STDIN.getc
puts 'Before you can even begin to answer she throws up her hands and continues, stealing a look off to the side:'
speak('My life was fine before that idiot decided he needed MORE power than he already has.')
STDIN.getc
puts 'She crosses her arms and looks down, seemingly in thought. One of her hands rolls around, a small flicker of light dancing around it as it moves.'
STDIN.getc
speak("If only I had some #{"tanzanite".colorize(:blue)}...I could cook up a spell that would take down ol' Em faster than he could lift a wand!")
STDIN.getc
if world.player.inventory.contains_item?('sand_jewel')
puts 'Her head tilts upward, ever so slightly, and she looks at you, one eyebrow cocked:'
speak('I can sense you might have what I need. I know you want to get rid of Emerald and take back the SparklyThing(tm) to give to our beloved queen, too.')
STDIN.getc
speak('I can help. Just give me that little piece of shiny you somehow came across in your travels, and I\'ll do everything in my power to make our shared goal a reality.')
print 'Give the shifty woman your Sand Jewel? (y/n) '
answer = gets.chomp.downcase

case answer
when 'y', 'yes'
world.player.inventory.remove_item('sand_jewel')
world.shifty_to_jewel = true
speak('Yes...this will do nicely.')
STDIN.getc
speak('Forgive me, but I must take my leave for now. When the time is right, I will return!')
puts 'And with that, she disappears. No puff of smoke or magical to-do...she is just no more.'
else
speak('Bah! Begone, fool!')

Animation.run(phrase: SHOO_TEXT)
puts

puts "An aura of electric light surrounds her as you are physically pushed back a foot or so. You feel instantly, uh, #{WordList.new('adjective').get_random_value}."
end
else
puts 'She grumbles to herself a little before giving you a little "shoo" and recommences looking shifty.'
end
else
puts 'The woman averts her eyes from you as you commence with a greeting, giving a little scowl while she is at it.'

self.used = true
end

Expand Down
Loading

0 comments on commit 4c47e5d

Please sign in to comment.