Olib 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d63c4db8598a94e507f49ee38a0d42075c249802
4
- data.tar.gz: 1b47aba955227554949aece1785889d75ecbe52d
3
+ metadata.gz: 9444e0a1af442c6bae2e3a598e14fd46fc425339
4
+ data.tar.gz: d6b71051ce755ee9a168f1af77332bf9e99659b2
5
5
  SHA512:
6
- metadata.gz: ac8aee3e69f954a77c0febf0f1c70617f86eb80f720768345a73bec8d6b20fab080c192c81ccf29a154414c87d4f36f0ee3fed91e296aa9cb51ea626d56cfb69
7
- data.tar.gz: d2ea0d4652113982f936130442feaa0664979587e47cb469fabdc5c9d12336976fef89a7fc53c44fe4267925c737edf6b1c7e93e0a7928a98f3488d8c325728c
6
+ metadata.gz: 1e70553557e7d4df9f41324efd47e518f459a1affcac8d4c91a3a5a0e41f3d3cce4d0456b0886775232fb3b47562286948a8647deac1d80959d22043e3d63449
7
+ data.tar.gz: 599506fc2ce7aeb6fca4e90df8954869dbb60ee7a00ef14d9a7729e4b37873cb963c349a8cd955e1eedc8ad6e31fdb9dbb7e94df273a1cb8fa5d2e264b2d51f7
data/lib/Olib.rb CHANGED
@@ -1,8 +1,36 @@
1
+ require 'net/http'
2
+ require 'json'
3
+
1
4
  module Olib
5
+
6
+ def Olib.update_notifier
7
+ begin
8
+ request = Net::HTTP::Get.new('/api/v1/gems/Olib.json', initheader = {'Content-Type' =>'application/json'})
9
+ response = Net::HTTP.new('rubygems.org').start {|http| http.request(request) }
10
+ if response.body =~ /error/
11
+ # silence is golden
12
+ exit
13
+ else
14
+ # check version
15
+ if Gem.loaded_specs["Olib"].version < Gem::Version.new(JSON.parse(response.body)['version'])
16
+ respond "You need to update the Olib gem with a `gem install Olib`"
17
+ end
18
+ end
19
+ rescue
20
+ echo $!
21
+ puts $!.backtrace[0..1]
22
+ end
23
+ end
24
+
25
+ # invoke update notifier immediately
26
+ Olib.update_notifier
27
+
2
28
  def Olib.do(action, re)
3
29
  dothistimeout action, 5, re
4
30
  end
5
31
 
32
+ Vars.Olib ||= Hash.new
33
+
6
34
  require 'Olib/group'
7
35
  require 'Olib/creature'
8
36
  require 'Olib/creatures'
@@ -10,7 +38,11 @@ module Olib
10
38
  require 'Olib/transport'
11
39
  require 'Olib/item'
12
40
  require 'Olib/dictionary'
41
+ require 'Olib/errors'
13
42
  require 'Olib/container'
43
+ require "Olib/inventory"
44
+ require "Olib/shops"
14
45
  require 'Olib/help_menu'
46
+ require "Olib/utils"
15
47
 
16
48
  end
@@ -1,69 +1,73 @@
1
1
  # for defining containers ala lootsack and using them across scripts
2
+
3
+ class String
4
+ def to_class
5
+ Kernel.const_get self
6
+ rescue NameError
7
+ nil
8
+ end
9
+
10
+ def is_a_defined_class?
11
+ true if self.to_class
12
+ rescue NameError
13
+ false
14
+ end
15
+ end
16
+
2
17
  module Olib
3
18
  class Container < Gameobj_Extender
4
- attr_accessor :ref, :types, :full
5
-
6
- def initialize(id)
7
- # set the default value of full being false, we can only know by attempting to add something
8
- @full = false
19
+ attr_accessor :ref
9
20
 
21
+ def initialize(id=nil)
10
22
  # extract the class name to attempt to lookup the item by your settings
