gemwarrior 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/locations.yml +1 -0
- data/lib/gemwarrior/arena.rb +2 -3
- data/lib/gemwarrior/battle.rb +26 -7
- data/lib/gemwarrior/entities/items/opalaser.rb +24 -0
- data/lib/gemwarrior/entities/items/pond.rb +35 -0
- data/lib/gemwarrior/entities/location.rb +8 -0
- data/lib/gemwarrior/evaluator.rb +3 -0
- data/lib/gemwarrior/misc/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d9ee449614471055090e892a1df42560c7aa007
|
|
4
|
+
data.tar.gz: 965e2ba208c084fa2a09560264bc2fc93681c85d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 13103d68009ab62661164fecacd8f959034078e069ce3e150935fc275659fcab5c7450a4b6496078d092f6da88731205b17301b0a11357e28a2851e41af4d0a5
|
|
7
|
+
data.tar.gz: 65b36061328f65a994f5e58fb8321a3b9b97e25aa3e5105c580751555aacb03282ad3513a965b3bde0fa662c5021e11460fef3766834b46e29c1a06b74c15cf5
|
data/data/locations.yml
CHANGED
data/lib/gemwarrior/arena.rb
CHANGED
|
@@ -38,11 +38,10 @@ module Gemwarrior
|
|
|
38
38
|
player.xp = player.xp + bonus_xp
|
|
39
39
|
puts 'You decided you\'ve had enough of the exhausting Arena for one day and exit the main stage.'
|
|
40
40
|
puts "You have gained #{bonus_rox} rox and #{bonus_xp} XP!"
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
return print_arena_outro
|
|
42
43
|
end
|
|
43
44
|
end
|
|
44
|
-
|
|
45
|
-
print_arena_outro
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
private
|
data/lib/gemwarrior/battle.rb
CHANGED
|
@@ -15,17 +15,18 @@ module Gemwarrior
|
|
|
15
15
|
## MESSAGES
|
|
16
16
|
TEXT_ESCAPE = 'POOF'
|
|
17
17
|
|
|
18
|
-
attr_accessor :world, :player, :monster
|
|
18
|
+
attr_accessor :world, :player, :monster, :player_defending
|
|
19
19
|
|
|
20
20
|
def initialize(options)
|
|
21
|
-
self.world
|
|
22
|
-
self.player
|
|
23
|
-
self.monster
|
|
21
|
+
self.world = options.fetch(:world)
|
|
22
|
+
self.player = options.fetch(:player)
|
|
23
|
+
self.monster = options.fetch(:monster)
|
|
24
|
+
self.player_defending = false
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
def start(is_arena = nil, is_event = nil)
|
|
27
28
|
print_battle_line
|
|
28
|
-
|
|
29
|
+
|
|
29
30
|
if is_arena
|
|
30
31
|
print 'Your opponent is now...'
|
|
31
32
|
Animation::run({:phrase => "#{monster.name.upcase}!", :speed => :slow})
|
|
@@ -81,8 +82,21 @@ module Gemwarrior
|
|
|
81
82
|
print "\n"
|
|
82
83
|
puts
|
|
83
84
|
|
|
85
|
+
self.player_defending = false
|
|
86
|
+
|
|
84
87
|
puts 'What do you do?'
|
|
85
|
-
|
|
88
|
+
print '['.colorize(:yellow)
|
|
89
|
+
print 'F'.colorize(:green)
|
|
90
|
+
print 'ight/'.colorize(:yellow)
|
|
91
|
+
print 'A'.colorize(:green)
|
|
92
|
+
print 'ttack]['.colorize(:yellow)
|
|
93
|
+
print 'D'.colorize(:green)
|
|
94
|
+
print 'efend]['.colorize(:yellow)
|
|
95
|
+
print 'L'.colorize(:green)
|
|
96
|
+
print 'ook]['.colorize(:yellow)
|
|
97
|
+
print 'R'.colorize(:green)
|
|
98
|
+
print 'un]'.colorize(:yellow)
|
|
99
|
+
print "\n"
|
|
86
100
|
|
|
87
101
|
cmd = STDIN.gets.chomp.downcase
|
|
88
102
|
|
|
@@ -100,6 +114,9 @@ module Gemwarrior
|
|
|
100
114
|
else
|
|
101
115
|
puts "You miss entirely!".colorize(:yellow)
|
|
102
116
|
end
|
|
117
|
+
when 'defend', 'd'
|
|
118
|
+
puts 'You dig in and defend this round.'
|
|
119
|
+
self.player_defending = true
|
|
103
120
|
when 'look', 'l'
|
|
104
121
|
print "#{monster.name}".colorize(:white)
|
|
105
122
|
print " (#{monster.hp_cur}/#{monster.hp_max} HP): #{monster.description}\n"
|
|
@@ -146,7 +163,9 @@ module Gemwarrior
|
|
|
146
163
|
end
|
|
147
164
|
rand(atk_range)
|
|
148
165
|
else
|
|
149
|
-
rand(monster.atk_lo..monster.atk_hi)
|
|
166
|
+
dmg = rand(monster.atk_lo..monster.atk_hi)
|
|
167
|
+
dmg = dmg - (entity.defense / 2) if player_defending
|
|
168
|
+
return dmg
|
|
150
169
|
end
|
|
151
170
|
end
|
|
152
171
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# lib/gemwarrior/entities/items/opalaser.rb
|
|
2
|
+
# Item::Opalaser
|
|
3
|
+
|
|
4
|
+
require_relative '../item'
|
|
5
|
+
|
|
6
|
+
module Gemwarrior
|
|
7
|
+
class Opalaser < Item
|
|
8
|
+
def initialize
|
|
9
|
+
self.name = 'opalaser'
|
|
10
|
+
self.description = 'Gleaming with supernatural light, this object feels alien, yet familiar.'
|
|
11
|
+
self.atk_lo = 10
|
|
12
|
+
self.atk_hi = 12
|
|
13
|
+
self.takeable = true
|
|
14
|
+
self.useable = true
|
|
15
|
+
self.equippable = true
|
|
16
|
+
self.equipped = false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def use(player = nil)
|
|
20
|
+
puts 'You pull the "trigger" on the opalaser, but nothing happens.'
|
|
21
|
+
{:type => nil, :data => nil}
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# lib/gemwarrior/entities/items/pond.rb
|
|
2
|
+
# Item::Pond
|
|
3
|
+
|
|
4
|
+
require_relative '../item'
|
|
5
|
+
|
|
6
|
+
module Gemwarrior
|
|
7
|
+
class Pond < Item
|
|
8
|
+
# CONTACTS
|
|
9
|
+
NEEDED_ITEMS = ['dehumidifier', 'feather', 'gun', 'stalactite']
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
self.name = 'pond'
|
|
13
|
+
self.description = 'This tiny pool of water self-ripples every minute or so. Small, floating insects buzz around merrily. A small plaque lays at the foot, reading: "If the right objects curious doth possess, touch the water\'s surface and you\'ll get redress."'
|
|
14
|
+
self.atk_lo = nil
|
|
15
|
+
self.atk_hi = nil
|
|
16
|
+
self.takeable = false
|
|
17
|
+
self.useable = true
|
|
18
|
+
self.equippable = false
|
|
19
|
+
self.equipped = false
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def use(player = nil)
|
|
23
|
+
puts 'You gently place your fingers on the pond\'s rippling surface.'
|
|
24
|
+
binding.pry
|
|
25
|
+
if (NEEDED_ITEMS - player.inventory.items.map(&:name)).empty?
|
|
26
|
+
puts 'The pond water explodes with a force that knocks you back onto the ground. When you come to, you notice the depression in the ground where the pond once was now has a new curious object!'
|
|
27
|
+
self.description = 'A barren depression in the ground is all that is left of the pond.'
|
|
28
|
+
return {:type => 'item', :data => 'Opalaser'}
|
|
29
|
+
else
|
|
30
|
+
puts 'You graze your fingers within the pond for a moment, feeling the coolness. You feel zen.'
|
|
31
|
+
return {:type => nil, :data => nil}
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -40,6 +40,14 @@ module Gemwarrior
|
|
|
40
40
|
items.map(&:name).include?(item_name)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
def add_item(item_name)
|
|
44
|
+
Dir.glob('lib/gemwarrior/items/*.rb').each do |item|
|
|
45
|
+
require_relative item[item.index('/', item.index('/')+1)+1..item.length]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
self.items.push(eval(item_name).new)
|
|
49
|
+
end
|
|
50
|
+
|
|
43
51
|
def remove_item(item_name)
|
|
44
52
|
if has_item?(item_name)
|
|
45
53
|
items.reject! { |item| item.name == item_name }
|
data/lib/gemwarrior/evaluator.rb
CHANGED
|
@@ -314,6 +314,9 @@ module Gemwarrior
|
|
|
314
314
|
arena = Arena.new({:world => world, :player => world.player})
|
|
315
315
|
arena.start
|
|
316
316
|
#return 'You enter the arena and fight some battles. It was cool, but not as cool as if it were actually implemented.'
|
|
317
|
+
when 'item'
|
|
318
|
+
world.location_by_coords(world.player.cur_coords).add_item(result[:data])
|
|
319
|
+
return
|
|
317
320
|
else
|
|
318
321
|
return
|
|
319
322
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gemwarrior
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Chadwick
|
|
@@ -194,6 +194,8 @@ files:
|
|
|
194
194
|
- lib/gemwarrior/entities/items/keystone.rb
|
|
195
195
|
- lib/gemwarrior/entities/items/ladder.rb
|
|
196
196
|
- lib/gemwarrior/entities/items/massive_door.rb
|
|
197
|
+
- lib/gemwarrior/entities/items/opalaser.rb
|
|
198
|
+
- lib/gemwarrior/entities/items/pond.rb
|
|
197
199
|
- lib/gemwarrior/entities/items/rope.rb
|
|
198
200
|
- lib/gemwarrior/entities/items/snowman.rb
|
|
199
201
|
- lib/gemwarrior/entities/items/sparklything.rb
|