Olib 0.1.2 → 2.0.0.pre.rc.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.
Files changed (69) hide show
  1. checksums.yaml +5 -5
  2. data/Olib.gemspec +1 -1
  3. data/README.md +0 -0
  4. data/TODOS.md +0 -0
  5. data/lib/Olib.rb +6 -79
  6. data/lib/Olib/actor/actor.rb +0 -0
  7. data/lib/Olib/area.rb +22 -37
  8. data/lib/Olib/bounty.rb +8 -10
  9. data/lib/Olib/character/char.rb +64 -68
  10. data/lib/Olib/character/disk.rb +31 -9
  11. data/lib/Olib/character/group.rb +122 -40
  12. data/lib/Olib/character/inventory.rb +0 -0
  13. data/lib/Olib/character/mind.rb +0 -0
  14. data/lib/Olib/character/stance.rb +0 -0
  15. data/lib/Olib/combat/creature.rb +77 -128
  16. data/lib/Olib/combat/creatures.rb +52 -36
  17. data/lib/Olib/core/action.rb +8 -0
  18. data/lib/Olib/core/container.rb +32 -236
  19. data/lib/Olib/core/containers.rb +42 -0
  20. data/lib/Olib/core/errors.rb +69 -71
  21. data/lib/Olib/core/exist.rb +88 -0
  22. data/lib/Olib/core/item.rb +43 -598
  23. data/lib/Olib/core/kinds.rb +6 -0
  24. data/lib/Olib/core/rummage.rb +42 -0
  25. data/lib/Olib/core/transaction.rb +53 -0
  26. data/lib/Olib/core/use.rb +2 -5
  27. data/lib/Olib/core/utils.rb +25 -123
  28. data/lib/Olib/core/verbs.rb +304 -0
  29. data/lib/Olib/dictionary/dictionary.rb +150 -150
  30. data/lib/Olib/ext/hash.rb +7 -0
  31. data/lib/Olib/ext/matchdata.rb +14 -0
  32. data/lib/Olib/ext/string.rb +9 -0
  33. data/lib/Olib/ext/symbol.rb +13 -0
  34. data/lib/Olib/go2.rb +48 -112
  35. data/lib/Olib/loot.rb +44 -0
  36. data/lib/Olib/npcs/npc.rb +4 -0
  37. data/lib/Olib/npcs/npcs.rb +45 -0
  38. data/lib/Olib/objects/box.rb +1 -1
  39. data/lib/Olib/objects/clothing.rb +1 -1
  40. data/lib/Olib/objects/herb.rb +1 -1
  41. data/lib/Olib/objects/jar.rb +0 -0
  42. data/lib/Olib/objects/jewel.rb +7 -7
  43. data/lib/Olib/objects/jewelry.rb +1 -1
  44. data/lib/Olib/objects/scroll.rb +1 -1
  45. data/lib/Olib/objects/uncommon.rb +1 -1
  46. data/lib/Olib/objects/wand.rb +1 -1
  47. data/lib/Olib/pattern_matching/any.rb +11 -0
  48. data/lib/Olib/pattern_matching/err.rb +4 -0
  49. data/lib/Olib/pattern_matching/ok.rb +4 -0
  50. data/lib/Olib/pattern_matching/outcome.rb +35 -0
  51. data/lib/Olib/pattern_matching/pattern_matching.rb +5 -0
  52. data/lib/Olib/pattern_matching/result.rb +80 -0
  53. data/lib/Olib/pattern_matching/rill.rb +43 -0
  54. data/lib/Olib/pattern_matching/where.rb +4 -0
  55. data/lib/Olib/shops.rb +147 -155
  56. data/lib/Olib/supervisor/supervisor.rb +0 -0
  57. data/lib/Olib/version.rb +1 -1
  58. data/lib/Olib/xml.rb +43 -0
  59. metadata +28 -15
  60. data/lib/Olib/core/extender.rb +0 -29
  61. data/lib/Olib/interface/queryable.rb +0 -50
  62. data/lib/Olib/npcs.rb +0 -5
  63. data/lib/Olib/pattern.rb +0 -34
  64. data/lib/Olib/storage/app_data.rb +0 -32
  65. data/lib/Olib/try/try.rb +0 -58
  66. data/lib/Olib/utils/cli.rb +0 -81
  67. data/lib/Olib/utils/help_menu.rb +0 -166
  68. data/lib/Olib/utils/monsterbold.rb +0 -5
  69. data/lib/Olib/utils/vbulletin.rb +0 -101
