Skip to content

Commit 2c39df3

Browse files
fixed battle 'slow' bug; changed almost all ruby 1.9 hash syntax to proper 2.0; colorized some more main menu option headers
1 parent 2772ca4 commit 2c39df3

29 files changed

+196
-176
lines changed

lib/gemwarrior/battle.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Battle
1111
BEAST_MODE_ATTACK = 100
1212

1313
## MESSAGES
14-
TEXT_ESCAPE = 'POOF'
14+
ESCAPE_TEXT = '** POOF **'
1515

1616
attr_accessor :world, :player, :monster, :player_is_defending
1717

@@ -38,7 +38,7 @@ def start(is_arena = nil, is_event = nil)
3838

3939
if is_arena
4040
print 'Your opponent is now...'
41-
Animation::run(phrase: "#{monster.name.upcase}!", speed: slow)
41+
Animation::run(phrase: "#{monster.name.upcase}!", speed: :slow)
4242
elsif is_event
4343
puts "You are attacked by #{monster.name}!"
4444
else
@@ -218,7 +218,7 @@ def take_damage(entity, dmg)
218218
end
219219

220220
print who_gets_wounded
221-
Animation::run({ phrase: dmg.to_s, speed: slow, oneline: true, alpha: false, random: false })
221+
Animation::run(phrase: dmg.to_s, speed: :slow, oneline: true, alpha: false, random: false)
222222
print " point(s)!\n"
223223
end
224224

@@ -355,7 +355,7 @@ def player_escape?(is_arena)
355355
# STATUS TEXT
356356

357357
def print_escape_text
358-
Animation::run(phrase: '** POOF **', oneline: true)
358+
Animation::run(phrase: ESCAPE_TEXT, oneline: true)
359359
end
360360

361361
def print_battle_line

lib/gemwarrior/entities/items/arena_master.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def initialize
2121
end
2222

2323
def use(player = nil)
24-
puts "You approach #{ARENA_MASTER_NAME.colorize(:color => :white, :background => :black)}, the Arena Master, and ask to prove your mettle in the arena. She snickers to herself, but sees you have a good spirit about you."
24+
puts "You approach #{ARENA_MASTER_NAME.colorize(color: :white, background: :black)}, the Arena Master, and ask to prove your mettle in the arena. She snickers to herself, but sees you have a good spirit about you."
2525
puts
2626

2727
if player.rox >= 50
@@ -34,15 +34,15 @@ def use(player = nil)
3434
puts
3535
puts 'She finishes by wishing you good luck!'
3636

37-
return {:type => 'arena', :data => nil}
37+
return { type: 'arena', data: nil }
3838
else
3939
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.'
40-
return {:type => nil, :data => nil}
40+
return { type: nil, data: nil }
4141
end
4242
else
4343
puts 'She can tell you seem particularly poor today and says to come back when that has changed.'
4444
puts
45-
return {:type => nil, :data => nil}
45+
return { type: nil, data: nil }
4646
end
4747
end
4848
end

lib/gemwarrior/entities/items/bed.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
module Gemwarrior
77
class Bed < Item
8+
# CONSTANTS
9+
USE_TEXT = '** ZZZZZ **'
10+
811
def initialize
912
self.name = 'bed'
1013
self.description = 'The place where you sleep when you are not adventuring.'
@@ -19,12 +22,12 @@ def initialize
1922
def use(player = nil)
2023
if player.at_full_hp?
2124
puts 'You feel perfectly healthy and decide not to actually use the bed. Besides, the trail of fire ants currently leading up to and around the furniture seem somehow uninviting.'
22-
{:type => nil, :data => nil}
25+
{ type: nil, data: nil }
2326
else
24-
Animation::run({:phrase => '** ZZZZZ **'})
27+
Animation::run(phrase: USE_TEXT)
2528
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.'
2629
puts '>> You regain a few hit points.'
27-
{:type => 'rest', :data => 5}
30+
{ type: 'rest', data: 5 }
2831
end
2932
end
3033
end

