Autohealer (script)

From Elanthipedia
Jump to navigation Jump to search
Autohealer (script)
Category utility,Empath
Front-end Genie
Author Tropicalo

This script is for genie. It is meant for empaths with decent magics, 200ish. Anything less could result in you bleeding to death if you try to heal someone with too many wounds. The script will take all non life-threatening wounds from the target, and half of any life threatening wounds. It will then have the empath heal itself. If there were any wounds on which take half was used, it will go back and finish taking the remaining wounds and have the empath heal itself again. The Syntax for its use is at the top of the script.

# ------------------------------------------------ 
# Tropicalo's Heal/Clean script - Revised Version
# ------------------------------------------------ 
# ".Heal" will heal yourself 
# 
# ".Heal <person>" will take wound from <person> and 
# then heal yourself 
# 
# ".Heal <person> <anything>" will take wounds from 
# <person> and not heal yourself 
# ------------------------------------------------ 

start:
	gosub actions 
	put #setvariable Patient 
	if_1 put #setvariable Patient %1 
healing:
	gosub clean 
	if_2 then exit
	gosub heal
	if "%Patient" = "" then exit
	goto healing 

done:
	echo *** That person isn't here ***
	exit

actions:
	put #setvariable Poison 0
	put #setvariable Mana 0
	put #setvariable Preparedspell none
	put #setvariable critically 4
	put #setvariable dangerously 3
	put #setvariable seriously 2
	put #setvariable mildly 1
	action put #setvariable Preparedspell when You are already preparing
	action put #setvariable Preparedspell none when ^You don't have a spell prepared!|You gesture.|With a wave of your hand|You wave your hand
	action put #setvariable Mana 0 when Attunement:|you gesture|You tap into the mana|You harness some energy
	action put #setvariable Mana 1 when 50%>{20}|You feel fully attuned to the mana streams again\.\r
	action put #math Harn add -1 when You tap into the mana
	action put #setvariable Disease 0;#setvariable Vitality 0;#setvariable Poison 0;#setvariable List when You sense a successful empathic link has been forged
	action put #setvariable Part $1 when Wounds to the (\w+):
	action put #setvariable Part $1.$2 when Wounds to the (L|R)\w+ (\w+):
	action put #setvariable List %List$1.3 when poisoned (\w+)\.
	action put #setvariable List %List$1.$2.3 when poisoned (L|R)\w+ (\w+)\.
	action put #setvariable List %ListNerve.3 when has a.* strong nerve poison\.
	action put #if devastating|useless indexof $1 then #Setvariable List %List%Part.1.1.0;#else #setvariable List %List%Part.1.1.1; when Fresh External:.*--.* (\w+)\r
	action put #if devastating|useless indexof $1 then #Setvariable List %List%Part.1.2.0;#else #setvariable List %List%Part.1.2.1; when Fresh Internal:.*--.* (\w+)\r
	action put #setvariable List %List%Part.2.1 when (Fresh|Scars) External:
	action put #setvariable List %List%Part.2.2 when (Fresh|Scars) Internal:
	action put #setvariable Vitality $1 when \((.+)%\)
	action goto done when ^touch what?|^What do you want to get|^I could not find what you were referring to
	action put #setvariable Wounds;#setvariable Poison 0;#setvariable Vitality 0;#setvariable Disease 0;#setvariable Fatigue 0 when Your body feels
	action put #setvariable Vitality 1 when Your body feels.*beat up|Your body feels.*bad shape|Your body feels.*death's door|You feel your vitality transferring to 
	action put #setvariable Disease 1 when wounds are .*infected.
	action put #setvariable Fatigue 1 when ^You are .*(?:very|extremely) (?:Fatigued|tired)
	action put #setvariable Fatigue 2 when ^You are .*Exhaust
	action put #math Poison add %$1 when (\w+) (?:strong nerve poison|poisoned)
	action put #setvariable BS 1 when ^Your bleeding is halted|before settling itself between your shoulders.|You sense the Blood Staunching spell upon you,
	action put #setvariable BS 0 when ^The binding force which has been holding your wounds closed wears off|You reach out with your senses.
	action action remove (\w+) poisoned when The poison seems to be unaffected by the spell's power.
	action put #setvariable Poison 0 when The poison seems to be unaffected by the spell's power
	return

Clean:
	if "%Patient" = "" then return
	gosub touch %Patient
	if %Vitality > 0 then gosub take
	if %Disease = 1 then gosub take disease quick
	if "%List" = "" then put #setvariable Patient
	if "%List" = "" then return
	gosub cycle.take take.1
	gosub refresh 2
	gosub refresh 2
	gosub cycle.take take.2
	gosub refresh 2
	gosub refresh 2
	if %List indexof 0 then return
	put #setvariable Patient
	return