11
23
  # ex: class Lootsack
12
24
  # ex: class Gemsack
13
- setting = self.class.name.downcase
25
+ name = self.class.name.downcase.split('::').last.strip
26
+ candidates = Olib.Inventory[Vars[name]]
27
+ raise Olib::Errors::DoesntExist.new("#{name} could not be initialized are you sure you:\n ;var set #{name}=<something>") if candidates.empty? && id.nil?
28
+
29
+ @ref = GameObj[id] || candidates.first
14
30
 
15
- @ref = GameObj[@id] || (GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.send(setting).strip)}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.send(setting)).sub(' ', ' .*')}$/i } || GameObj.inv.find { |obj| obj.name =~ /\b#{Regexp.escape(UserVars.send(setting)).sub(' ', ' .*')}/i })
31
+ unless GameObj[@ref.id].contents
32
+ tops = [
33
+ 'table'
34
+ ]
16
35
 
17
- return "error: failed to find your #{setting.to_s}" unless @ref
18
-
19
- fput "look in ##{@ref.id}" unless GameObj[@ref.id].contents
20
- self._extend(@ref)._constructor
36
+ action = tops.include?(@ref.noun) ? "look on ##{@ref.id}" : "look in ##{@ref.id}"
37
+
38
+ fput action
39
+ end
21
40
 
41
+ super @ref
42
+
43
+ end
44
+
45
+ def contents
46
+ GameObj[@ref.id].contents.map{ |item| Item.new(item) }
22
47
  end
23
48
 
49
+ def where(conditions)
50
+ contents.select { |item|
51
+ conditions.keys.map { |key|
52
+ item.respond_to?(key) ? item.send(key) == conditions[key] : false
53
+ }.include? false
54
+ }
55
+ end
24
56
 
25
- def worn?
26
- GameObj.inv.collect { |item| item.id }.include? @ref.id
57
+ def find_by_tags(*tags)
58
+ contents.select { |item|
59
+ !tags.map {|tag| item.is?(tag) }.include? false
60
+ }
27
61
  end
28
62
 
63
+
29
64
  def [](query)
30
65
  return contents.select do |item|
31
66
  item if (item.type =~ query || item.noun =~ query || item.name =~ query)
32
67
  end
33
68
  end
34
69
 
35
- def contents
36
- contents = []
37
- @types.each do |method, exp| contents.push self.send method.to_sym end
38
- return contents.flatten.uniq(&:id)
39
- end
40
-
41
- def _constructor
42
- singleton = (class << self; self end)
43
- @types = { #method => #regex
44
- "gems" => /gem/,
45
- "boxes" => /box/,
46
- "scrolls" => /scroll/,
47
- "herbs" => /herb/,
48
- "jewelry" => /jewelry/,
49
- "magic" => /magic/,
50
- "clothing" => /clothing/,
51
- "uncommons" => /uncommon/,
52
- "unknowns" => nil
53
- }
54
- @types.each do |method, exp|
55
- singleton.send :define_method, method.to_sym do
56
-
57
- matches = exp.nil? ?
58
- GameObj[@id].contents.select do |item| item.type.nil? end :
59
- GameObj[@id].contents.select do |item| item.type =~ exp end
60
-
61
- matches.map! do |item| eval("Olib::#{method.gsub(/es$/,'').gsub(/s$/, '').capitalize!}").new(item) end
62
-
63
- matches
64
- end
65
- end
66
- end
70
+ def
67
71
 
68
72
  def __verbs__
69
73
  @verbs = 'open close analyze inspect weigh'.split(' ').map(&:to_sym)
@@ -71,19 +75,31 @@ module Olib
71
75
  @verbs.each do |verb|
72
76
  singleton.send :define_method, verb do
73
77
  fput "#{verb.to_s} ##{@id}"
78
+ self
74
79
  end
75
80
  end
76
81
  end
77
82
 
78
83
  def full?
79
- return @full
84
+ is? 'full'
80
85
  end
81
86
 
82
87
  def add(item)
83
- result = Olib.do "_drag ##{item.id} ##{@id}", /#{[Olib::Gemstone_Regex.put[:success], Olib::Gemstone_Regex.put[:failure].values].flatten.join('|')}/
84
- @full = true if result =~ /won't fit in the/
88
+ result = Olib.do "_drag ##{item.id} ##{@id}", /#{[Olib::Dictionary.put[:success], Olib::Dictionary.put[:failure].values].flatten.join('|')}/
89
+ tag 'full' if result =~ /won't fit in the/
85
90
  self
86
91
  end
87
92
  end
88
93
 
94
+ class Lootsack < Container
95
+
96
+ end
97
+
98
+ @@lootsack = nil
99
+
100
+ def Olib.Lootsack
101
+ return @@lootsack if @@lootsack
102
+ @@lootsack = Lootsack.new
103
+ @@lootsack
104
+ end
89
105
  end
data/lib/Olib/creature.rb CHANGED
@@ -1,136 +1,221 @@
1
1
  # enables creature specific logic
2
2
  # TODO
3
3
  # - add flying types
4
-
4
+ # - add corporeal types
5
+ # - add quadrapedal types
6
+ # - add known spells/cmans/manuevers and algorithm for danger level by profession and skills
7
+
5
8
  require 'Olib/extender'
6
9
  require 'Olib/dictionary'
7
-
10
+
8
11
  module Olib
9
12
  class Creature < Gameobj_Extender
10
- attr_accessor :wounds, :targetable, :can_cast, :type, :data, :legged, :limbed
13
+ def Creature.escortee(name)
14
+ name =~ /^(?:traveller|magistrate|merchant|scribe|dignitary|official)$/
15
+ end
16
+
17
+ def Creature.bandit(name)
18
+ name =~ /thief|rogue|bandit|mugger|outlaw|highwayman|marauder|brigand|thug|robber/
19
+ end
20
+
21
+ def Creature.undead(name)
22
+ name =~ /zombie rolton|lesser ghoul|skeleton|lesser frost shade|lesser shade|phantom|moaning phantom|ghost|ice skeleton|greater ghoul|revenant|mist wraith|dark apparition|lesser mummy|firephantom|spectral fisherman|bone golem|snow spectre|death dirge|werebear|darkwoode|spectre|shadowy spectre|wraith|tomb wight|wolfshade|ghoul master|ghost wolf|ghostly warrior|dark assassin|rotting krolvin pirate|elder ghoul master|nedum vereri|arch wight|wood wight|ancient ghoul master|nonomino|zombie|crazed zombie|rotting woodsman|roa'ter wormling|carceris|spectral monk|tree spirit|monastic lich|skeletal lord|moaning spirit|elder tree spirit|krynch|skeletal ice troll|rotting corpse|rotting farmhand|ghostly mara|ghostly pooka|skeletal giant|rock troll zombie|skeletal soldier|spectral warrior|troll wraith|spectral shade|barghest|spectral woodsman|spectral lord|skeletal warhorse|lesser moor wight|shadow mare|shadow steed|vourkha|greater moor wight|forest bendith|spectral miner|bog wraith|phantasma|frozen corpse|baesrukha|night mare|gaunt spectral servant|bog wight|ice wraith|lesser vruul|rotting chimera|dybbuk|necrotic snake|waern|banshee|flesh golem|seeker|ethereal mage apprentice|nightmare steed|eidolon|decaying Citadel guardsman|rotting Citadel arbalester|putrefied Citadel herald|phantasmal bestial swordsman|wind wraith|soul golem|greater vruul|naisirc|shrickhen|seraceris|lich qyn'arj|n'ecare|lost soul|vaespilon|spectral triton defender|ethereal triton sentry/
23
+ end
24
+
25
+ def Creature.antimagic(name)
26
+ name =~ /lesser construct|Vvrael warlock|Vvrael witch/
27
+ end
28
+
29
+ def Creature.living(name)
30
+ name =~ /carrion worm|black rolton|black-winged daggerbeak|fanged rodent|kobold|mountain rolton|giant rat|slimy little grub|young grass snake|fire ant|rolton|spotted gnarp|giant ant|cave gnome|rabid squirrel|big ugly kobold|goblin|pale crab|fanged goblin|brown gak|thyril|spotted gak|sea nymph|Mistydeep siren|dark vysan|greater ice spider|fire salamander|cave nipper|kobold shepherd|relnak|striped relnak|cave gnoll|hobgoblin|Bresnahanini rolton|velnalin|spotted velnalin|striped gak|white vysan|mountain snowcat|troglodyte|black urgh|water moccasin|cobra|urgh|ridge orc|whiptail|spotted leaper|fanged viper|mongrel kobold|night golem|mongrel hobgoblin|bobcat|coyote|water witch|nasty little gremlin|monkey|spotted lynx|cockatrice|leaper|lesser orc|snowy cockatrice|blood eagle|lesser red orc|hobgoblin shaman|shelfae soldier|lesser burrow orc|greater kappa|greater spider|thrak|crystal crab|greater orc|greater burrow orc|albino tomb spider|mottled thrak|brown spinner|crocodile|manticore|rabid guard dog|great boar|raider orc|cave worm|gnoll worker|giant marmot|shelfae chieftain|Neartofar orc|wall guardian|crystal golem|dark orc|great stag|plumed cockatrice|tawny brindlecat|gnoll thief|deranged sentry|Agresh troll scout|forest troll|grey orc|silverback orc|great brown bear|brown boar|giant weasel|black boar|swamp troll|panther|ridgeback boar|luminescent arachnid|gnoll ranger|large ogre|puma|arctic puma|Neartofar troll|black leopard|humpbacked puma|black bear|Agresh troll warrior|mongrel wolfhound|plains orc warrior|cave troll|phosphorescent worm|hill troll|wind witch|fire guardian|mountain ogre|Agresh bear|mongrel troll|red bear|fire rat|banded rattlesnake|mountain troll|spiked cavern urchin|gnoll guard|giant veaba|plains ogre|forest ogre|mountain goat|black panther|dark shambler|plains orc scout|krolvin mercenary|cave lizard|war troll|fire cat|mountain lion|bighorn sheep|shelfae warlord|plains orc shaman|greenwing hornet|plains lion|thunder troll|krolvin warrior|steel golem|gnoll priest|ogre warrior|massive grahnk|major spider|Agresh troll chieftain|striped warcat|Arachne servant|cave bear|plains orc chieftain|cougar|warthog|crested basilisk|dark panther|centaur|fenghai|Arachne acolyte|tree viper|burly reiver|reiver|ice hound|wolverine|veteran reiver|arctic wolverine|giant albino scorpion|krolvin warfarer|gnoll jarl|jungle troll|Arachne priest|Arachne priestess|troll chieftain|cyclops|Grutik savage|lesser stone gargoyle|snow leopard|giant hawk-owl|fire ogre|dobrem|ki-lin|darken|pra'eda|Grutik shaman|ice troll|arctic manticore|scaly burgee|hooded figure|hisskra warrior|giant albino tomb spider|hunter troll|jungle troll chieftain|mammoth arachnid|ash hag|wild hound|caribou|wild dog|giant fog beetle|mezic|three-toed tegu|hisskra shaman|maw spore|moor hound|sand beetle|tundra giant|colossus vulture|hisskra chieftain|moor witch|cold guardian|lava troll|moor eagle|bog troll|shimmering fungus|water wyrd|snow crone|undertaker bat|dust beetle|krolvin slaver|fire giant|arctic titan|Sheruvian initiate|tusked ursian|huge mein golem|magru|mud wasp|grizzly bear|frost giant|wood sprite|krolvin corsair|vesperti|greater bog troll|stone gargoyle|storm giant|myklian|kiramon worker|lesser ice giant|Sheruvian monk|roa'ter|siren lizard|shan wizard|shan warrior|minor glacei|dark vortece|shan cleric|swamp hag|shan ranger|wasp nest|dreadnought raptor|forest trali shaman|firethorn shoot|polar bear|mastodonic leopard|lesser faeroth|kiramon defender|forest trali|cinder wasp|greater ice giant|major glacei|bog spectre|sand devil|warrior shade|horned vor'taz|red-scaled thrak|greater faeroth|snow madrinol|tomb troll|wooly mammoth|ice golem|lesser ice elemental|sabre-tooth tiger|stone sentinel|animated slush|skayl|tomb troll necromancer|stone troll|glacial morph|lava golem|stone giant|massive pyrothag|black forest viper|massive black boar|fire elemental|black forest ogre|stone mastiff|Illoke mystic|massive troll king|ice elemental|Sheruvian harbinger|grifflet|fire sprite|emaciated hierophant|red tsark|Illoke shaman|muscular supplicant|yeti|lesser griffin|hunch-backed dogmatist|krag yeti|fire mage|krag dweller|storm griffin|lesser minotaur|moulis|csetairi|minotaur warrior|farlook|raving lunatic|minotaur magus|dhu goleras|earth elemental|gnarled being|caedera|greater krynch|gremlock|Illoke elder|festering taint|aivren|greater earth elemental|Ithzir scout|Illoke jarl|Ithzir initiate|water elemental|Ithzir janissary|Ithzir herald|triton dissembler|greater construct|Ithzir adept|triton executioner|siren|Ithzir seer|triton combatant|triton radical|war griffin|triton magus|greater water elemental/
31
+ end
32
+
33
+ def Creature.invasion(name)
34
+ name =~ /taladorian/i
35
+ end
36
+
37
+ def Creature.grimswarm(name)
38
+ name =~ /griswarm/i
39
+ end
40
+
41
+ def Creature.animate(name)
42
+ name =~ /animated/
43
+ end
44
+
45
+ def Creature.ignoreable(name)
46
+ name =~ /kobold|rolton|velnalin|urgh/
47
+ end
48
+
49
+ def Creature.self_healing?(name)
50
+ name =~ /troll|csetari/ ? true : false
51
+ end
52
+
53
+ def Creature.tag(name)
54
+ Creature.tags.map { |type|
55
+ Creature.send(type, name) ? type : nil
56
+ }.compact
57
+ end
58
+
59
+ def Creature.tags
60
+ ['undead', 'living', 'antimagic', 'bandit', 'invasion', 'grimswarm', 'ignoreable', 'escortee', 'animate']
61
+ end
11
62
 
63
+ attr_accessor :wounds, :targetable, :can_cast, :tags, :data, :legged, :limbed
64
+
12
65
  def initialize(creature)
13
66
  @wounds = {}
14
67
  @data = {}
15
-
16
- @data[:type] = 'unknown'
17
- @data[:trollish] = creature.name =~ /troll|csetari/ ? true : false
68
+
69
+ tag('trollish') if Creature.self_healing?(creature.name)
18
70
  @data[:incapacitated] = false
19
-
20
- if creature.name =~ Gemstone_Regex.undead then @data[:type] = 'undead'; @targetable = true; end
21
- if creature.name =~ Gemstone_Regex.living then @data[:type] = 'living'; @targetable = true; end
22
- if creature.name =~ Gemstone_Regex.antimagic then @data[:type] = 'antimagic'; @targetable = true; end
23
- if creature.noun =~ Gemstone_Regex.bandits then @data[:type] = 'bandit'; @targetable = true; end
24
- if creature.noun =~ Gemstone_Regex.escortees then @data[:type] = 'escortee'; @targetable = false; end
25
- if creature.name =~ /taladorian/i then @data[:type] = 'invasion'; @targetable = true; end
26
- if creature.name =~ /grimswarm/i then @data[:type] = 'grimswarm'; @targetable = true; end
27
- if creature.noun =~ /kobold|rolton|velnalin|urgh/ then @data[:type] = 'ignoreable'; @targetable = true; end
71
+ @data[:tags] = Creature.tag(creature.name)
72
+
28
73
  heal
29
74
  # call the Gameobj_Extender initialize method that copies the game properties to this class
30
75
  super(creature)
31
76
  end
32
77
 
33
- def type
34
- @data[:type]
78
+ def tags
79
+ @data[:tags]
35
80
  end
36
81
 
82
+ def tag(tag)
83
+ @data[:tags].push(tag)
84
+ end
85
+
37
86
  def is?(t)
38
- type == t
87
+ tags.include?(t)
39
88
  end
40
-
89
+
41
90
  def bandit?
42
- type == 'bandit'
91
+ tags.include?('bandit')
43
92
  end
44
-
93
+
45
94
  def grimswarm?
46
- type == "grimswarm"
95
+ tags.include('grimswarm')
47
96
  end
48
-
97
+
49
98
  def heal
50
- [:right_leg, :left_leg, :right_arm, :left_arm, :head, :left_eye, :right_eye].each do |location| @wounds[location] = 0 end
99
+ [:right_leg, :left_leg, :right_arm, :left_arm, :head, :neck, :chest, :abdomen, :back, :left_eye, :right_eye, :right_hand, :left_hand, :nerves].each do |location| @wounds[location] = 0 end
51
100
  @wounds
52
101
  end
53
-
102
+
54
103
  def injuries
55
104
  fput "look ##{@id}"
56
- woundinfo = matchtimeout(2, /(he|she|it) (?:has|appears) .*/i)
57
- if woundinfo =~ /appears to be in good shape/ then heal; return @wounds; end
58
- if woundinfo =~ /severed right leg/ then @wounds[:right_leg] = 3; end
59
- if woundinfo =~ /severed left leg/ then @wounds[:left_leg] = 3; end
60
- if woundinfo =~ /severed right arm/ then @wounds[:right_arm] = 3; end
61
- if woundinfo =~ /severed left arm/ then @wounds[:left_arm] = 3; end
62
- if woundinfo =~ /severe head trauma and bleeding from .* ears/ then @wounds[:head] = 3; end
63
- if woundinfo =~ /blinded left eye/ then @wounds[:left_eye] = 3; end
64
- if woundinfo =~ /blinded right eye/ then @wounds[:right_eye] = 3; end
65
- if woundinfo =~ /severed right hand/ then @wounds[:right_hand]= 3; end
66
- if woundinfo =~ /severed left hand/ then @wounds[:left_hand] = 3; end
105
+ woundinfo = matchtimeout(2, /(he|she|it) (?:has|appears to be in good) .*/i)
106
+ if woundinfo =~ /appears to be in good shape/ then heal; return @wounds; end
107
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) right (?:hind )?leg/ then @wounds[:right_leg] = 1; end
108
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) left (?:hind )?leg/ then @wounds[:left_leg] = 1; end
109
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) (?:right arm|right foreleg)/ then @wounds[:right_arm] = 1; end
110
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) (?:left arm|left foreleg)/ then @wounds[:left_arm] = 1; end
111
+ if woundinfo =~ /minor bruises around (his|her|its) neck/ then @wounds[:neck] = 1; end
112
+ if woundinfo =~ /minor bruises around (his|her|its) head/ then @wounds[:head] = 1; end
113
+ if woundinfo =~ /minor cuts and bruises on (his|her|its) chest/ then @wounds[:chest] = 1; end
114
+ if woundinfo =~ /minor cuts and bruises on (his|her|its) abdomen/ then @wounds[:abdomen] = 1; end
115
+ if woundinfo =~ /minor cuts and bruises on (his|her|its) back/ then @wounds[:back] = 1; end
116
+ if woundinfo =~ /bruised left eye/ then @wounds[:left_eye] = 1; end
117
+ if woundinfo =~ /bruised right eye/ then @wounds[:right_eye] = 1; end
118
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) right (?:hand|paw|claw)/ then @wounds[:right_hand] = 1; end
119
+ if woundinfo =~ /some minor cuts and bruises on (his|her|its) left (?:hand|paw|claw)/ then @wounds[:left_hand] = 1; end
120
+ if woundinfo =~ /a strange case of muscle twitching/ then @wounds[:nerves] = 1; end
121
+ if woundinfo =~ /fractured and bleeding right (?:hind )?leg/ then @wounds[:right_leg] = 2; end
122
+ if woundinfo =~ /fractured and bleeding left (?:hind )?leg/ then @wounds[:left_leg] = 2; end
123
+ if woundinfo =~ /fractured and bleeding (?:right arm|right foreleg)/ then @wounds[:right_arm] = 2; end
124
+ if woundinfo =~ /fractured and bleeding (?:left arm|left foreleg)/ then @wounds[:left_arm] = 2; end
125
+ if woundinfo =~ /moderate bleeding from (his|her|its) neck/ then @wounds[:neck] = 2; end
126
+ if woundinfo =~ /minor lacerations about (his|her|its) head and a possible mild concussion/ then @wounds[:head] = 2; end
127
+ if woundinfo =~ /deep lacerations across (his|her|its) chest/ then @wounds[:chest] = 2; end
128
+ if woundinfo =~ /deep lacerations across (his|her|its) abdomen/ then @wounds[:abdomen] = 2; end
129
+ if woundinfo =~ /deep lacerations across (his|her|its) back/ then @wounds[:back] = 2; end
130
+ if woundinfo =~ /swollen left eye/ then @wounds[:left_eye] = 2; end
131
+ if woundinfo =~ /swollen right eye/ then @wounds[:right_eye] = 2; end
132
+ if woundinfo =~ /fractured and bleeding right (?:hand|paw|claw)/ then @wounds[:right_hand] = 2; end
133
+ if woundinfo =~ /fractured and bleeding left (?:hand|paw|claw)/ then @wounds[:left_hand] = 2; end
134
+ if woundinfo =~ /a case of sporadic convulsions/ then @wounds[:nerves] = 2; end
135
+ if woundinfo =~ /severed right (?:hind )?leg/ then @wounds[:right_leg] = 3; end
136
+ if woundinfo =~ /severed left (?:hind )?leg/ then @wounds[:left_leg] = 3; end
137
+ if woundinfo =~ /severed (?:right arm|right foreleg)/ then @wounds[:right_arm] = 3; end
138
+ if woundinfo =~ /severed (?:left arm|left foreleg)/ then @wounds[:left_arm] = 3; end
139
+ if woundinfo =~ /snapped bones and serious bleeding from (his|her|its) neck/ then @wounds[:neck] = 3; end
140
+ if woundinfo =~ /severe head trauma and bleeding from (his|her|its) ears/ then @wounds[:head] = 3; end
141
+ if woundinfo =~ /deep gashes and serious bleeding from (his|her|its) chest/ then @wounds[:chest] = 3; end
142
+ if woundinfo =~ /deep gashes and serious bleeding from (his|her|its) abdomen/ then @wounds[:abdomen] = 3; end
143
+ if woundinfo =~ /deep gashes and serious bleeding from (his|her|its) back/ then @wounds[:back] = 3; end
144
+ if woundinfo =~ /blinded left eye/ then @wounds[:left_eye] = 3; end
145
+ if woundinfo =~ /blinded right eye/ then @wounds[:right_eye] = 3; end
146
+ if woundinfo =~ /severed right (?:hand|paw|claw)/ then @wounds[:right_hand] = 3; end
147
+ if woundinfo =~ /severed left (?:hand|paw|claw)/ then @wounds[:left_hand] = 3; end
148
+ if woundinfo =~ /a case of uncontrollable convulsions/ then @wounds[:nerves] = 3; end
67
149
  @wounds