@@ -1,19 +1,41 @@
1
+
1
2
  class Disk
2
- attr_accessor :owner, :full
3
+ NOUNS = %w{disk coffin}
4
+
5
+ def self.is_disk?(thing)
6
+ NOUNS.include?(thing.noun)
7
+ end
8
+
9
+ def self.find_by_name(name)
10
+ disk = GameObj.loot.find do |item|
11
+ is_disk?(item) && item.name.include?(name)
12
+ end
13
+ return nil if disk.nil?
14
+ Disk.new(disk)
15
+ end
3
16
 
4
- def initialize(owner)
5
- @owner = owner
6
- @full = false
7
- GameObj.loot.find do |item|
8
- item.name.downcase =~/#{owner.downcase}/
17
+ def self.all()
18
+ (GameObj.loot || []).select do |item|
19
+ is_disk?(item)
20
+ end.map do |i|
21
+ Disk.new(i)
9
22
  end
10
23
  end
11
24
 
12
- def add(item)
25
+ attr_reader :id, :name
26
+
27
+ def initialize(obj)
28
+ @id = obj.id
29
+ @name = obj.name.split(" ").find do |word|
30
+ word[0].upcase.eql?(word[0])
31
+ end
32
+ end
13
33
 
34
+ def method_missing(method, *args)
35
+ GameObj[@id].send(method, *args)
14
36
  end
15
37
 
16
- def full?
17
- @full
38
+ def to_container
39
+ Container.new(@id)
18
40
  end
19
41
  end
@@ -1,30 +1,5 @@
1
1
  require "ostruct"
2
-
3
-
4
- class String
5
- def is_i?
6
- !!(self =~ /\A[-+]?[0-9]+\z/)
7
- end
8
- end
9
-
10
-
11
- class MatchData
12
- def to_struct
13
- OpenStruct.new to_hash
14
- end
15
-
16
- def to_hash
17
- Hash[self.names.zip(self.captures.map(&:strip).map do |capture|
18
- if capture.is_i? then capture.to_i else capture end
19
- end)]
20
- end
21
- end
22
-
23
- class Hash
24
- def to_struct
25
- OpenStruct.new self
26
- end
27
- end
2
+ require "Olib/character/disk"
28
3
 
29
4
  module Group
30
5
  class Members
@@ -59,18 +34,27 @@ module Group
59
34
  end
60
35
 
61
36
  def each(&block)
62
- @members.each { |char| yield char }
37
+ @members.each do |char| yield char end
63
38
  self
64
39
  end
65
40
 
66
41
  def include?(pc)
67
- select { |char| char.name == pc }
42
+ return true if pc.is_a?(String) and Char.name.eql?(pc)
43
+ return true if pc.respond_to?(:noun) and Char.name.eql?(pc.noun)
44
+ return true if pc.respond_to?(:name) and Char.name.eql?(pc.name)
45
+ !find do |char|
46
+ if pc.is_a?(String)
47
+ char.noun.eql?(pc)
48
+ else
49
+ char.noun.eql?(pc.noun) || char.noun.eql?(pc.name)
50
+ end
51
+ end.nil?
68
52
  end
69
53
 
70
54
  def nonmembers
71
- (GameObj.pcs || []).reject do |pc|
72
- @members.include?(pc)
73
- end
55
+ ((GameObj.pcs || []) + Disk.all()).reject do |pc|
56
+ include?(pc)
57
+ end
74
58
  end
75
59
 
76
60
  def to_s
@@ -79,13 +63,15 @@ module Group
79
63
  end
80
64
 
81
65
  class Member