heal:
	gosub health
	if %Fatigue != 0 then gosub refresher
	gosub VH
	gosub CD
	gosub FP
	gosub check.specific.wounds
	if "%Wounds" indexof Head then gosub check.wounds Head
	if "%Wounds" indexof Skin then gosub check.wounds Skin
	if "%Wounds" indexof neck then gosub check.wounds Neck
	if "%Wounds" indexof Abdomen then gosub check.wounds Abdomen
	if "%Wounds" indexof chest then gosub check.wounds Chest
	if "%Wounds" indexof Back then gosub check.wounds Back
	if "%Wounds" indexof "right arm" then gosub check.wounds right arm
	if "%Wounds" indexof "left arm" then gosub check.wounds left arm
	if "%Wounds" indexof "right hand" then gosub check.wounds right hand
	if "%Wounds" indexof "left hand" then gosub check.wounds left hand
	if "%Wounds" indexof "right leg" then gosub check.wounds right leg
	if "%Wounds" indexof "left leg" then gosub check.wounds left leg
	if "%Wounds" indexof "right eye" then gosub check.wounds right eye
	if "%Wounds" indexof "left eye" then gosub check.wounds left eye
	if "%Wounds" != "" then goto heal
	return

check.specific.wounds:
	put #setvariable Healed 0
	gosub VH
	if "%Wounds" indexof "paralysis of the entire body" then gosub Heal.spell IWH 8 8 1 nerve
	if "%Wounds" indexof "difficulty controlling actions" then gosub Heal.spell IWH 8 8 1 nerve
	if "%Wounds" indexof "some severe twitching" then gosub Heal.spell IWH 8 8 1 nerve
	if "%Wounds" indexof "some minor twitching" then gosub Heal.spell IWH 8 8 1 nerve
	if "%Wounds" indexof "general numbness all over" then gosub Heal.spell ISH 11 7 1 nerve
	if "%Wounds" indexof "arms and legs" then gosub Heal.spell ISH 11 7 1 nerve
	if "%Wounds" indexof "fingers and toes" then gosub Heal.spell ISH 11 7 1 nerve
	if "%Wounds" indexof "severe skin loss exposing bone and internal organs" then gosub Heal.spell ESH 10 5 2 skin
	if "%Wounds" indexof "severely stiff and shriveled skin that seems to be peeling off the body" then gosub Heal.spell ESH 9 8 1 skin
	if "%Wounds" indexof "missing chunks out of the head" then gosub Heal.spell ESH 9 8 1 head
	if "%Wounds" indexof "some shriveled and oddly folded skin" then gosub Heal.spell ESH 9 5 1 skin
	if "%Wounds" indexof "open and bleeding sores all over the skin" then gosub Heal.spell EWH 5 5 1 skin
	if "%Wounds" indexof "boils and sores around the skin" then gosub Heal.spell EWH 4 4 1 skin
	if "%Wounds" indexof "a crushed skull with horrendous wounds" then gosub Heal.spell EWH 5 5 1 head
	if "%Wounds" indexof "an abdomen deeply gouged with gaping wounds" then gosub Heal.spell EWH 4 4 1 abdomen
	if "%Wounds" indexof "a cracked skull with deep slashes" then gosub Heal.spell EWH 5 5 1 head
	if "%Wounds" indexof "a painful, enflamed body rash" then gosub Heal.spell EWH 4 1 1 skin
	if "%Wounds" indexof "some deep slashes and cuts about the head" then gosub Heal.spell EWH 4 4 1 head
	if "%Wounds" indexof "some moderately deep cuts about the head" then gosub Heal.spell EWH 4 4 1 head
	if "%Wounds" indexof "a body rash" then gosub Heal.spell EWH 4 1 1 skin
	if "%Wounds" indexof "a large skin rash" then gosub Heal.spell EWH 4 1 1 skin
	if "%Wounds" indexof "a small skin rash" then gosub Heal.spell EWH 4 1 1 skin
	if "%Wounds" indexof "severe scarring about the head" then gosub Heal.spell ESH 9 8 1 head
	if "%Wounds" indexof "severe skin discoloration" then gosub Heal.spell ESH 9 5 1 skin
	if "%Wounds" indexof "minor skin discoloration" then gosub Heal.spell ESH 9 5 1 skin
	if "%Wounds" indexof "minor scars about the head" then gosub Heal.spell ESH 9 5 1 head
	if "%Wounds" indexof "loss of skin tone" then gosub Heal.spell ESH 9 5 1 skin
	if "%Wounds" indexof "a confused look with sporadic twitching of the forehead" then gosub Heal.spell ISH 12 6 3 head
	if "%Wounds" indexof "a severely painful chest area with significant problems breathing" then gosub Heal.spell ISH 11 7 2 chest
	if "%Wounds" indexof "a severely yellow pallor and a look of starvation" then gosub Heal.spell ISH 11 7 2 abdomen
	if "%Wounds" indexof "a severely painful back with significant problems moving" then gosub Heal.spell ISH 11 7 2 back
	if "%Wounds" indexof "partial paralysis around the head" then gosub Heal.spell ISH 11 7 2 head
	if "%Wounds" indexof "a painful chest area and difficulty getting a breath without pain" then gosub Heal.spell ISH 11 7 2 chest
	if "%Wounds" indexof "a definite greenish pallor and emaciated look" then gosub Heal.spell ISH 11 7 2 abdomen
	if "%Wounds" indexof "a painful back and difficulty moving without pain" then gosub Heal.spell ISH 11 7 2 back
	if "%Wounds" indexof "a ghastly bloated head with bleeding from the ears" then gosub Heal.spell IWH 6 7 2 head
	if "%Wounds" indexof "major swelling and bruising around the head" then gosub Heal.spell IWH 8 7 1 head
	if "%Wounds" indexof "a badly bruised and swollen head" then gosub Heal.spell IWH 8 7 1 head
	if "%Wounds" indexof "a deeply bruised head" then gosub Heal.spell IWH 8 7 1 head
	if "%Wounds" indexof "a bruised head" then gosub Heal.spell IWH 6 6 1 head
	if "%Wounds" indexof "a somewhat emaciated look" then gosub Heal.spell ISH 12 4 2 abdomen
	if "%Wounds" indexof "an occasional twitch on the forehead" then gosub Heal.spell ISH 12 4 2 head
	if "%Wounds" indexof "an occasional twitching of the head" then gosub Heal.spell ISH 12 4 2 head
	if %Healed = 0 then return
	gosub health
	goto check.specific.wounds