68
150
  end
69
-
151
+
70
152
  def status
71
153
  GameObj[@id].status
72
154
  end
73
-
155
+
74
156
  def trollish?
75
157
  @data[:trollish]
76
158
  end
77
159
 
160
+ def ignorable?
161
+ is?('ignoreable')
162
+ end
163
+
78
164
  def legged?
79
165
  injuries
80
166
  trollish? ? false : @wounds[:right_leg] == 3 || @wounds[:left_leg] == 3 || dead? || gone?
81
167
  end
82
-
168
+
83
169
  def can_cast?
84
170
  injuries
85
171
  trollish? ? false : @wounds[:right_arm] == 3 || @wounds[:head] == 3 || dead? || gone?
86
172
  end
87
-
173
+
88
174
  def limbed?
89
175
  injuries
90
176
  trollish? ? false : @wounds[:right_leg] == 3 || @wounds[:left_leg] == 3 || @wounds[:right_arm] == 3 || dead? || gone?
91
177
  end
92
-
178
+
93
179
  def dead?
94
180
  status =~ /dead/ ? true : false
95
181
  end
96
-
182
+
97
183
  def active?
98
184
  !stunned?
99
185
  end
100
-
186
+
101
187
  def gone?
102
188
  GameObj[@id].nil? ? true : false