lib/gemwarrior/entities/items/couch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def use(player = nil)
2222
else
2323
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.'
2424
puts '>> You regain a hit point.'
25-
{:type => 'rest', :data => 1}
25+
{ type: 'rest', data: 1 }
2626
end
2727
end
2828
end

lib/gemwarrior/entities/items/floor_tile.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
require_relative '../item'
55

66
module Gemwarrior
7+
# CONSTANTS
8+
MOVE_TEXT = '*** SHOOOOOM ***'
9+
710
class FloorTile < Item
811
def initialize
912
self.name = 'floor_tile'
@@ -23,9 +26,9 @@ def use(player = nil)
2326
# stats
2427
player.movements_made += 1
2528

26-
Animation::run({ :phrase => '*** SHOOOOOM ***' })
29+
Animation::run(phrase: MOVE_TEXT)
2730

28-
{:type => 'move', :data => 'Rock Piles'}
31+
{ type: 'move', data: 'Rock Piles' }
2932
end
3033
end
3134
end

lib/gemwarrior/entities/items/gun.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def initialize
1818

1919
def use(player = nil)
2020
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.'
21-
{:type => nil, :data => nil}
21+
{ type: nil, data: nil }
2222
end
2323
end
2424
end

lib/gemwarrior/entities/items/herb.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ def use(player = nil)
2121
puts 'You place the entire, smallish plant 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.'
2222
if player.at_full_hp?
2323
puts '>> The herb has no medicinal effect, as you already feel perfectly healthy, but it was kind of tasty.'
24-
{:type => nil, :data => nil}
24+
{ type: nil, data: nil }
2525
else
2626
puts '>> You regain a few hit points.'
27-
{:type => 'health', :data => rand(3..5)}
27+
{ type: 'health', data: rand(3..5) }
2828
end
2929
end
3030
end

lib/gemwarrior/entities/items/ladder.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
module Gemwarrior
77
class Ladder < Item
8+
# CONSTANTS
9+
USE_TEXT = '*** THUMP ***'
10+
811
def initialize
912
self.name = 'ladder'
1013
self.description = 'Rickety and crudely-fashioned, this ladder descends down into the dropoff, hopefully heading towards something...anything.'
@@ -23,12 +26,12 @@ def use(player = nil)
2326
# stats
2427
player.movements_made += 1
2528

26-
Animation::run({ :phrase => '*** THUMP ***' })
29+
Animation::run(phrase: USE_TEXT)
2730

2831
puts 'The last couple of steps are more slippery than you anticipated, so you end up fumbling them, falling a few feet onto the hard ground below. When you regain your composure, you notice your conveyance for descending is now far above you and it is, unfortunately, your closest known exit.'
2932
puts
3033

31-
{:type => 'move_dangerous', :data => 'Metal Tunnel (South Entrance)'}
34+
{ type: 'move_dangerous', data: 'Metal Tunnel (South Entrance)' }
3235
end
3336
end
3437
end

lib/gemwarrior/entities/items/letter.rb

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ def use(player = nil)
2929
print "\n"
3030
print_letter(player)
3131
else
32-
{:type => nil, :data => nil}
32+
{ type: nil, data: nil }
3333
end
3434
else
3535
self.used = true
3636
print_letter(player)
37-
{:type => 'xp', :data => 3}
37+
{ type: 'xp', data: 3 }
3838
end
3939
end
4040