check.wounds:
	gosub VH
	if "%Wounds" indexof "an ugly flesh stump for a $0" then gosub Heal.spell ESH 10 5 2 "$0"
	if "%Wounds" indexof "an empty $0 socket overgrown with bits of odd shaped flesh" then gosub Heal.spell ESH 10 5 2 "$0"
	if "%Wounds" indexof "mangled and malformed $0" then gosub Heal.spell ESH 10 5 2 "$0"
	if "%Wounds" indexof "a painfully mangled and malformed $0 in a shattered eye socket" then gosub Heal.spell ESH 10 5 2 "$0"
	if "%Wounds" indexof "severe scarring and chunks of flesh missing from the $0" then gosub Heal.spell ESH 9 8 1 "$0"
	if "%Wounds" indexof "a punctured and shriveled $0" then gosub Heal.spell ESH 9 8 1 "$0"
	if "%Wounds" indexof "an ugly stump for a $0" then gosub Heal.spell EWH 5 5 1 "$0"
	if "%Wounds" indexof "a pulpy cavity for a $0" then gosub Heal.spell EWH 5 5 1 "$0"
	if "%Wounds" indexof "a shattered $0" then gosub Heal.spell EWH 4 4 1 "$0"
	if "%Wounds" indexof "a bruised, swollen and shattered $0" then gosub Heal.spell EWH 4 4 1 "$0"
	if "%Wounds" indexof "gaping holes in the $0" then gosub Heal.spell EWH 4 4 1 "$0"
	if "%Wounds" indexof "a bruised, swollen and slashed $0" then gosub Heal.spell EWH 4 4 1 "$0"
	if "%Wounds" indexof "a broken $0 with gaping holes" then gosub Heal.spell EWH 4 1 1 "$0"
	if "%Wounds" indexof "deep slashes across the $0" then gosub Heal.spell EWH 4 4 1 "$0"
	if "%Wounds" indexof "a bruised, swollen and bleeding $0" then gosub Heal.spell EWH 4 4 1 "$0"
	if "%Wounds" indexof "deep cuts across the $0" then gosub Heal.spell EWH 4 1 1 "$0"
	if "%Wounds" indexof "a bruised and swollen $0" then gosub Heal.spell EWH 4 1 1 "$0"
	if "%Wounds" indexof "cuts and bruises about the $0" then gosub Heal.spell EWH 4 1 1 "$0"
	if "%Wounds" indexof "a black and blue $0" then gosub Heal.spell EWH 4 1 1 "$0"
	if "%Wounds" indexof "some tiny scratches to the $0" then gosub Heal.spell EWH 4 1 1 "$0"
	if "%Wounds" indexof "some minor abrasions to the $0" then gosub Heal.spell EWH 4 1 1 "$0"
	if "%Wounds" indexof "severe scarring and ugly gashes about the $0" then gosub Heal.spell ESH 9 8 1 "$0"
	if "%Wounds" indexof "deeply scarred gashes across the $0" then gosub Heal.spell ESH 9 8 1 "$0"
	if "%Wounds" indexof "severe scarring along the $0" then gosub Heal.spell ESH 9 5 1 "$0"
	if "%Wounds" indexof "severe scarring across the $0" then gosub Heal.spell ESH 9 8 1 "$0"
	if "%Wounds" indexof "minor scarring along the $0" then gosub Heal.spell ESH 9 5 1 "$0"
	if "%Wounds" indexof "minor scars across the $0" then gosub Heal.spell ESH 9 5 1 "$0"
	if "%Wounds" indexof "some tiny scars across the $0" then gosub Heal.spell ESH 9 5 1 "$0"
	if "%Wounds" indexof "a few nearly invisible scars along the $0" then gosub Heal.spell ESH 9 5 1 "$0"
	if "%Wounds" indexof "a completely paralyzed $0" then gosub Heal.spell ISH 12 6 3 "$0"
	if "%Wounds" indexof "a blind $0" then gosub Heal.spell ISH 12 6 3 "$0"
	if "%Wounds" indexof "a severely paralyzed $0" then gosub Heal.spell ISH 11 7 2 "$0"
	if "%Wounds" indexof "a completely clouded $0" then gosub Heal.spell ISH 11 7 2 "$0"
	if "%Wounds" indexof "a severely bloated and discolored $0" then gosub Heal.spell IWH 6 6 2 "$0"
	if "%Wounds" indexof "severely swollen and bruised $0" then gosub Heal.spell IWH 8 7 1 "$0"
	if "%Wounds" indexof "a partially paralyzed $0" then gosub Heal.spell ISH 12 4 2 "$0"
	if "%Wounds" indexof "a clouded $0" then gosub Heal.spell ISH 11 7 2 "$0"
	if "%Wounds" indexof "a severely swollen and shattered $0" then gosub Heal.spell IWH 6 7 2 "$0" 
	if "%Wounds" indexof "a severely swollen, cruised and blind $0" then gosub Heal.spell IWH 6 7 2 "$0"
	if "%Wounds" indexof "a severely swollen and deeply bruised $0" then gosub Heal.spell IWH 6 6 2 "$0"
	if "%Wounds" indexof "a severely swollen, bruised and blind $0" then gosub Heal.spell IWH 6 7 2 "$0"
	if "%Wounds" indexof "a severely swollen, bruised and cloudy $0" then gosub Heal.spell IWH 8 7 1 "$0"
	if "%Wounds" indexof "a severely swollen, bruised and crossed $0" then gosub Heal.spell IWH 8 7 1 "$0"
	if "%Wounds" indexof "minor swelling and bruising around the $0" then gosub Heal.spell IWH 6 6 1 "$0"
	if "%Wounds" indexof "minor swelling and bruising in the $0" then gosub Heal.spell IWH 6 6 1 "$0"
	if "%Wounds" indexof "a constant twitching in the $0" then gosub Heal.spell ISH 12 4 2 "$0"
	if "%Wounds" indexof "an occasional twitching in the $0" then gosub Heal.spell ISH 12 4 2 "$0"
	return