103
189
  end
104
-
190
+
105
191
  def prone?
106
192
  status =~ /lying|prone/ ? true : false
107
193
  end
108
-
194
+
109
195
  def stunned?
110
196
  status =~ /stunned/ ? true : false
111
197
  end
112
-
198
+
113
199
  def kill_shot
114
200
  wounds = injuries
115
201
  location = "left eye"
116
202
  location = "right eye" if @wounds[:left_eye] == 3
117
203
  location = "head" if @wounds[:right_eye] == 3
118
204
  location = "neck" if @wounds[:head] == 3
119
- location = "back" if @wounds[:neck] == 3
120
- Client.notify "#{@name} >> #{location}"
205
+ location = "back" if @wounds[:neck] == 3
121
206
  location
122
207
  end
123
-
208
+
124
209
  def target
125
- result = dothistimeout "target ##{@id}", 3, /#{Olib::Gemstone_Regex.targetable.values.join('|')}/
126
- @targetable = result =~ Olib::Gemstone_Regex.targetable[:yes] ? true : false
210
+ result = dothistimeout "target ##{@id}", 3, /#{Olib::Dictionary.targetable.values.join('|')}/
211
+ @targetable = result =~ Olib::Dictionary.targetable[:yes] ? true : false
127
212
  self
128
213
  end
129
-
214
+
130
215
  def search
131
216
  fput "search ##{@id}" if dead?
132
217
  end
133
-
218
+
134
219
  def ambush(location=nil)
135
220
  until hidden?
136
221
  fput "hide"
@@ -141,27 +226,27 @@ module Olib
141
226
  waitrt?
142
227
  self
143
228
  end
144
-
229
+
145
230
  def mstrike
146
231
  fput "mstrike ##{@id}"
147
232
  waitrt?
148
233
  self
149
234
  end
150
-
235
+
151
236
  def kill
152
237
  fput "kill ##{@id}"
153
238
  waitrt?
154
239
  self
155
240
  end
156
-
241
+
157
242
  def targetable?
158
243
  target if @targetable.nil?
159
244
  @targetable
160
245
  end
161
-
246
+
162
247
  def search
163
248
  waitrt?
164
249
  fput "search ##{id}"
165
250
  end
166
251
  end
167
- end
252
+ end