@@ -43,28 +43,28 @@ def use(player = nil)
4343
def print_letter(player)
4444
puts 'The words of the queen echo in your head as you read the royal note sent to you again:'
4545
puts
46-
Animation::run({phrase: " Dear #{player.name},", speed: :insane})
46+
Animation::run(phrase: " Dear #{player.name},", speed: :insane)
4747
puts
48-
Animation::run({phrase: ' Oh, my! Jool is in trouble! The evil wizard/sorceror/conjuror/rocksmith/wily ', speed: :insane})
49-
Animation::run({phrase: " Emerald has absconded with our ShinyThing(tm)! It is vital that you, #{player.name}, ", speed: :insane})
50-
Animation::run({phrase: ' go to his tower in the sky in order to retrieve it before he does something', speed: :insane})
51-
Animation::run({phrase: ' terrible with it!', speed: :insane})
48+
Animation::run(phrase: ' Oh, my! Jool is in trouble! The evil wizard/sorceror/conjuror/rocksmith/wily ', speed: :insane)
49+
Animation::run(phrase: " Emerald has absconded with our ShinyThing(tm)! It is vital that you, #{player.name}, ", speed: :insane)
50+
Animation::run(phrase: ' go to his tower in the sky in order to retrieve it before he does something', speed: :insane)
51+
Animation::run(phrase: ' terrible with it!', speed: :insane)
5252
puts
53-
Animation::run({phrase: ' Remember that one time you came to the castle, trying to sell stones you', speed: :insane})
54-
Animation::run({phrase: ' pilfered from a nearby cave? Remember how I laughed and told you to leave', speed: :insane})
55-
Animation::run({phrase: ' at once or I\'d have the royal guard take your head off? Ha!', speed: :insane})
53+
Animation::run(phrase: ' Remember that one time you came to the castle, trying to sell stones you', speed: :insane)
54+
Animation::run(phrase: ' pilfered from a nearby cave? Remember how I laughed and told you to leave', speed: :insane)
55+
Animation::run(phrase: ' at once or I\'d have the royal guard take your head off? Ha!', speed: :insane)
5656
puts
57-
Animation::run({phrase: ' What a fool I was to cast such a special person out, as a mysterious stranger', speed: :insane})
58-
Animation::run({phrase: " in the night told me, before mysteriously disappearing, that you, #{player.name},", speed: :insane})
59-
Animation::run({phrase: ' are actually the only one who can save us (for some reason, but that\'s', speed: :insane})
60-
Animation::run({phrase: ' mysterious strangers for you, right?)!', speed: :insane})
57+
Animation::run(phrase: ' What a fool I was to cast such a special person out, as a mysterious stranger', speed: :insane)
58+
Animation::run(phrase: " in the night told me, before mysteriously disappearing, that you, #{player.name},", speed: :insane)
59+
Animation::run(phrase: ' are actually the only one who can save us (for some reason, but that\'s', speed: :insane)
60+
Animation::run(phrase: ' mysterious strangers for you, right?)!', speed: :insane)
6161
puts
62-
Animation::run({phrase: ' Please, I beg of you, save Jool from the potential terror that Emerald could', speed: :insane})
63-
Animation::run({phrase: " possibly wreak on all of us before it is too late! If you do, you, #{player.name},", speed: :insane})
64-
Animation::run({phrase: ' will be rewarded handsomely!', speed: :insane})
62+
Animation::run(phrase: ' Please, I beg of you, save Jool from the potential terror that Emerald could', speed: :insane)
63+
Animation::run(phrase: " possibly wreak on all of us before it is too late! If you do, you, #{player.name},", speed: :insane)
64+
Animation::run(phrase: ' will be rewarded handsomely!', speed: :insane)
6565
puts
66-
Animation::run({phrase: ' Sincerely,', speed: :insane});
67-
Animation::run({phrase: ' Queen Ruby', speed: :insane});
66+
Animation::run(phrase: ' Sincerely,', speed: :insane);
67+
Animation::run(phrase: ' Queen Ruby', speed: :insane);
6868
end
6969
end
7070
end

lib/gemwarrior/entities/items/map.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def initialize
1919
def use(player = nil)
2020
puts 'You unfold the piece of worn canvas, and study the markings upon it.'
2121

22-
{:type => 'action', :data => 'map'}
22+
{ type: 'action', data: 'map' }
2323
end
2424
end
2525
end

0 commit comments

Comments
 (0)