82
- attr :id, :leader
66
+ attr_reader :id, :leader, :name, :noun
83
67
  def initialize(pc, leader = false)
84
68
  @id = pc.id
85
69
  @leader = leader
70
+ @name = pc.name
71
+ @noun = pc.noun
86
72
  end
87
73
 
88
- private def ref
74
+ def ref
89
75
  GameObj[@id]
90
76
  end
91
77
 
@@ -93,10 +79,6 @@ module Group
93
79
  @leader
94
80
  end
95
81
 
96
- def name
97
- ref.name.split.pop
98
- end
99
-
100
82
  def status
101
83
  (ref.status.split(" ") || []).map(&:to_sym)
102
84
  end
@@ -113,7 +95,6 @@ module Group
113
95
  "<#{name}: @leader=#{leader?} @status=#{status}>"
114
96
  end
115
97
  end
116
-
117
98
  MEMBERS = Members.new
118
99
  OPEN = :open
119
100
  CLOSED = :closed
@@ -123,8 +104,7 @@ module Group
123
104
  STATE = /^Your group status is currently (?<state>open|closed)\./
124
105
  END_GROUP = /list of other options\./
125
106
 
126
- PARSER = Proc.new do |line|
127
-
107
+ PARSER = Proc.new do |line|
128
108
  if line.strip.empty? || line =~ NO_GROUP
129
109
  nil
130
110
  elsif line =~ STATE
@@ -174,17 +154,26 @@ module Group
174
154
  MEMBERS
175
155
  end
176
156
 
157
+ def Group.disks
158
+ return [Disk.find_by_name(Char.name)].compact unless Group.leader?
159
+ members.map(&:name).map do |name|
160
+ Disk.find_by_name(name)
161
+ end.compact
162
+ end
163
+
177
164
  def Group.to_s
178
165
  MEMBERS.to_s
179
166
  end
180
167
 
181
168
  # ran at the initialization of a script
182
169
  def Group.check
170
+ Group.unobserve()
183
171
  @@checked = false
184
172
  MEMBERS.clear!
185
173
  DownstreamHook.add(CHECK_HOOK, PARSER)
186
174
  Game._puts "<c>group\r\n"
187
175
  wait_until { Group.checked? }
176
+ Group.observe()
188
177
  MEMBERS
189
178
  end
190
179
 
@@ -203,4 +192,97 @@ module Group
203
192
  def Group.leader?
204
193
  leader && leader.name == Char.name
205
194
  end