Heal.spell:
	put #setvariable Healed 1
	gosub mana
	gosub prep $1 $2
	pause 2
	gosub harn $3 $4
	gosub cast $5
	return

Cycle.take:
	gosub $1 ABDOMEN
	gosub $1 CHEST
	gosub $1 BACK
	gosub $1 NECK
	gosub $1 HEAD
	gosub $1 SKIN
	gosub $1 NERVE
	gosub $1 R.HAND
	gosub $1 L.HAND
	gosub $1 R.ARM
	gosub $1 L.ARM
	gosub $1 R.LEG
	gosub $1 L.LEG
	gosub $1 R.EYE
	gosub $1 L.EYE
	return

take.1:
	if %List indexof $1.1.1.1 then gosub take $1 quick
	if %List indexof $1.1.1.0 then gosub take $1 half quick
	if %List indexof $1.1.2.1 then gosub take $1 int quick
	if %List indexof $1.1.2.0 then gosub take $1 int half quick
	if %List indexof $1.3 then gosub take $1 poison quick
	return

take.2:
	if %List indexof $1.2.1 then gosub take $1 scar quick
	if %List indexof $1.2.2 then gosub take $1 int scar quick
	return

FP:
	if %Poison = 0 then return
	gosub mana
	gosub prep FP 6
	put #math Poison mod 3;#math Poison add 1
	gosub harn 5 %Poison
	if %Poison = 0 then pause 3
	gosub cast
	gosub health
	goto FP
