Showing with 42 additions and 67 deletions.
  1. +25 −36 tendme.lic
  2. +17 −25 tendother.lic
  3. +0 −1 test/test_bput.rb
  4. +0 −3 test/test_harness.rb
  5. +0 −2 test/test_items.rb
@@ -10,43 +10,32 @@

custom_require(%w(common))

class TendMe
include DRC

def initialize(args)
waitrt? while bind_open_wounds?

loop do
case script.gets
when /The bandages binding your (.*) come loose and you begin to bleed even more/
bind_wound(Regexp.last_match(1))
bind_open_wounds?
when /The bandages binding your (.*) soak through with blood becoming useless and you begin bleeding again/
bind_wound(Regexp.last_match(1))
bind_open_wounds?
when /You feel like now might be a good time to change the bandages on your (.*)\./
break unless args.include? 'train'
unwrap_wound(Regexp.last_match(1))
bind_wound(Regexp.last_match(1))
bind_open_wounds?
end
end
def bind_open_wounds?
DRC.bput('heal', '^You')
pause 1
bleeders = reget(15).keep_if { |item| item =~ /^\s+.+\s{7}\w+/ }
bleeders = bleeders.keep_if { |item| !item.include?('tended') && !item.include?('inside') && !item.include?('Area') }
return false if bleeders.empty?
bleeders.each do |message|
message =~ /^\s+(\w+|\w+\s\w+)\s{7}/
DRC.bind_wound(Regexp.last_match(1))
end
end

def bind_open_wounds?
bput('heal', '^You')
pause 1
bleeders = reget(15).keep_if { |item| item =~ /^\s+.+\s{7}\w+/ }
bleeders = bleeders.keep_if { |item| !item.include?('tended') && !item.include?('inside') && !item.include?('Area') }
return false if bleeders.empty?

bleeders.each do |message|
message =~ /^\s+(\w+|\w+\s\w+)\s{7}/
bind_wound(Regexp.last_match(1))
end

true
waitrt? while bind_open_wounds?

loop do
case script.gets
when /The bandages binding your (.*) come loose and you begin to bleed even more/
DRC.bind_wound(Regexp.last_match(1))
bind_open_wounds?
when /The bandages binding your (.*) soak through with blood becoming useless and you begin bleeding again/
DRC.bind_wound(Regexp.last_match(1))
bind_open_wounds?
when /You feel like now might be a good time to change the bandages on your (.*)\./
break unless variable.include? 'train'
DRC.unwrap_wound(Regexp.last_match(1))
DRC.bind_wound(Regexp.last_match(1))
bind_open_wounds?
end
end

TendMe.new(variable.drop(1))
@@ -12,31 +12,23 @@

custom_require(%w(common drinfomon))

class TendOther
include DRC

def initialize(args)
target = DRRoom.pcs.find { |name| /^#{args[0]}/i =~ name }

bind_open_wounds(target)

loop do
case script.gets
when /The bandages binding #{target}'s (.*) come loose and you begin to bleed even more/
DRC.bind_wound(Regexp.last_match(1), target)
when /The bandages binding #{target}'s (.*) soak through with blood as it begins bleeding again/i
DRC.bind_wound(Regexp.last_match(1), target)
end
end
end
def bind_open_wounds(target)
fput("look #{target}")
pause 2
bleeders = reget(20).keep_if { |item| item =~ /^\w+ is bleeding/ }.last
bleeders = bleeders.scan(/ from the (left \w+|right \w+|\w+)/).to_a.flatten
bleeders.each { |message| DRC.bind_wound(message, target) }
end

target = DRRoom.pcs.find { |name| /^#{variable[1]}/i =~ name }

def bind_open_wounds(target)
fput("look #{target}")
pause 2
bleeders = reget(20).keep_if { |item| item =~ /^\w+ is bleeding/ }.last
bleeders = bleeders.scan(/ from the (left \w+|right \w+|\w+)/).to_a.flatten
bleeders.each { |message| DRC.bind_wound(message, target) }
bind_open_wounds(target)

loop do
case script.gets
when /The bandages binding #{target}'s (.*) come loose and you begin to bleed even more/
DRC.bind_wound(Regexp.last_match(1), target)
when /The bandages binding #{target}'s (.*) soak through with blood as it begins bleeding again/i
DRC.bind_wound(Regexp.last_match(1), target)
end
end

TendOther.new(variable.drop(1))
@@ -3,7 +3,6 @@
require 'timecop'

include Harness
include UserVars

class TestCommon < Minitest::Test
def setup
@@ -125,6 +125,3 @@ def assert_sends_messages(expected_messages)
assert_empty expected_messages, "Expected script to send #{expected_messages}"
end
end

module UserVars
end
@@ -1,8 +1,6 @@
require 'minitest/autorun'
load 'test/test_harness.rb'

include UserVars

class TestItems < Minitest::Test
def setup
load('common.lic')