195
+
196
+
197
+ module Term
198
+ # <a exist="-10467645" noun="Oreh">Oreh</a> leaves your group
199
+ # <a exist="-10467645" noun="Oreh">Oreh</a> joins your group.
200
+ # You add <a exist="-10467645" noun="Oreh">Oreh</a> to your group.
201
+ # You remove <a exist="-10467645" noun="Oreh">Oreh</a> from the group.
202
+ JOIN = %r{^<a exist="(?<id>[\d-]+)" noun="(?<noun>[A-Za-z]+)">(?<name>\w+?)</a> joins your group.$}
203
+ LEAVE = %r{^<a exist="(?<id>[\d-]+)" noun="(?<noun>[A-Za-z]+)">(?<name>\w+?)</a> leaves your group.$}
204
+ ADD = %r{^You add <a exist="(?<id>[\d-]+)" noun="(?<noun>[A-Za-z]+)">(?<name>\w+?)</a> to your group.$}
205
+ REMOVE = %r{^You remove <a exist="(?<id>[\d-]+)" noun="(?<noun>[A-Za-z]+)">(?<name>\w+?)</a> from the group.$}
206
+ NOOP = %r{^But <a exist="(?<id>[\d-]+)" noun="(?<noun>[A-Za-z]+)">(?<name>\w+?)</a> is already a member of your group!$}
207
+ EXIST = %r{<a exist="(?<id>[\d-]+)" noun="(?<noun>[A-Za-z]+)">(?<name>\w+?)</a>}
208
+ ANY = Regexp.union(JOIN, LEAVE, ADD, REMOVE, NOOP)
209
+ end
210
+
211
+ GROUP_OBSERVER = -> line {
212
+ begin
213
+ return line if DownstreamHook.list.include?(CHECK_HOOK)
214
+ Group.consume(line.strip)
215
+ rescue => exception
216
+ respond exception
217
+ respond exception.backtrace
218
+ end
219
+ line
220
+ }
221
+
222
+ def self.observe()
223
+ wait_while do DownstreamHook.list.include?(CHECK_HOOK) end
224
+ DownstreamHook.add("__group_observer", GROUP_OBSERVER)
225
+ end
226
+
227
+ def self.unobserve()
228
+ DownstreamHook.remove("__group_observer")
229
+ end
230
+
231
+ Group.observe()
232
+
233
+ def self.consume(line)
234
+ return unless line.match(Group::Term::ANY)
235
+ person = GameObj[Term::EXIST.match(line)[:id]]
236
+ case line
237
+ when Term::JOIN
238
+ Group.members.add(person) unless Group.members.include?(person)
239
+ when Term::ADD
240
+ Group.members.add(person) unless Group.members.include?(person)
241
+ when Term::NOOP
242
+ Group.members.add(person) unless Group.members.include?(person)
243
+ when Term::LEAVE
244
+ Group.members.members.delete(Group.members.find do |member|
245
+ member.id.eql?(person.id)
246
+ end)
247
+ when Term::REMOVE
248
+ Group.members.members.delete(Group.members.find do |member|
249
+ member.id.eql?(person.id)
250
+ end)
251
+ else
252
+ # silence is golden
253
+ end
254
+ Group.persist()
255
+ end
256
+
257
+ def self.add(*members)
258
+ members.map do |member|
259
+ if member.is_a?(Array)
260
+ Group.add(*member)
261
+ else
262
+ result = dothistimeout("group ##{member.id}", 3, Regexp.union(
263
+ %r{You add #{member.noun} to your group},
264
+ %r{#{member.noun}'s group status is closed},
265
+ %r{But #{member.noun} is already a member of your group}))
266
+
267
+ case result
268
+ when %r{You add}
269
+ Group.members.add(member)
270
+ [:ok, member]
271
+ when %r{already a member}
272
+ [:noop, member]
273
+ when %r{closed}
274
+ [:err, member]
275
+ else
276
+ end
277
+ end
278
+ end
279
+ end
280
+
281
+ def self.persist()
282
+ return
283
+ end
284
+
285
+ def self.broken?
286
+ (GameObj.pcs.to_a.map(&:noun) & Group.members.map(&:noun)).size.eql?(Group.members.size)
287
+ end
206
288
  end
File without changes
File without changes
File without changes
@@ -6,36 +6,9 @@
6
6
  # - add known spells/cmans/manuevers and algorithm for danger level by profession and skills
7
7
  require "ostruct"
8
8
  require "Olib/combat/creatures"
9
+ require "Olib/core/exist"
9
10
 
10
- class FalseClass
11
- def to_i
12
- 0
13
- end
14
- end
15
- class TrueClass
16
- def to_i
17
- 1
18
- end
19
- end
20
-
21
- class Regexp
22
- def or(re)
23
- Regexp.new self.to_s + "|" + re.to_s
24
- end
25
- # define union operator for regex instance
26
- def |(re)
27
- self.or(re)
28
- end
29
- end
30
-
31
- class Symbol
32
- def to_game
33
- self.to_s.gsub("_", " ")
34
- end
35
- end
36
-
37
-
38
- class Creature
11
+ class Creature < Exist
39
12
  include Comparable
40
13
 
41
14
  WOUNDS = [
@@ -46,16 +19,17 @@ class Creature
46
19
  ]
47
20
 
48
21
  TAGS = OpenStruct.new(
49
- undead: /zombie|ghost|skele|ghoul|spectral|wight|shade/ |
50
- /spectre|revenant|apparition|bone|were|rotting/ |
51
- /spirit|soul|barghest|vruul|night|phant|naisirc/|
52
- /shrickhen|seraceris|n'ecare|vourkha|bendith/ |
53
- /baesrukha|lich|dybbuk|necrotic|flesh|waern|banshee/|
54
- /seeker|eidolon|decay|putrefied|vaespilon/,
55
22
  antimagic: /construct|Vvrael/,
56
23
  grimswarm: /grimswarm/,
57
24
  lowly: /kobold|rolton|velnalin|urgh/,
58
- trollish: /troll|csetari/
25
+ trollish: /troll|csetari/,
26
+ undead: Regexp.union(
27
+ /zombie|ghost|skele|ghoul|spectral|wight|shade/,
28
+ /spectre|revenant|apparition|bone|were|rotting/,
29
+ /spirit|soul|barghest|vruul|night|phant|naisirc/,
30
+ /shrickhen|seraceris|n'ecare|vourkha|bendith/,
31
+ /baesrukha|lich|dybbuk|necrotic|flesh|waern|banshee/,
32
+ /seeker|eidolon|decay|putrefied|vaespilon/),
59
33
  )
60
34
 
61
35
  def self.tags(name)
@@ -65,95 +39,80 @@ class Creature
65
39
  end
66
40
  end
67
41
 
68
- attr_accessor :wounds, :targetable, :can_cast, :tags,
69
- :data, :legged, :limbed, :id, :name
70
-
42
+ attr_accessor :wounds, :tags
71
43
  def initialize(creature)
72
- @id = creature.id
73
- @name = creature.name
44
+ super(creature)
74
45
  @wounds = {}
75
- @tags = ((creature.type || "").gsub(",", " ").split(" ") + (metadata["tags"] || []) ).map(&:to_sym)
76
- TAGS.each_pair do |tag, pattern|
77
- @tags << tag if @name =~ pattern
78
- end
46
+ @tags = (Exist.normalize_type_data(creature.type) + (metadata["tags"] || []) ).map(&:to_sym)
47
+ TAGS.each_pair do |tag, pattern| @tags << tag if @name =~ pattern end
79
48
  heal
80
49
  end
81
50
 
82
- def level
83
- metadata["level"]
51
+ def tags
52
+ @tags
84
53
  end
85
54
 
86
- def metadata
87
- Creatures::BY_NAME[@name] || {}
88
- end
89
-
90
- def fetch
91
- GameObj[@id]
55
+ def level
56
+ metadata["level"] || Char.level
92
57
  end
93
58
 
94
- def status
95
- fetch.status.split(" ")
59
+ def metadata
60
+ Creatures::BY_NAME[name] || {}
96
61
  end
97
62
 
98
63
  def heal
99
- WOUNDS.each do |location|
100
- @wounds[location] = 0
101
- end
64
+ WOUNDS.each do |location| @wounds[location] = 0 end
102
65
  self
103
66
  end
104
67
 
105
68
  def injuries
106
69
  fput "look ##{@id}"
107
- woundinfo = matchtimeout(2, /(he|she|it) (?:has|appears to be in good) .*/i)
108
- if woundinfo =~ /appears to be in good shape/ then heal; return @wounds; end
109
- if woundinfo =~ /some minor cuts and bruises on (his|her|its) right (?:hind )?leg/ then @wounds[:right_leg] = 1; end
110
- if woundinfo =~ /some minor cuts and bruises on (his|her|its) left (?:hind )?leg/ then @wounds[:left_leg] = 1; end
111
- if woundinfo =~ /some minor cuts and bruises on (his|her|its) (?:right arm|right foreleg)/ then @wounds[:right_arm] = 1; end
112
- if woundinfo =~ /some minor cuts and bruises on (his|her|its) (?:left arm|left foreleg)/ then @wounds[:left_arm] = 1; end
113
- if woundinfo =~ /minor bruises around (his|her|its) neck/ then @wounds[:neck] = 1; end
114
- if woundinfo =~ /minor bruises around (his|her|its) head/ then @wounds[:head] = 1; end
115
- if woundinfo =~ /minor cuts and bruises on (his|her|its) chest/ then @wounds[:chest] = 1; end
116
- if woundinfo =~ /minor cuts and bruises on (his|her|its) abdomen/ then @wounds[:abdomen] = 1; end
117
- if woundinfo =~ /minor cuts and bruises on (his|her|its) back/ then @wounds[:back] = 1; end
118
- if woundinfo =~ /bruised left eye/ then @wounds[:left_eye] = 1; end
119
- if woundinfo =~ /bruised right eye/ then @wounds[:right_eye] = 1; end
120
- if woundinfo =~ /some minor cuts and bruises on (his|her|its) right (?:hand|paw|claw)/ then @wounds[:right_hand] = 1; end
121
- if woundinfo =~ /some minor cuts and bruises on (his|her|its) left (?:hand|paw|claw)/ then @wounds[:left_hand] = 1; end
122
- if woundinfo =~ /a strange case of muscle twitching/ then @wounds[:nerves] = 1; end
123
- if woundinfo =~ /fractured and bleeding right (?:hind )?leg/ then @wounds[:right_leg] = 2; end
124
- if woundinfo =~ /fractured and bleeding left (?:hind )?leg/ then @wounds[:left_leg] = 2; end
125
- if woundinfo =~ /fractured and bleeding (?:right arm|right foreleg)/ then @wounds[:right_arm] = 2; end
126
- if woundinfo =~ /fractured and bleeding (?:left arm|left foreleg)/ then @wounds[:left_arm] = 2; end
127
- if woundinfo =~ /moderate bleeding from (his|her|its) neck/ then @wounds[:neck] = 2; end
128
- if woundinfo =~ /minor lacerations about (his|her|its) head and a possible mild concussion/ then @wounds[:head] = 2; end
129
- if woundinfo =~ /deep lacerations across (his|her|its) chest/ then @wounds[:chest] = 2; end
130
- if woundinfo =~ /deep lacerations across (his|her|its) abdomen/ then @wounds[:abdomen] = 2; end
131
- if woundinfo =~ /deep lacerations across (his|her|its) back/ then @wounds[:back] = 2; end
132
- if woundinfo =~ /swollen left eye/ then @wounds[:left_eye] = 2; end
133
- if woundinfo =~ /swollen right eye/ then @wounds[:right_eye] = 2; end
134
- if woundinfo =~ /fractured and bleeding right (?:hand|paw|claw)/ then @wounds[:right_hand] = 2; end
135
- if woundinfo =~ /fractured and bleeding left (?:hand|paw|claw)/ then @wounds[:left_hand] = 2; end
136
- if woundinfo =~ /a case of sporadic convulsions/ then @wounds[:nerves] = 2; end
137
- if woundinfo =~ /severed right (?:hind )?leg/ then @wounds[:right_leg] = 3; end
138
- if woundinfo =~ /severed left (?:hind )?leg/ then @wounds[:left_leg] = 3; end
139
- if woundinfo =~ /severed (?:right arm|right foreleg)/ then @wounds[:right_arm] = 3; end
140
- if woundinfo =~ /severed (?:left arm|left foreleg)/ then @wounds[:left_arm] = 3; end
141
- if woundinfo =~ /snapped bones and serious bleeding from (his|her|its) neck/ then @wounds[:neck] = 3; end
142
- if woundinfo =~ /severe head trauma and bleeding from (his|her|its) ears/ then @wounds[:head] = 3; end
143
- if woundinfo =~ /deep gashes and serious bleeding from (his|her|its) chest/ then @wounds[:chest] = 3; end
144
- if woundinfo =~ /deep gashes and serious bleeding from (his|her|its) abdomen/ then @wounds[:abdomen] = 3; end
145
- if woundinfo =~ /deep gashes and serious bleeding from (his|her|its) back/ then @wounds[:back] = 3; end
146
- if woundinfo =~ /blinded left eye/ then @wounds[:left_eye] = 3; end
147
- if woundinfo =~ /blinded right eye/ then @wounds[:right_eye] = 3; end
148
- if woundinfo =~ /severed right (?:hand|paw|claw)/ then @wounds[:right_hand] = 3; end
149
- if woundinfo =~ /severed left (?:hand|paw|claw)/ then @wounds[:left_hand] = 3; end
150
- if woundinfo =~ /a case of uncontrollable convulsions/ then @wounds[:nerves] = 3; end
70
+ woundinfo = matchtimeout(2, /(he|she|it) (?:has|appears to be in good) .*/i)
71
+ if woundinfo =~ /appears to be in good shape/ then heal; return @wounds; end
72
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) right (?:hind )?leg/ then @wounds[:right_leg] = 1; end
73
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) left (?:hind )?leg/ then @wounds[:left_leg] = 1; end
74
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) (?:right arm|right foreleg)/ then @wounds[:right_arm] = 1; end
75
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) (?:left arm|left foreleg)/ then @wounds[:left_arm] = 1; end
76
+ if woundinfo =~ /minor bruises around (his|her|its) neck/ then @wounds[:neck] = 1; end
77
+ if woundinfo =~ /minor bruises around (his|her|its) head/ then @wounds[:head] = 1; end
78
+ if woundinfo =~ /minor cuts and bruises on (his|her|its) chest/ then @wounds[:chest] = 1; end
79
+ if woundinfo =~ /minor cuts and bruises on (his|her|its) abdomen/ then @wounds[:abdomen] = 1; end
80
+ if woundinfo =~ /minor cuts and bruises on (his|her|its) back/ then @wounds[:back] = 1; end
81
+ if woundinfo =~ /bruised left eye/ then @wounds[:left_eye] = 1; end
82
+ if woundinfo =~ /bruised right eye/ then @wounds[:right_eye] = 1; end
83
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) right (?:hand|paw|claw)/ then @wounds[:right_hand] = 1; end
84
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) left (?:hand|paw|claw)/ then @wounds[:left_hand] = 1; end
85
+ if woundinfo =~ /a strange case of muscle twitching/ then @wounds[:nerves] = 1; end
86
+ if woundinfo =~ /fractured and bleeding right (?:hind )?leg/ then @wounds[:right_leg] = 2; end
87
+ if woundinfo =~ /fractured and bleeding left (?:hind )?leg/ then @wounds[:left_leg] = 2; end
88
+ if woundinfo =~ /fractured and bleeding (?:right arm|right foreleg)/ then @wounds[:right_arm] = 2; end
89
+ if woundinfo =~ /fractured and bleeding (?:left arm|left foreleg)/ then @wounds[:left_arm] = 2; end
90
+ if woundinfo =~ /moderate bleeding from (his|her|its) neck/ then @wounds[:neck] = 2; end
91
+ if woundinfo =~ /minor lacerations about (his|her|its) head and a possible mild concussion/ then @wounds[:head] = 2; end
92
+ if woundinfo =~ /deep lacerations across (his|her|its) chest/ then @wounds[:chest] = 2; end
93
+ if woundinfo =~ /deep lacerations across (his|her|its) abdomen/ then @wounds[:abdomen] = 2; end
94
+ if woundinfo =~ /deep lacerations across (his|her|its) back/ then @wounds[:back] = 2; end
95
+ if woundinfo =~ /swollen left eye/ then @wounds[:left_eye] = 2; end
96
+ if woundinfo =~ /swollen right eye/ then @wounds[:right_eye] = 2; end
97
+ if woundinfo =~ /fractured and bleeding right (?:hand|paw|claw)/ then @wounds[:right_hand] = 2; end
98
+ if woundinfo =~ /fractured and bleeding left (?:hand|paw|claw)/ then @wounds[:left_hand] = 2; end
99
+ if woundinfo =~ /a case of sporadic convulsions/ then @wounds[:nerves] = 2; end
100
+ if woundinfo =~ /severed right (?:hind )?leg/ then @wounds[:right_leg] = 3; end
101
+ if woundinfo =~ /severed left (?:hind )?leg/ then @wounds[:left_leg] = 3; end
102
+ if woundinfo =~ /severed (?:right arm|right foreleg)/ then @wounds[:right_arm] = 3; end
103
+ if woundinfo =~ /severed (?:left arm|left foreleg)/ then @wounds[:left_arm] = 3; end
104
+ if woundinfo =~ /snapped bones and serious bleeding from (his|her|its) neck/ then @wounds[:neck] = 3; end
105
+ if woundinfo =~ /severe head trauma and bleeding from (his|her|its) ears/ then @wounds[:head] = 3; end
106
+ if woundinfo =~ /deep gashes and serious bleeding from (his|her|its) chest/ then @wounds[:chest] = 3; end
107
+ if woundinfo =~ /deep gashes and serious bleeding from (his|her|its) abdomen/ then @wounds[:abdomen] = 3; end
108
+ if woundinfo =~ /deep gashes and serious bleeding from (his|her|its) back/ then @wounds[:back] = 3; end
109
+ if woundinfo =~ /blinded left eye/ then @wounds[:left_eye] = 3; end
110
+ if woundinfo =~ /blinded right eye/ then @wounds[:right_eye] = 3; end
111
+ if woundinfo =~ /severed right (?:hand|paw|claw)/ then @wounds[:right_hand] = 3; end
112
+ if woundinfo =~ /severed left (?:hand|paw|claw)/ then @wounds[:left_hand] = 3; end
113
+ if woundinfo =~ /a case of uncontrollable convulsions/ then @wounds[:nerves] = 3; end
151
114
  @wounds
