gemwarrior 0.4.0 → 0.4.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/README.md +11 -6
- data/bin/gemwarrior +1 -1
- data/gemwarrior.gemspec +1 -1
- data/lib/gemwarrior/entities/creature.rb +27 -0
- data/lib/gemwarrior/entities/entity.rb +20 -0
- data/lib/gemwarrior/entities/item.rb +22 -0
- data/lib/gemwarrior/{location.rb → entities/location.rb} +14 -12
- data/lib/gemwarrior/entities/monster.rb +53 -0
- data/lib/gemwarrior/{player.rb → entities/player.rb} +127 -62
- data/lib/gemwarrior/evaluator.rb +26 -12
- data/lib/gemwarrior/game.rb +19 -20
- data/lib/gemwarrior/misc/player_levels.rb +6 -0
- data/lib/gemwarrior/{version.rb → misc/version.rb} +6 -6
- data/lib/gemwarrior/{wordlist.rb → misc/wordlist.rb} +0 -0
- data/lib/gemwarrior/repl.rb +2 -2
- data/lib/gemwarrior/world.rb +308 -280
- metadata +15 -11
- data/lib/gemwarrior/creature.rb +0 -53
- data/lib/gemwarrior/item.rb +0 -30
- data/lib/gemwarrior/monster.rb +0 -55
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemwarrior
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Chadwick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|
@@ -158,18 +158,20 @@ files:
|
|
158
158
|
- Rakefile
|
159
159
|
- bin/gemwarrior
|
160
160
|
- gemwarrior.gemspec
|
161
|
-
- lib/gemwarrior/creature.rb
|
162
161
|
- lib/gemwarrior/defaults.rb
|
162
|
+
- lib/gemwarrior/entities/creature.rb
|
163
|
+
- lib/gemwarrior/entities/entity.rb
|
164
|
+
- lib/gemwarrior/entities/item.rb
|
165
|
+
- lib/gemwarrior/entities/location.rb
|
166
|
+
- lib/gemwarrior/entities/monster.rb
|
167
|
+
- lib/gemwarrior/entities/player.rb
|
163
168
|
- lib/gemwarrior/evaluator.rb
|
164
169
|
- lib/gemwarrior/game.rb
|
165
170
|
- lib/gemwarrior/inventory.rb
|
166
|
-
- lib/gemwarrior/
|
167
|
-
- lib/gemwarrior/
|
168
|
-
- lib/gemwarrior/
|
169
|
-
- lib/gemwarrior/player.rb
|
171
|
+
- lib/gemwarrior/misc/player_levels.rb
|
172
|
+
- lib/gemwarrior/misc/version.rb
|
173
|
+
- lib/gemwarrior/misc/wordlist.rb
|
170
174
|
- lib/gemwarrior/repl.rb
|
171
|
-
- lib/gemwarrior/version.rb
|
172
|
-
- lib/gemwarrior/wordlist.rb
|
173
175
|
- lib/gemwarrior/world.rb
|
174
176
|
- spec/rubywarrior_spec.rb
|
175
177
|
- spec/spec_helper.rb
|
@@ -193,8 +195,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
195
|
version: '0'
|
194
196
|
requirements: []
|
195
197
|
rubyforge_project:
|
196
|
-
rubygems_version: 2.4.
|
198
|
+
rubygems_version: 2.4.5
|
197
199
|
signing_key:
|
198
200
|
specification_version: 4
|
199
201
|
summary: RPG as RubyGem
|
200
|
-
test_files:
|
202
|
+
test_files:
|
203
|
+
- spec/rubywarrior_spec.rb
|
204
|
+
- spec/spec_helper.rb
|
data/lib/gemwarrior/creature.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# lib/gemwarrior/creature.rb
|
2
|
-
# Creature base class
|
3
|
-
|
4
|
-
require_relative 'inventory'
|
5
|
-
|
6
|
-
module Gemwarrior
|
7
|
-
class Creature
|
8
|
-
# CONSTANTS
|
9
|
-
CREATURE_NAME_DEFAULT = 'Creature'
|
10
|
-
CREATURE_DESCRIPTION_DEFAULT = 'A creature of some sort.'
|
11
|
-
CREATURE_FACE_DEFAULT = 'calm'
|
12
|
-
CREATURE_HANDS_DEFAULT = 'smooth'
|
13
|
-
CREATURE_MOOD_DEFAULT = 'happy'
|
14
|
-
|
15
|
-
attr_accessor :id, :name, :description, :face, :hands, :mood,
|
16
|
-
:level, :hp_cur, :hp_max, :inventory
|
17
|
-
|
18
|
-
def initialize(
|
19
|
-
id,
|
20
|
-
name = CREATURE_NAME_DEFAULT,
|
21
|
-
description = CREATURE_DESCRIPTION_DEFAULT,
|
22
|
-
face = CREATURE_FACE_DEFAULT,
|
23
|
-
hands = CREATURE_HANDS_DEFAULT,
|
24
|
-
mood = CREATURE_MOOD_DEFAULT,
|
25
|
-
level = 1,
|
26
|
-
hp_cur = 10,
|
27
|
-
hp_max = 10,
|
28
|
-
inventory = Inventory.new
|
29
|
-
)
|
30
|
-
self.id = id
|
31
|
-
self.name = name
|
32
|
-
self.description = description
|
33
|
-
self.face = face
|
34
|
-
self.hands = hands
|
35
|
-
self.mood = mood
|
36
|
-
|
37
|
-
self.level = level
|
38
|
-
self.hp_cur = hp_cur
|
39
|
-
self.hp_max = hp_max
|
40
|
-
|
41
|
-
self.inventory = inventory
|
42
|
-
end
|
43
|
-
|
44
|
-
def describe
|
45
|
-
self.description
|
46
|
-
end
|
47
|
-
|
48
|
-
def status
|
49
|
-
status_text = "[#{name}][LVL: #{level}][HP:#{hp_cur}|#{hp_max}]\n"
|
50
|
-
status_text << "Its face is #{face}, hands are #{hands}, and general mood is #{mood}."
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
data/lib/gemwarrior/item.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# lib/gemwarrior/item.rb
|
2
|
-
# Item base class
|
3
|
-
|
4
|
-
module Gemwarrior
|
5
|
-
class Item
|
6
|
-
attr_accessor :id, :name, :description,
|
7
|
-
:atk_lo, :atk_hi, :takeable, :equippable, :equipped
|
8
|
-
|
9
|
-
def initialize(
|
10
|
-
id,
|
11
|
-
name,
|
12
|
-
description,
|
13
|
-
atk_lo,
|
14
|
-
atk_hi,
|
15
|
-
takeable,
|
16
|
-
equippable,
|
17
|
-
equipped = false
|
18
|
-
)
|
19
|
-
self.id = id
|
20
|
-
self.name = name
|
21
|
-
self.description = description
|
22
|
-
self.atk_lo = atk_lo
|
23
|
-
self.atk_hi = atk_hi
|
24
|
-
self.takeable = takeable
|
25
|
-
self.equippable = equippable
|
26
|
-
self.equipped = equipped
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
data/lib/gemwarrior/monster.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
# lib/gemwarrior/monster.rb
|
2
|
-
# Monster creature
|
3
|
-
|
4
|
-
require_relative 'creature'
|
5
|
-
|
6
|
-
module Gemwarrior
|
7
|
-
class Monster < Creature
|
8
|
-
attr_accessor :xp, :atk_hi, :atk_lo, :dexterity, :rox, :xp_to_give, :battlecry
|
9
|
-
|
10
|
-
def initialize(
|
11
|
-
id,
|
12
|
-
name,
|
13
|
-
description,
|
14
|
-
face,
|
15
|
-
hands,
|
16
|
-
mood,
|
17
|
-
level,
|
18
|
-
hp_cur,
|
19
|
-
hp_max,
|
20
|
-
atk_lo,
|
21
|
-
atk_hi,
|
22
|
-
dexterity,
|
23
|
-
inventory,
|
24
|
-
rox,
|
25
|
-
xp_to_give,
|
26
|
-
battlecry
|
27
|
-
)
|
28
|
-
self.id = id
|
29
|
-
self.name = name
|
30
|
-
self.description = description
|
31
|
-
self.face = face
|
32
|
-
self.hands = hands
|
33
|
-
self.mood = mood
|
34
|
-
|
35
|
-
self.level = level
|
36
|
-
self.hp_cur = hp_cur
|
37
|
-
self.hp_max = hp_max
|
38
|
-
|
39
|
-
self.atk_lo = atk_lo
|
40
|
-
self.atk_hi = atk_hi
|
41
|
-
self.dexterity = dexterity
|
42
|
-
|
43
|
-
self.inventory = inventory
|
44
|
-
self.rox = rox
|
45
|
-
self.xp_to_give = xp_to_give
|
46
|
-
|
47
|
-
self.battlecry = battlecry
|
48
|
-
end
|
49
|
-
|
50
|
-
def take_damage(dmg)
|
51
|
-
self.hp_cur = hp_cur.to_i - dmg.to_i
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|