CD:
	if %Disease = 0 then return
	gosub mana
	gosub prep CD 10
	gosub harn 5
	gosub harn 5
	gosub cast
	gosub health
	goto CD

VH:
	if %Vitality = 0 then return
	gosub prep VH 5
	gosub harn 5
	pause 2
	gosub cast
	gosub health
	goto VH

refresher:
	if %Fatigue = 1 then gosub refresh 10
	if %Fatigue = 2 then gosub refresh 20
	gosub health
	if %Fatigue = 0 then return
	goto refresher

Refresh:
	gosub prep Refresh
	pause $0
	gosub cast
	return	

Mana:
	if %Mana = 1 then return
	gosub attunement
	if %Mana = 1 then return
	pause 2	
	if %Mana = 1 then return
	pause 2	
	if %Mana = 1 then return
	pause 2	
	goto mana

# ------------------------------------------------
#  Base utility labels.
# ------------------------------------------------

matchwait:
	match pause ...wait
	match pause Sorry, you may only type ahead
	match pause You can't do that while entangled in a web.
	matchwait

pause:
	pause 0.3
	goto %Return

return.p:
	pause .1
return:
	return

if:
	if $0
	return

# ------------------------------------------------
#  Checking conditions.
# ------------------------------------------------

health:
	action put #setvariable Wounds $1 when ^You have ((?!no|a \S+ poisoned).+)\r
	action action remove ^You have ((?!no|a \S+ poisoned).+)\r when ^You have
	put #setvariable Return health
	match return.p Your body feels
	put health
	goto matchwait

Attunement:
	put #setvariable Return Attunement
	match return.p Attunement:
	put mana
	goto matchwait

# ------------------------------------------------
#  Changing Conditions
# ------------------------------------------------

sit:
	if not prone then return
	put #setvariable Return Sit
	match return You sit up.
	match return You sit down.
	match return You are already sitting.
	put sit
	matchwait

# ------------------------------------------------
#  Interaction with others.
# ------------------------------------------------

take:
	gosub sit
	put #setvariable Return take
	match return you touch
	put take %Patient $0
	goto matchwait

touch:
	put #setvariable Return touch
	match return.p You touch 
	match return.p injuries include...
	match return You sense a tugging sensation from the center of the orb, pulling at your consciousness.
	put touch $0
	goto matchwait

# ------------------------------------------------
#  Magic labels.
# ------------------------------------------------

prep:
	if %Preparedspell = $1 then return
	gosub release
	put #setvariable Return prep
	match prep You are already preparing
	match prepared You trace an arcane sigil in the air,
	match prepared You lick the tip of your finger and trace a sigil in the air
	match prepared You raise your arms skyward, chanting
	match prepared The wailing of lost souls accompanies
	match prepared As you begin to solemnly intone the
	match prepared Your eyes darken to black as a starless
	match prepared You close your eyes and breathe deeply
	match prepared That is not a spell you can cast.
	match prepared Your skin briefly withers and tightens
	match prepared Tiny tendrils of lightning jolt
	match prepared You begin chanting a prayer to invoke the
	match prepared You are now prepared
	put prepare $0
	goto matchwait

prepared:
	put #setvariable Preparedspell $1
	return

harn:
	put #setvariable Harn 1
	if "$0" != $1 then put #setvariable Harn $2
harness:
	if %Harn < 1 then return
	put #setvariable Return harness
	match harness You tap into the mana
	match return Usage:
	match return Attunement:
	match mana You strain, but
	put harness $1
	goto matchwait

cast:
	put #setvariable Return cast
	match return.p You reach out toward 
	match return.p You gesture
	match return You don't have a spell prepared!
	match return You reach with both your hands and your
	match return With a wave of your hand
	match return I could not find what you were
	match return You roll your hands in an elliptical pattern in front of you
	match return Invisible strands of aether roil in the air, twisting into a tight braid.  
	match return Your secondary spell pattern dissipates because your target is dead, but the main spell remains intact.
	match return You can't cast
	match mana You are unable to
	put cast $0
	goto matchwait


release:
	if %Preparedspell = none then return
	put #setvariable Return release
	match return Type RELEASE HELP
	match return You aren't holding 
	match return You release 
	put release $0
	goto matchwait