152
115
  end
153
-
154
- def status
155
- GameObj[@id].status.split(" ").map(&:to_sym)
156
- end
157
116
 
158
117
  def legged?
159
118
  injuries
@@ -166,7 +125,7 @@ class Creature
166
125
  end
167
126
 
168
127
  def alive?
169
- !dead?
128
+ not dead?
170
129
  end
171
130
 
172
131
  def limbed?
@@ -174,23 +133,10 @@ class Creature
174
133
  @wounds[:right_leg] == 3 || @wounds[:left_leg] == 3 || @wounds[:right_arm] == 3
175
134
  end
176
135
 
177
- def gone?
178
- fetch.nil? ? true : false
179
- end
180
-
181
136
  def prone?
182
137
  status.include?(:lying) || status.include?(:prone) ? true : false
183
138
  end
184
139
 
185
- def eql?(other)
186
- self == other
187
- end
188
-
189
- def ==(other)
190
- @id.to_i == other.id.to_i
191
- end
192
-
193
-
194
140
  def danger
195
141
  status
196
142
  .map do |state| Creatures::STATES.index(state) end
@@ -202,7 +148,7 @@ class Creature
202
148
  end
203
149
 
204
150
  def stunned?
205
- status.include?(:stunned) ? true : false
151
+ status.include?(:stunned)
206
152
  end
207
153
 
208
154
  def kill_shot(order = [:left_eye, :right_eye, :head, :neck, :back], default = :chest)
@@ -223,10 +169,9 @@ class Creature
223
169
  end
224
170
  end
225
171
 
226
-
227
172
  def target
228
- result = dothistimeout "target ##{@id}", 3, /#{Olib::Dictionary.targetable.values.join('|')}/
229
- @targetable = result =~ Olib::Dictionary.targetable[:yes] ? true : false
173
+ result = dothistimeout "target ##{@id}", 3, /#{Dictionary.targetable.values.join('|')}/
174
+ @targetable = (result =~ Dictionary.targetable[:yes])
230
175
  self
231
176
  end
232
177
 
@@ -248,6 +193,14 @@ class Creature
248
193
  self
249
194
  end
250
195
 
196
+ def status()
197
+ super.split(",").map(&:to_sym)
198
+ end
199
+
200
+ def dead?
201
+ status.include?(:dead)
202
+ end
203
+
251
204
  def kill
252
205
  unless dead?
253
206
  fput "kill ##{@id}"
@@ -281,9 +234,5 @@ class Creature
281
234
  fput "skin ##{@id}" if dead?
282
235
  self
283
236
  end
284
-
285
- def to_s
286
- "<#{fetch.name}:#{@id} @danger=#{danger} @tags=#{tags} @status=#{status}>"
287
- end
288
237
  end
289
238