Danical
09-06-2010, 09:22 AM
Mark was right. I've created the following lich script to examine weapon strikes vs creatures; run it in the background. I can say almost definitively that Mark's research on Dex Bonus : Crit Weighting is spot on, which is to say trunc(Dex Bonus / 4) = 1 point of Crit Weighting. Just plug in your appropriate numbers for asg|df into the weaponType hash. Using damage weighted, crit weighted, and Sigil of Major|Minor Bane confounds this script. Also, when controlling for dex bonus, you'll note crit weighting from weapons is static, and not variable as some have suggested.
weaponCrits = {
'slash' => {
'head' => {
"Flashy swing!" => [ 0, 0 ],
"Quick slash catches the .+? cheek!" => [ 1, 5 ],
"Blade slashes across the .+? face!" => [ 2, 10 ],
"Blow to head!" => [ 3, 15 ],
"Quick flick of the wrist!" => [ 4, 20 ],
"Hard blow to the .+? ear!" => [ 5, 25 ],
"Gruesome slash opens the .+? forehead!" => [ 6, 30 ],
"Wild upward slash remove the .+? face from(its|his|her) skull!" => [ 7, 35 ],
"Horrible slash to the .+? head!" => [ 8, 40 ],
"Gruesome, slashing blow to the side of the .+? head!" => [ 9, 50 ],
},
'neck' => {
"Close shave!" => [ 0, 0 ],
"Attack hits the .+? throat but doesn\'t break the skin\." => [ 1, 2 ],
"Strike dents the .+? larynx\." => [ 2, 5 ],
"Deft swing strikes the .+? neck\." => [ 3, 10 ],
"Strong slash to throat nicks a few blood vessels\." => [ 4, 12 ],
"Fast slash to the .+? neck exposes(its|his|her) windpipe\." => [ 5, 15 ],
"Deep slash to the .+? neck severs an artery!" => [ 6, 20 ],
"Gruesome slash to the .+? throat!" => [ 7, 25 ],
"Awful slash nearly decapitates the .+?!" => [ 8, 30 ],
"Incredible slash to the .+? neck!" => [ 9, 40 ],
},
'eyes' => {
"Quick slash at the .+? (right|left) eye\." => [ 0, 0 ],
"Slashing strike near forehead nicks an eyebrow!" => [ 1, 3 ],
"Gash to the .+? (right|left) eyebrow\." => [ 2, 3 ],
"Grazing slash to the .+? face!" => [ 3, 5 ],
"Upward slash gouges the .+? cheek!" => [ 4, 20 ],
"Slash strikes the .+? (right|left) eye\." => [ 5, 25 ],
"Slash to head destroys the .+? (right|left) eye!" => [ 6, 30 ],
"Slash to the .+? (right|left) eye!" => [ 7, 40 ],
"Horrifying slash to the .+? head!" => [ 8, 45 ],
"Blast to the .+? head destroys (right|left) eye!" => [ 9, 50 ],
},
'chest' => {
"Weak slash across chest!" => [ 0, 0 ],
"Deft slash across chest draws blood!" => [ 1, 1 ],
"Slash to the .+? chest!" => [ 2, 10 ],
"Slash to .+? chest\." => [ 3, 15 ],
"Slashing blow to chest knocks the .+? back a few paces!" => [ 4, 20 ],
"Crossing slash to the chest catches the .+? attention!" => [ 5, 25 ],
"Hard slash to the .+? side opens(its|his|her) spleen!" => [ 6, 45 ],
"Quick, powerful slash!" => [ 7, 60 ],
"Slash to the .+? ribs opens a sucking chest wound!" => [ 8, 65 ],
"Wicked slash slices open the .+? chest!" => [ 9, 70 ],
},
'back' => {
"Glancing blow to the .+? back\." => [ 0, 0 ],
"Weak slash to the .+? lower back!" => [ 1, 3 ],
"Feint to the left goes astray as the .+? dodges!" => [ 2, 10 ],
"Slash along the .+? lower back\." => [ 3, 15 ],
"Slash to the .+? lower back!" => [ 4, 20 ],
"Feint left spins the .+? around!" => [ 5, 25 ],
"The .+? twists away but is caught with a hard slash!" => [ 6, 30 ],
"Deft slash!" => [ 7, 50 ],
"Slash to the .+? lower back!" => [ 8, 60 ],
"Masterful slash to the .+? lower back!" => [ 9, 75 ],
},
'abdomen' => {
"Light slash to the .+? abdomen!" => [ 0, 0 ],
"Awkward slash to the .+? stomach!" => [ 1, 5 ],
"Smooth slash to the .+? hip!" => [ 2, 10 ],
"Hard slash to belly severs a few nerve endings\." => [ 3, 15 ],
"Diagonal slash leaves a bloody trail across the .+? torso\." => [ 4, 20 ],
"The .+? is backed up by a strong slash to(its|his|her) abdomen!" => [ 5, 25 ],
"Deep slash to the .+? (right|left) side!" => [ 6, 30 ],
"Amazing slash to the .+? belly!" => [ 7, 50 ],
"Bloody slash to the .+? side!" => [ 8, 60 ],
"Terrible slash to the .+? side!" => [ 9, 75 ],
},
'arms' => {
"Weak slash to the .+? (right|left) arm\." => [ 0, 0 ],
"Hard blow, but deflected\." => [ 0, 0 ],
"Quick slash to the .+? upper (right|left) arm!" => [ 1, 3 ],
"Hesitant slash to the .+? upper (right|left) arm!" => [ 2, 7 ],
"Slash to the .+? shield arm!" => [ 2, 7 ],
"Slash to the .+? (right|left) arm!" => [ 3, 8 ],
"Glancing slash to the .+? shield arm!" => [ 3, 8 ],
"Powerful slash just cracks the .+? (weapon|shield) arm!" => [ 4, 10 ],
"Deep slash to the .+? (right|left) forearm!" => [ 5, 15 ],
"Quick, hard slash to the .+? (right|left) arm!" => [ 6, 20 ],
"Off-balance slash to the .+? left arm shatters(its|his|her) elbow\." => [ 6, 20 ],
"Hard slash to the .+? side!" => [ 7, 25 ],
"Spectacular slash!" => [ 8, 35 ],
"Awesome slash sever the .+? (right|left) arm!" => [ 9, 40 ],
},
'hands' => {
"Near-miss!" => [ 0, 0 ],
"Diagonal slash to the .+? (weapon|shield) arm\." => [ 1, 1 ],
"Slash to the .+? shield arm\." => [ 1, 1 ],
"Wild slash bounces off the back of the .+? hand\." => [ 2, 3 ], #Unverified
"Wild slash scratches the back of the .+? hand\." => [ 2, 3 ],
"Feint to the .+? head!" => [ 3, 5 ],
"Slice to the .+? left fingers\." => [ 3, 5 ],
"Strong slash to the .+? (right|left) hand cuts deep\." => [ 4, 7 ],
"Deep cut to the .+? left hand!" => [ 4, 7 ],
"Slash to the .+? weapon hand!" => [ 5, 5 ],
"Slash to the .+? left hand!" => [ 5, 8 ],
"Rapped (the )?.+? knuckles hard!" => [ 6, 10 ],
"Jagged slash to the .+? (right|left) arm!" => [ 7, 15 ],
"Powerful slash trims the .+? fingernails..\." => [ 8, 25 ],
"Off-balanced slash!" => [ 9, 30 ],
},
'legs' => {
"Quick feint to the .+? (right|left) foot!" => [ 0, 0 ],
"Light, bruising slash to the .+? left thigh\." => [ 0, 0 ],
"Slash to the .+? (right|left) leg hits high!" => [ 1, 5 ],
"Banged the .+? (right|left) shin\." => [ 2, 10 ],
"Downward slash across the .+? (right|left) thigh!" => [ 3, 10 ],
"Deep, bloody slash to the .+? (right|left) thigh!" => [ 4, 17 ],
"Deft slash to the .+? left leg digs deep!" => [ 4, 17 ],
"Quick, powerful slash to the .+? (right|left) knee!" => [ 5, 20 ],
"Strong slash to the .+? (right|left) leg!" => [ 6, 25 ],
"Weak diagonal slash catches the .+? left knee!" => [ 6, 25 ],
"Wild downward slash severs the .+? (right|left) foot!" => [ 7, 30 ],
"Powerful slash!" => [ 8, 40 ],
"Powerful slash leaves the .+? without a (right|left) leg!" => [ 9, 45 ],
},
},
'puncture' => {
'head' => {
"Thrust catches chin\." => [ 0, 0 ],
"Glancing strike to the head!" => [ 1, 5 ],
"Nice shot to the head gouges the .+? cheek!" => [ 2, 8 ],
"Beautiful head shot!" => [ 3, 10 ],
"Strike to temple!" => [ 4, 15 ],
"Beautiful shot pierces skull!" => [ 5, 20 ],
"Amazing shot through the .+? nose enters the brain!" => [ 6, 25 ],
"Strike through both ears, foe is quite dead!" => [ 7, 30 ],
"Strike pierces temple and kills foe instantly!" => [ 8, 35 ],
"Awesome shot skewers skull!" => [ 9, 40 ],
},
'neck' => {
"Talk about a close shave!" => [ 0, 0 ],
"Minor strike to neck\." => [ 1, 3 ],
"Well placed shot to the neck\." => [ 2, 5 ],
"Strike just below the jaw, nice shot to the neck!" => [ 3, 7 ],
"Pierced through the neck, a fine shot!" => [ 4, 10 ],
"Neck skewered, sliding past the throat and spine!" => [ 5, 15 ],
"Fine shot pierces jugular vein!" => [ 6, 15 ],
"Strike clean through neck, what a shot!" => [ 7, 20 ],
"Strike punctures throat and ruins vocal cords!" => [ 8, 25 ],
"Incredible shot clean through the throat severs the spine!" => [ 9, 30 ],
},
'abdomen' => {
"Poked in the tummy\." => [ 0, 0 ],
"Minor puncture to the abdomen\." => [ 1, 5 ],
"Nice puncture to the abdomen, just missed vital organs!" => [ 2, 10 ],
"Strike pierces gall bladder!" => [ 3, 15 ],
"Strike to abdomen punctures stomach!" => [ 4, 20 ],
"Vicious strike punctures intestines!" => [ 5, 25 ],
"Bladder impaled, what a mess!" => [ 6, 25 ],
"Deft strike to abdomen penetrates several useful organs!" => [ 7, 30 ],
"Strike to abdomen skewers the critter quite nicely!" => [ 8, 40 ],
"Perfect strike to the abdomen\." => [ 9, 50 ],
},
'back' => {
"Thrust slides along the back\." => [ 0, 0 ],
"Minor puncture to the back\." => [ 1, 5 ],
"Nice puncture to the back, just grazed the spine!" => [ 2, 10 ],
"Strike connects with shoulder blade!" => [ 3, 15 ],
"Nailed in the lower back!" => [ 4, 20 ],
"Well placed strike to back shatters vertebrae!" => [ 5, 25 ],
"Deft strike to the back cracks vertebrae!" => [ 6, 30 ],
"Awesome shot shatters spine and punctures lung!" => [ 7, 35 ],
"Shot to back shatters bone and vertebrae!" => [ 8, 40 ],
"Incredible shot impales a kidney\." => [ 9, 50 ],
},
'chest' => {
"Blow slides along ribs\." => [ 0, 0 ],
"Minor puncture to the chest\." => [ 1, 5 ],
"Strike to the chest breaks a rib!" => [ 2, 10 ],
"Loud \*crack\* as the .+? sternum breaks!" => [ 3, 15 ],
"Well placed strike shatters a rib!" => [ 4, 20 ],
"Damaging strike to chest, several ribs shattered!" => [ 5, 25 ],
"Strong strike, punctures lung!" => [ 6, 30 ],
"Awesome shot shatters ribs and punctures lung!" => [ 7, 35 ],
"Beautiful shot pierces both lungs, the .+? makes a wheezing noise, and drops dead!" => [ 8, 40 ],
"Incredible strike pierces heart and runs the .+? clean through!" => [ 9, 50 ],
},
'eyes' => {
"Attack bumps an eyebrow\." => [ 0, 0 ],
"Minor strike under the (right|left) eye, that was close!" => [ 1, 1 ],
"Well aimed shot almost removes an eye!" => [ 2, 5 ],
"Surgical strike removes the .+? (right|left) eye!" => [ 3, 10 ],
"Attack punctures the eye and connects with something really vital!" => [ 4, 17 ],
"Shot knocks the .+? head back by pushing on the inside of the skull!" => [ 5, 20 ],
"Incredible shot to the eye penetrates deep into skull!" => [ 6, 25 ],
"Shot destroys eye and the brain behind it!" => [ 7, 30 ],
"Strike through eye, the .+? is lobotomized!" => [ 8, 35 ],
"Strike to the eye penetrates skull, ocular fluid sprays widely!" => [ 9, 40 ],
},
'hands' => {
"Strikes a fingernail\." => [ 0, 0 ],
"Strike to (right|left) hand breaks a fingernail!" => [ 1, 1 ],
"Strike through the palm!" => [ 2, 3 ],
"Shot to the hand slices a finger to the bone!" => [ 3, 5 ],
"Shot pierces a wrist!" => [ 4, 7 ],
"Slash across back of hand, tendons sliced!" => [ 5, 9 ],
"Impressive shot shatters wrist!" => [ 6, 12 ],
"Strike to wrist severs (right|left) hand!" => [ 7, 15 ],
"Strike to wrist severs (right|left) hand!" => [ 8, 18 ],
"Strike to wrist severs (right|left) hand quite neatly!" => [ 9, 20 ],
},
'arms' => {
"Tap to the arm pricks some interest but not much else\." => [ 0, 0 ],
"Minor puncture to the (right|left) arm\." => [ 1, 3 ],
"Strike pierces upper arm!" => [ 2, 5 ],
"Well aimed shot, punctures upper arm!" => [ 3, 7 ],
"Strike pierces forearm!" => [ 4, 10 ],
"Elbow punctured, oh what pain!" => [ 5, 14 ],
"Well aimed strike shatters bone in (right|left) arm!" => [ 6, 17 ],
"Strike to (right|left) arm cleanly severs it at the shoulder!" => [ 7, 22 ],
"Strike to (right|left) arm shatters elbow and severs forearm!" => [ 8, 25 ],
"Shot shatters shoulder and severs (right|left) arm!" => [ 9, 25 ],
},
'legs' => {
"Thrust glances off the .+? knee without a lot of effect\." => [ 0, 0 ],
"Minor puncture to the (right|left) leg\." => [ 1, 5 ],
"Strike pierces thigh!" => [ 2, 9 ],
"Well aimed shot, punctures calf!" => [ 3, 13 ],
"Strike pierces calf!" => [ 4, 17 ],
"Well placed shot pierces knee, that hurt!" => [ 5, 20 ],
"Great shot penetrates thigh and shatters bone!" => [ 6, 23 ],
"Blow shatters knee and severs lower leg!" => [ 7, 27 ],
"Strike punctures thigh and shatters femur!" => [ 8, 30 ],
"Shot shatters hip and severs (right|left) leg!" => [ 9, 35 ],
},
},
'crush' => {
'head' => {
"Love tap upside the .+? head!" => [ 0, 0 ],
"Blow to the head causes the .+? ears to ring!" => [ 1, 5 ],
"Hearty smack to the head\." => [ 2, 10 ],
"You broke the .+? nose!" => [ 3, 15 ],
"Skull cracks in several places\." => [ 4, 20 ],
"Solid strike caves the .+? skull in,resulting in instant death!" => [ 5, 25 ],
"Mighty swing separates head from shoulders\." => [ 6, 30 ],
"Tremendous blow crushes skull like a ripe melon\." => [ 7, 35 ],
"Brain driven into neck by mammoth downswing!" => [ 8, 40 ],
"Incredible blast shatters head into a red spray\." => [ 9, 50 ],
},
'neck' => {
"You leave a nice bruise on the .+? neck!" => [ 0, 0 ],
"Whiplash!" => [ 1, 2 ],
"Neck vertebrae snap\." => [ 2, 5 ],
"Shot to the neck scrapes away skin\." => [ 3, 10 ],
"Throat nearly crushed\." => [ 4, 12 ],
"Neck broken\." => [ 5, 15 ],
"You hear several snaps as the .+? neck is broken in several places\." => [ 6, 20 ],
"Vertebrae in .+? neck disintegrate from impact!" => [ 7, 25 ],
"Shot to neck sends .+? into shock which leads very quickly to death\." => [ 8, 30 ],
"Neck removed, head falls to the ground\." => [ 9, 40 ],
},
'eyes' => {
"Swing at the .+? eye catches an eyebrow instead!" => [ 0, 0 ],
"Cut over the .+? ((right|left)|left) eye\." => [ 1, 1 ],
"Strike to the eye clips the eyebrow\." => [ 2, 3 ],
"Smack to the eye bursts blood vessels\." => [ 3, 5 ],
"Crack to the head swells eye shut\." => [ 4, 10 ],
"Eye crushed by a hard blow to the face!" => [ 5, 15 ],
"Crushing blow to head closes that eye for good\." => [ 6, 20 ],
"Blow to eye impacts the brain\." => [ 7, 40 ],
"((right|left)|Left) eye ripped from head, along with most of brain\." => [ 8, 45 ],
"Smash to cheek driving bone through the eye and into the brain\." => [ 9, 50 ],
},
'chest' => {
"Thumped the .+? chest\." => [ 0, 0 ],
"Blow leaves an imprint on the .+? chest!" => [ 1, 5 ],
"Mighty blow cracks several ribs\." => [ 2, 10 ],
"Blow to chest causes the .+? heart to skip a beat\." => [ 3, 15 ],
#"Whoosh!" => [ 4, 20 ], --presents a confounding variable
#"Whoosh!" => [ 5, 25 ], --presents a confounding variable
"Awesome shot collapses a lung!" => [ 6, 45 ],
"Blow cracks a rib and punctures a lung\." => [ 7, 60 ],
"Massive blow punches a hole through the .+? chest!" => [ 8, 65 ],
"Massive blow smashes through ribs and drives .+? heart out the back\." => [ 9, 70 ],
},
'abdomen' => {
"Hit glances off the .+? hip\." => [ 0, 0 ],
"Stomach shot lands with a hollow \*thump\*\." => [ 1, 5 ],
"Grazing blow to the stomach\." => [ 2, 10 ],
"Internal organs bruised\." => [ 3, 15 ],
"Stomach ripped open by mighty blow!" => [ 4, 20 ],
"Knocked back several feet by blow to abdomen\." => [ 5, 25 ],
"Blow ruptures the stomach!" => [ 6, 30 ],
"Blow to stomach rearranges some organs!" => [ 7, 50 ],
"Incredible smash to what used to be a stomach!" => [ 8, 60 ],
"A mighty hit turns the .+? insides to outsides!" => [ 9, 75 ],
},
'back' => {
"Blow glances off the .+? shoulder\." => [ 0, 0 ],
"Jarring blow to the .+? back\." => [ 1, 3 ],
"Blow to back cracks several vertebrae\." => [ 2, 10 ],
"Respectable shot to the back\." => [ 3, 15 ],
"Flesh ripped from back, muscles exposed\." => [ 4, 20 ],
"The .+? is knocked sideways several feet by blow to back\." => [ 5, 25 ],
"Spinal cord damaged by smash to the back\." => [ 6, 30 ],
"Crushing blow to the spine!" => [ 7, 50 ],
"Body pulped to a gooey mass\." => [ 8, 60 ],
"A mighty blow cleaves a swath through the .+? back, taking the spine with it\." => [ 9, 75 ],
},
'arms' => {
"A feeble blow to the .+? ((right|left)|left) arm!" => [ 0, 0 ],
"Blow raises a welt on the .+? ((right|left)|left) arm\." => [ 1, 3 ],
"Bones in (right|left) arm crack\." => [ 2, 7 ],
"Large gash to the (right|left) arm, several muscles torn\." => [ 3, 8 ],
"(Right|Left) elbow smashed into a thousand pieces\." => [ 4, 10 ],
"(Weapon|Shield) arm mangled horribly\." => [ 5, 15 ],
"Hard hit shatters (weapon|shield) arm\." => [ 6, 20 ],
"(Right|Left) arm ripped from socket at the elbow!" => [ 7, 25 ],
"Lucky shot rips through bone and muscle sending (weapon|shield) arm flying\." => [ 8, 35 ],
"(Weapon|Shield) arm removed at the shoulder!" => [ 9, 40 ],
},
'hands' => {
"Blow nicks the .+? (right|left) hand\." => [ 0, 0 ],
"Broken finger on the .+? (right|left) hand!" => [ 1, 1 ],
"Flattened the .+? (right|left) hand\." => [ 2, 3 ],
"Finger ripped away from (right|left) hand\." => [ 3, 5 ],
"(Right|Left) hand smashed into a pulpy mass\." => [ 4, 7 ],
"(Right|Left) hand mangled horribly\." => [ 5, 8 ],
"Blast to hand reduces it to pulp!" => [ 6, 10 ],
"Blast to hand sends fingers flying in several different directions\." => [ 7, 15 ],
"Lucky shot severs (right|left) hand and sends it flying\." => [ 8, 25 ],
"(Right|Left) hand severed at the wrist!" => [ 9, 30 ],
},
'legs' => {
"Glancing blow to the .+? (right|left) leg!" => [ 0, 0 ],
"Torn muscle in the .+? (right|left) leg!" => [ 1, 7 ],
"Smash to the kneecap\." => [ 2, 10 ],
"You ripped a chunk out of the .+? (right|left) leg with that one\." => [ 3, 15 ],
"(Right|Left) kneecap smashed into pulp\." => [ 4, 17 ],
"(Right|Left) leg mangled horribly\." => [ 5, 20 ],
"Hard blow breaks the femur!" => [ 6, 25 ],
"(Right|Left) leg ripped from socket at the knee!" => [ 7, 30 ],
"Lucky shot rips through bone and muscle sending (right|left) leg flying\." => [ 8, 40 ],
"(Right|Left) hip pulped, severing the leg\." => [ 9, 45 ],
}
}
}
weaponTypes = {
#edged
'dagger' => {
#AvD = [ AsG, DF ]
'25' => [ 1, 0.250 ],
'23' => [ 5, 0.200 ],
'22' => [ 6, 0.200 ],
'21' => [ 7, 0.200 ],
'20' => [ 8, 0.200 ],
'15' => [ 9, 0.100 ],
'13' => [ 10, 0.100 ],
'11' => [ 11, 0.100 ],
'9' => [ 12, 0.100 ],
'10' => [ 13, 0.125 ],
'6' => [ 14, 0.125 ],
'2' => [ 15, 0.125 ],
'-2' => [ 16, 0.125 ],
'0' => [ 17, 0.075 ],
'-6' => [ 18, 0.075 ],
'-12' => [ 19, 0.075 ],
'-18' =>[ 20, 0.075 ]
}
}
fileName = "dataCritAnalysis.txt"
filePath = $script_dir + fileName
loop {
arrData = Array.new
critWeighting = 0
critPadding = 0
line = String.new
lines = []
line = waitfor("You (swing|slash|punch)")
next if weaponTypes.keys.find { |weapon| weapon =~ /#{checkright}/ }.nil?
charDexBonus = Stats.dex[1]
if line =~ /You (swing|slash|punch).+? at an? (.+?)!/
lines << line
until line =~ /Roundtime/
line = get
lines << line
n = 0
end
next unless lines.join(", ") =~ / \.\.\. and hit for/
lines.each { |string|
if string =~ / \.\.\. and hit for/
target = lines[n - 2].sub(/^.+? at an? /,'').chop
attackLine = lines[n - 1]
avd = attackLine.scan(/\-?[0-9]+/)[2].to_s
outcome = (attackLine.scan(/[0-9]+/)[5].to_i - 100).round.to_i
rawDamage = (outcome * weaponTypes["#{checkright}"]["#{avd}"][1]).round
asg = weaponTypes["#{checkright}"]["#{avd}"][0]
weaponCrits.each { |critType, critArea|
critArea.each { |area, messaging|
messaging.keys.find { |str|
if lines[n + 1] =~ /#{str}/
critRank = weaponCrits[critType][area][str][0]
if critRank.nil? or critRank < 1
break
end
bodyArea = area
unless File.exists?(filePath)
headers = [ "target,weapon,outcome,rawDamage,asg,critType,critR ank,bodyArea,charDexBonus,critWeighting,critPaddin g" ]
File.open(filePath, 'w') { |file| file.puts(headers) }
end
if asg == 1 or (asg == 7 and bodyArea !~ /chest|back|abdomen|arms|hands|legs/) or (asg == 6 and bodyArea !~ /chest|back|abdomen|arms|hands/) or (asg == 5 and bodyArea !~ /chest|back|abdomen/)
critDivisor = 5
elsif asg == 8 or (asg == 7 and bodyArea =~ /chest|back|abdomen|arms|hands|legs/) or (asg == 6 and bodyArea =~ /chest|back|abdomen|arms|hands/) or (asg == 5 and bodyArea =~ /chest|back|abdomen/) or (asg == 11 and bodyArea !~ /chest|back|abdomen|arms|hands|legs/) or (asg == 10 and bodyArea !~ /chest|back|abdomen|arms|hands/) or (asg == 9 and bodyArea !~ /chest|back|abdomen/)
critDivisor = 6
elsif asg == 12 or (asg == 11 and bodyArea =~ /chest|back|abdomen|arms|hands|legs/) or (asg == 10 and bodyArea =~ /chest|back|abdomen|arms|hands/) or (asg == 9 and bodyArea =~ /chest|back|abdomen/) or (asg == 15 and bodyArea !~ /chest|back|abdomen|arms|hands|legs/) or (asg == 14 and bodyArea !~ /chest|back|abdomen|arms|hands/) or (asg == 13 and bodyArea !~ /chest|back|abdomen/)
critDivisor = 7
elsif asg == 16 or (asg == 15 and bodyArea =~ /chest|back|abdomen|arms|hands|legs/) or (asg == 14 and bodyArea =~ /chest|back|abdomen|arms|hands/) or (asg == 13 and bodyArea =~ /chest|back|abdomen/) or (asg == 19 and bodyArea !~ /chest|back|abdomen|arms|hands|legs/) or (asg == 18 and bodyArea !~ /chest|back|abdomen|arms|hands/) or (asg == 17 and bodyArea !~ /chest|back|abdomen/)
critDivisor = 9
elsif asg == 20 or (asg == 19 and bodyArea =~ /chest|back|abdomen|arms|hands|legs/) or (asg == 18 and bodyArea =~ /chest|back|abdomen|arms|hands/) or (asg == 17 and bodyArea =~ /chest|back|abdomen/)
critDivisor = 11
else
respond "Unknown AsG!"
break
end
expectedRank = (rawDamage.round / critDivisor).floor
if expectedRank > 9
expectedRank = 9
end
echo "EXPECTED: #{expectedRank}"
echo "ACTUAL: #{critRank}"
if critRank < (expectedRank.to_f / 2).round
critPadding = rawDamage - expectedRank * critDivisor + 1
echo "At least #{critPadding} points of Crit Padding!"
elsif critRank > expectedRank
critWeighting = critRank * critDivisor - rawDamage.round
echo "At least #{critWeighting} points of Crit Weighting!"
end
arrData.push([target,checkright,outcome,rawDamage,asg,critType,c ritRank,bodyArea,charDexBonus,critWeighting,critPa dding].join(","))
end
}
}
}
end
n += 1
}
File.open(filePath, File::APPEND|File::RDWR) { |file| file.puts(arrData) }
end
}
weaponCrits = {
'slash' => {
'head' => {
"Flashy swing!" => [ 0, 0 ],
"Quick slash catches the .+? cheek!" => [ 1, 5 ],
"Blade slashes across the .+? face!" => [ 2, 10 ],
"Blow to head!" => [ 3, 15 ],
"Quick flick of the wrist!" => [ 4, 20 ],
"Hard blow to the .+? ear!" => [ 5, 25 ],
"Gruesome slash opens the .+? forehead!" => [ 6, 30 ],
"Wild upward slash remove the .+? face from(its|his|her) skull!" => [ 7, 35 ],
"Horrible slash to the .+? head!" => [ 8, 40 ],
"Gruesome, slashing blow to the side of the .+? head!" => [ 9, 50 ],
},
'neck' => {
"Close shave!" => [ 0, 0 ],
"Attack hits the .+? throat but doesn\'t break the skin\." => [ 1, 2 ],
"Strike dents the .+? larynx\." => [ 2, 5 ],
"Deft swing strikes the .+? neck\." => [ 3, 10 ],
"Strong slash to throat nicks a few blood vessels\." => [ 4, 12 ],
"Fast slash to the .+? neck exposes(its|his|her) windpipe\." => [ 5, 15 ],
"Deep slash to the .+? neck severs an artery!" => [ 6, 20 ],
"Gruesome slash to the .+? throat!" => [ 7, 25 ],
"Awful slash nearly decapitates the .+?!" => [ 8, 30 ],
"Incredible slash to the .+? neck!" => [ 9, 40 ],
},
'eyes' => {
"Quick slash at the .+? (right|left) eye\." => [ 0, 0 ],
"Slashing strike near forehead nicks an eyebrow!" => [ 1, 3 ],
"Gash to the .+? (right|left) eyebrow\." => [ 2, 3 ],
"Grazing slash to the .+? face!" => [ 3, 5 ],
"Upward slash gouges the .+? cheek!" => [ 4, 20 ],
"Slash strikes the .+? (right|left) eye\." => [ 5, 25 ],
"Slash to head destroys the .+? (right|left) eye!" => [ 6, 30 ],
"Slash to the .+? (right|left) eye!" => [ 7, 40 ],
"Horrifying slash to the .+? head!" => [ 8, 45 ],
"Blast to the .+? head destroys (right|left) eye!" => [ 9, 50 ],
},
'chest' => {
"Weak slash across chest!" => [ 0, 0 ],
"Deft slash across chest draws blood!" => [ 1, 1 ],
"Slash to the .+? chest!" => [ 2, 10 ],
"Slash to .+? chest\." => [ 3, 15 ],
"Slashing blow to chest knocks the .+? back a few paces!" => [ 4, 20 ],
"Crossing slash to the chest catches the .+? attention!" => [ 5, 25 ],
"Hard slash to the .+? side opens(its|his|her) spleen!" => [ 6, 45 ],
"Quick, powerful slash!" => [ 7, 60 ],
"Slash to the .+? ribs opens a sucking chest wound!" => [ 8, 65 ],
"Wicked slash slices open the .+? chest!" => [ 9, 70 ],
},
'back' => {
"Glancing blow to the .+? back\." => [ 0, 0 ],
"Weak slash to the .+? lower back!" => [ 1, 3 ],
"Feint to the left goes astray as the .+? dodges!" => [ 2, 10 ],
"Slash along the .+? lower back\." => [ 3, 15 ],
"Slash to the .+? lower back!" => [ 4, 20 ],
"Feint left spins the .+? around!" => [ 5, 25 ],
"The .+? twists away but is caught with a hard slash!" => [ 6, 30 ],
"Deft slash!" => [ 7, 50 ],
"Slash to the .+? lower back!" => [ 8, 60 ],
"Masterful slash to the .+? lower back!" => [ 9, 75 ],
},
'abdomen' => {
"Light slash to the .+? abdomen!" => [ 0, 0 ],
"Awkward slash to the .+? stomach!" => [ 1, 5 ],
"Smooth slash to the .+? hip!" => [ 2, 10 ],
"Hard slash to belly severs a few nerve endings\." => [ 3, 15 ],
"Diagonal slash leaves a bloody trail across the .+? torso\." => [ 4, 20 ],
"The .+? is backed up by a strong slash to(its|his|her) abdomen!" => [ 5, 25 ],
"Deep slash to the .+? (right|left) side!" => [ 6, 30 ],
"Amazing slash to the .+? belly!" => [ 7, 50 ],
"Bloody slash to the .+? side!" => [ 8, 60 ],
"Terrible slash to the .+? side!" => [ 9, 75 ],
},
'arms' => {
"Weak slash to the .+? (right|left) arm\." => [ 0, 0 ],
"Hard blow, but deflected\." => [ 0, 0 ],
"Quick slash to the .+? upper (right|left) arm!" => [ 1, 3 ],
"Hesitant slash to the .+? upper (right|left) arm!" => [ 2, 7 ],
"Slash to the .+? shield arm!" => [ 2, 7 ],
"Slash to the .+? (right|left) arm!" => [ 3, 8 ],
"Glancing slash to the .+? shield arm!" => [ 3, 8 ],
"Powerful slash just cracks the .+? (weapon|shield) arm!" => [ 4, 10 ],
"Deep slash to the .+? (right|left) forearm!" => [ 5, 15 ],
"Quick, hard slash to the .+? (right|left) arm!" => [ 6, 20 ],
"Off-balance slash to the .+? left arm shatters(its|his|her) elbow\." => [ 6, 20 ],
"Hard slash to the .+? side!" => [ 7, 25 ],
"Spectacular slash!" => [ 8, 35 ],
"Awesome slash sever the .+? (right|left) arm!" => [ 9, 40 ],
},
'hands' => {
"Near-miss!" => [ 0, 0 ],
"Diagonal slash to the .+? (weapon|shield) arm\." => [ 1, 1 ],
"Slash to the .+? shield arm\." => [ 1, 1 ],
"Wild slash bounces off the back of the .+? hand\." => [ 2, 3 ], #Unverified
"Wild slash scratches the back of the .+? hand\." => [ 2, 3 ],
"Feint to the .+? head!" => [ 3, 5 ],
"Slice to the .+? left fingers\." => [ 3, 5 ],
"Strong slash to the .+? (right|left) hand cuts deep\." => [ 4, 7 ],
"Deep cut to the .+? left hand!" => [ 4, 7 ],
"Slash to the .+? weapon hand!" => [ 5, 5 ],
"Slash to the .+? left hand!" => [ 5, 8 ],
"Rapped (the )?.+? knuckles hard!" => [ 6, 10 ],
"Jagged slash to the .+? (right|left) arm!" => [ 7, 15 ],
"Powerful slash trims the .+? fingernails..\." => [ 8, 25 ],
"Off-balanced slash!" => [ 9, 30 ],
},
'legs' => {
"Quick feint to the .+? (right|left) foot!" => [ 0, 0 ],
"Light, bruising slash to the .+? left thigh\." => [ 0, 0 ],
"Slash to the .+? (right|left) leg hits high!" => [ 1, 5 ],
"Banged the .+? (right|left) shin\." => [ 2, 10 ],
"Downward slash across the .+? (right|left) thigh!" => [ 3, 10 ],
"Deep, bloody slash to the .+? (right|left) thigh!" => [ 4, 17 ],
"Deft slash to the .+? left leg digs deep!" => [ 4, 17 ],
"Quick, powerful slash to the .+? (right|left) knee!" => [ 5, 20 ],
"Strong slash to the .+? (right|left) leg!" => [ 6, 25 ],
"Weak diagonal slash catches the .+? left knee!" => [ 6, 25 ],
"Wild downward slash severs the .+? (right|left) foot!" => [ 7, 30 ],
"Powerful slash!" => [ 8, 40 ],
"Powerful slash leaves the .+? without a (right|left) leg!" => [ 9, 45 ],
},
},
'puncture' => {
'head' => {
"Thrust catches chin\." => [ 0, 0 ],
"Glancing strike to the head!" => [ 1, 5 ],
"Nice shot to the head gouges the .+? cheek!" => [ 2, 8 ],
"Beautiful head shot!" => [ 3, 10 ],
"Strike to temple!" => [ 4, 15 ],
"Beautiful shot pierces skull!" => [ 5, 20 ],
"Amazing shot through the .+? nose enters the brain!" => [ 6, 25 ],
"Strike through both ears, foe is quite dead!" => [ 7, 30 ],
"Strike pierces temple and kills foe instantly!" => [ 8, 35 ],
"Awesome shot skewers skull!" => [ 9, 40 ],
},
'neck' => {
"Talk about a close shave!" => [ 0, 0 ],
"Minor strike to neck\." => [ 1, 3 ],
"Well placed shot to the neck\." => [ 2, 5 ],
"Strike just below the jaw, nice shot to the neck!" => [ 3, 7 ],
"Pierced through the neck, a fine shot!" => [ 4, 10 ],
"Neck skewered, sliding past the throat and spine!" => [ 5, 15 ],
"Fine shot pierces jugular vein!" => [ 6, 15 ],
"Strike clean through neck, what a shot!" => [ 7, 20 ],
"Strike punctures throat and ruins vocal cords!" => [ 8, 25 ],
"Incredible shot clean through the throat severs the spine!" => [ 9, 30 ],
},
'abdomen' => {
"Poked in the tummy\." => [ 0, 0 ],
"Minor puncture to the abdomen\." => [ 1, 5 ],
"Nice puncture to the abdomen, just missed vital organs!" => [ 2, 10 ],
"Strike pierces gall bladder!" => [ 3, 15 ],
"Strike to abdomen punctures stomach!" => [ 4, 20 ],
"Vicious strike punctures intestines!" => [ 5, 25 ],
"Bladder impaled, what a mess!" => [ 6, 25 ],
"Deft strike to abdomen penetrates several useful organs!" => [ 7, 30 ],
"Strike to abdomen skewers the critter quite nicely!" => [ 8, 40 ],
"Perfect strike to the abdomen\." => [ 9, 50 ],
},
'back' => {
"Thrust slides along the back\." => [ 0, 0 ],
"Minor puncture to the back\." => [ 1, 5 ],
"Nice puncture to the back, just grazed the spine!" => [ 2, 10 ],
"Strike connects with shoulder blade!" => [ 3, 15 ],
"Nailed in the lower back!" => [ 4, 20 ],
"Well placed strike to back shatters vertebrae!" => [ 5, 25 ],
"Deft strike to the back cracks vertebrae!" => [ 6, 30 ],
"Awesome shot shatters spine and punctures lung!" => [ 7, 35 ],
"Shot to back shatters bone and vertebrae!" => [ 8, 40 ],
"Incredible shot impales a kidney\." => [ 9, 50 ],
},
'chest' => {
"Blow slides along ribs\." => [ 0, 0 ],
"Minor puncture to the chest\." => [ 1, 5 ],
"Strike to the chest breaks a rib!" => [ 2, 10 ],
"Loud \*crack\* as the .+? sternum breaks!" => [ 3, 15 ],
"Well placed strike shatters a rib!" => [ 4, 20 ],
"Damaging strike to chest, several ribs shattered!" => [ 5, 25 ],
"Strong strike, punctures lung!" => [ 6, 30 ],
"Awesome shot shatters ribs and punctures lung!" => [ 7, 35 ],
"Beautiful shot pierces both lungs, the .+? makes a wheezing noise, and drops dead!" => [ 8, 40 ],
"Incredible strike pierces heart and runs the .+? clean through!" => [ 9, 50 ],
},
'eyes' => {
"Attack bumps an eyebrow\." => [ 0, 0 ],
"Minor strike under the (right|left) eye, that was close!" => [ 1, 1 ],
"Well aimed shot almost removes an eye!" => [ 2, 5 ],
"Surgical strike removes the .+? (right|left) eye!" => [ 3, 10 ],
"Attack punctures the eye and connects with something really vital!" => [ 4, 17 ],
"Shot knocks the .+? head back by pushing on the inside of the skull!" => [ 5, 20 ],
"Incredible shot to the eye penetrates deep into skull!" => [ 6, 25 ],
"Shot destroys eye and the brain behind it!" => [ 7, 30 ],
"Strike through eye, the .+? is lobotomized!" => [ 8, 35 ],
"Strike to the eye penetrates skull, ocular fluid sprays widely!" => [ 9, 40 ],
},
'hands' => {
"Strikes a fingernail\." => [ 0, 0 ],
"Strike to (right|left) hand breaks a fingernail!" => [ 1, 1 ],
"Strike through the palm!" => [ 2, 3 ],
"Shot to the hand slices a finger to the bone!" => [ 3, 5 ],
"Shot pierces a wrist!" => [ 4, 7 ],
"Slash across back of hand, tendons sliced!" => [ 5, 9 ],
"Impressive shot shatters wrist!" => [ 6, 12 ],
"Strike to wrist severs (right|left) hand!" => [ 7, 15 ],
"Strike to wrist severs (right|left) hand!" => [ 8, 18 ],
"Strike to wrist severs (right|left) hand quite neatly!" => [ 9, 20 ],
},
'arms' => {
"Tap to the arm pricks some interest but not much else\." => [ 0, 0 ],
"Minor puncture to the (right|left) arm\." => [ 1, 3 ],
"Strike pierces upper arm!" => [ 2, 5 ],
"Well aimed shot, punctures upper arm!" => [ 3, 7 ],
"Strike pierces forearm!" => [ 4, 10 ],
"Elbow punctured, oh what pain!" => [ 5, 14 ],
"Well aimed strike shatters bone in (right|left) arm!" => [ 6, 17 ],
"Strike to (right|left) arm cleanly severs it at the shoulder!" => [ 7, 22 ],
"Strike to (right|left) arm shatters elbow and severs forearm!" => [ 8, 25 ],
"Shot shatters shoulder and severs (right|left) arm!" => [ 9, 25 ],
},
'legs' => {
"Thrust glances off the .+? knee without a lot of effect\." => [ 0, 0 ],
"Minor puncture to the (right|left) leg\." => [ 1, 5 ],
"Strike pierces thigh!" => [ 2, 9 ],
"Well aimed shot, punctures calf!" => [ 3, 13 ],
"Strike pierces calf!" => [ 4, 17 ],
"Well placed shot pierces knee, that hurt!" => [ 5, 20 ],
"Great shot penetrates thigh and shatters bone!" => [ 6, 23 ],
"Blow shatters knee and severs lower leg!" => [ 7, 27 ],
"Strike punctures thigh and shatters femur!" => [ 8, 30 ],
"Shot shatters hip and severs (right|left) leg!" => [ 9, 35 ],
},
},
'crush' => {
'head' => {
"Love tap upside the .+? head!" => [ 0, 0 ],
"Blow to the head causes the .+? ears to ring!" => [ 1, 5 ],
"Hearty smack to the head\." => [ 2, 10 ],
"You broke the .+? nose!" => [ 3, 15 ],
"Skull cracks in several places\." => [ 4, 20 ],
"Solid strike caves the .+? skull in,resulting in instant death!" => [ 5, 25 ],
"Mighty swing separates head from shoulders\." => [ 6, 30 ],
"Tremendous blow crushes skull like a ripe melon\." => [ 7, 35 ],
"Brain driven into neck by mammoth downswing!" => [ 8, 40 ],
"Incredible blast shatters head into a red spray\." => [ 9, 50 ],
},
'neck' => {
"You leave a nice bruise on the .+? neck!" => [ 0, 0 ],
"Whiplash!" => [ 1, 2 ],
"Neck vertebrae snap\." => [ 2, 5 ],
"Shot to the neck scrapes away skin\." => [ 3, 10 ],
"Throat nearly crushed\." => [ 4, 12 ],
"Neck broken\." => [ 5, 15 ],
"You hear several snaps as the .+? neck is broken in several places\." => [ 6, 20 ],
"Vertebrae in .+? neck disintegrate from impact!" => [ 7, 25 ],
"Shot to neck sends .+? into shock which leads very quickly to death\." => [ 8, 30 ],
"Neck removed, head falls to the ground\." => [ 9, 40 ],
},
'eyes' => {
"Swing at the .+? eye catches an eyebrow instead!" => [ 0, 0 ],
"Cut over the .+? ((right|left)|left) eye\." => [ 1, 1 ],
"Strike to the eye clips the eyebrow\." => [ 2, 3 ],
"Smack to the eye bursts blood vessels\." => [ 3, 5 ],
"Crack to the head swells eye shut\." => [ 4, 10 ],
"Eye crushed by a hard blow to the face!" => [ 5, 15 ],
"Crushing blow to head closes that eye for good\." => [ 6, 20 ],
"Blow to eye impacts the brain\." => [ 7, 40 ],
"((right|left)|Left) eye ripped from head, along with most of brain\." => [ 8, 45 ],
"Smash to cheek driving bone through the eye and into the brain\." => [ 9, 50 ],
},
'chest' => {
"Thumped the .+? chest\." => [ 0, 0 ],
"Blow leaves an imprint on the .+? chest!" => [ 1, 5 ],
"Mighty blow cracks several ribs\." => [ 2, 10 ],
"Blow to chest causes the .+? heart to skip a beat\." => [ 3, 15 ],
#"Whoosh!" => [ 4, 20 ], --presents a confounding variable
#"Whoosh!" => [ 5, 25 ], --presents a confounding variable
"Awesome shot collapses a lung!" => [ 6, 45 ],
"Blow cracks a rib and punctures a lung\." => [ 7, 60 ],
"Massive blow punches a hole through the .+? chest!" => [ 8, 65 ],
"Massive blow smashes through ribs and drives .+? heart out the back\." => [ 9, 70 ],
},
'abdomen' => {
"Hit glances off the .+? hip\." => [ 0, 0 ],
"Stomach shot lands with a hollow \*thump\*\." => [ 1, 5 ],
"Grazing blow to the stomach\." => [ 2, 10 ],
"Internal organs bruised\." => [ 3, 15 ],
"Stomach ripped open by mighty blow!" => [ 4, 20 ],
"Knocked back several feet by blow to abdomen\." => [ 5, 25 ],
"Blow ruptures the stomach!" => [ 6, 30 ],
"Blow to stomach rearranges some organs!" => [ 7, 50 ],
"Incredible smash to what used to be a stomach!" => [ 8, 60 ],
"A mighty hit turns the .+? insides to outsides!" => [ 9, 75 ],
},
'back' => {
"Blow glances off the .+? shoulder\." => [ 0, 0 ],
"Jarring blow to the .+? back\." => [ 1, 3 ],
"Blow to back cracks several vertebrae\." => [ 2, 10 ],
"Respectable shot to the back\." => [ 3, 15 ],
"Flesh ripped from back, muscles exposed\." => [ 4, 20 ],
"The .+? is knocked sideways several feet by blow to back\." => [ 5, 25 ],
"Spinal cord damaged by smash to the back\." => [ 6, 30 ],
"Crushing blow to the spine!" => [ 7, 50 ],
"Body pulped to a gooey mass\." => [ 8, 60 ],
"A mighty blow cleaves a swath through the .+? back, taking the spine with it\." => [ 9, 75 ],
},
'arms' => {
"A feeble blow to the .+? ((right|left)|left) arm!" => [ 0, 0 ],
"Blow raises a welt on the .+? ((right|left)|left) arm\." => [ 1, 3 ],
"Bones in (right|left) arm crack\." => [ 2, 7 ],
"Large gash to the (right|left) arm, several muscles torn\." => [ 3, 8 ],
"(Right|Left) elbow smashed into a thousand pieces\." => [ 4, 10 ],
"(Weapon|Shield) arm mangled horribly\." => [ 5, 15 ],
"Hard hit shatters (weapon|shield) arm\." => [ 6, 20 ],
"(Right|Left) arm ripped from socket at the elbow!" => [ 7, 25 ],
"Lucky shot rips through bone and muscle sending (weapon|shield) arm flying\." => [ 8, 35 ],
"(Weapon|Shield) arm removed at the shoulder!" => [ 9, 40 ],
},
'hands' => {
"Blow nicks the .+? (right|left) hand\." => [ 0, 0 ],
"Broken finger on the .+? (right|left) hand!" => [ 1, 1 ],
"Flattened the .+? (right|left) hand\." => [ 2, 3 ],
"Finger ripped away from (right|left) hand\." => [ 3, 5 ],
"(Right|Left) hand smashed into a pulpy mass\." => [ 4, 7 ],
"(Right|Left) hand mangled horribly\." => [ 5, 8 ],
"Blast to hand reduces it to pulp!" => [ 6, 10 ],
"Blast to hand sends fingers flying in several different directions\." => [ 7, 15 ],
"Lucky shot severs (right|left) hand and sends it flying\." => [ 8, 25 ],
"(Right|Left) hand severed at the wrist!" => [ 9, 30 ],
},
'legs' => {
"Glancing blow to the .+? (right|left) leg!" => [ 0, 0 ],
"Torn muscle in the .+? (right|left) leg!" => [ 1, 7 ],
"Smash to the kneecap\." => [ 2, 10 ],
"You ripped a chunk out of the .+? (right|left) leg with that one\." => [ 3, 15 ],
"(Right|Left) kneecap smashed into pulp\." => [ 4, 17 ],
"(Right|Left) leg mangled horribly\." => [ 5, 20 ],
"Hard blow breaks the femur!" => [ 6, 25 ],
"(Right|Left) leg ripped from socket at the knee!" => [ 7, 30 ],
"Lucky shot rips through bone and muscle sending (right|left) leg flying\." => [ 8, 40 ],
"(Right|Left) hip pulped, severing the leg\." => [ 9, 45 ],
}
}
}
weaponTypes = {
#edged
'dagger' => {
#AvD = [ AsG, DF ]
'25' => [ 1, 0.250 ],
'23' => [ 5, 0.200 ],
'22' => [ 6, 0.200 ],
'21' => [ 7, 0.200 ],
'20' => [ 8, 0.200 ],
'15' => [ 9, 0.100 ],
'13' => [ 10, 0.100 ],
'11' => [ 11, 0.100 ],
'9' => [ 12, 0.100 ],
'10' => [ 13, 0.125 ],
'6' => [ 14, 0.125 ],
'2' => [ 15, 0.125 ],
'-2' => [ 16, 0.125 ],
'0' => [ 17, 0.075 ],
'-6' => [ 18, 0.075 ],
'-12' => [ 19, 0.075 ],
'-18' =>[ 20, 0.075 ]
}
}
fileName = "dataCritAnalysis.txt"
filePath = $script_dir + fileName
loop {
arrData = Array.new
critWeighting = 0
critPadding = 0
line = String.new
lines = []
line = waitfor("You (swing|slash|punch)")
next if weaponTypes.keys.find { |weapon| weapon =~ /#{checkright}/ }.nil?
charDexBonus = Stats.dex[1]
if line =~ /You (swing|slash|punch).+? at an? (.+?)!/
lines << line
until line =~ /Roundtime/
line = get
lines << line
n = 0
end
next unless lines.join(", ") =~ / \.\.\. and hit for/
lines.each { |string|
if string =~ / \.\.\. and hit for/
target = lines[n - 2].sub(/^.+? at an? /,'').chop
attackLine = lines[n - 1]
avd = attackLine.scan(/\-?[0-9]+/)[2].to_s
outcome = (attackLine.scan(/[0-9]+/)[5].to_i - 100).round.to_i
rawDamage = (outcome * weaponTypes["#{checkright}"]["#{avd}"][1]).round
asg = weaponTypes["#{checkright}"]["#{avd}"][0]
weaponCrits.each { |critType, critArea|
critArea.each { |area, messaging|
messaging.keys.find { |str|
if lines[n + 1] =~ /#{str}/
critRank = weaponCrits[critType][area][str][0]
if critRank.nil? or critRank < 1
break
end
bodyArea = area
unless File.exists?(filePath)
headers = [ "target,weapon,outcome,rawDamage,asg,critType,critR ank,bodyArea,charDexBonus,critWeighting,critPaddin g" ]
File.open(filePath, 'w') { |file| file.puts(headers) }
end
if asg == 1 or (asg == 7 and bodyArea !~ /chest|back|abdomen|arms|hands|legs/) or (asg == 6 and bodyArea !~ /chest|back|abdomen|arms|hands/) or (asg == 5 and bodyArea !~ /chest|back|abdomen/)
critDivisor = 5
elsif asg == 8 or (asg == 7 and bodyArea =~ /chest|back|abdomen|arms|hands|legs/) or (asg == 6 and bodyArea =~ /chest|back|abdomen|arms|hands/) or (asg == 5 and bodyArea =~ /chest|back|abdomen/) or (asg == 11 and bodyArea !~ /chest|back|abdomen|arms|hands|legs/) or (asg == 10 and bodyArea !~ /chest|back|abdomen|arms|hands/) or (asg == 9 and bodyArea !~ /chest|back|abdomen/)
critDivisor = 6
elsif asg == 12 or (asg == 11 and bodyArea =~ /chest|back|abdomen|arms|hands|legs/) or (asg == 10 and bodyArea =~ /chest|back|abdomen|arms|hands/) or (asg == 9 and bodyArea =~ /chest|back|abdomen/) or (asg == 15 and bodyArea !~ /chest|back|abdomen|arms|hands|legs/) or (asg == 14 and bodyArea !~ /chest|back|abdomen|arms|hands/) or (asg == 13 and bodyArea !~ /chest|back|abdomen/)
critDivisor = 7
elsif asg == 16 or (asg == 15 and bodyArea =~ /chest|back|abdomen|arms|hands|legs/) or (asg == 14 and bodyArea =~ /chest|back|abdomen|arms|hands/) or (asg == 13 and bodyArea =~ /chest|back|abdomen/) or (asg == 19 and bodyArea !~ /chest|back|abdomen|arms|hands|legs/) or (asg == 18 and bodyArea !~ /chest|back|abdomen|arms|hands/) or (asg == 17 and bodyArea !~ /chest|back|abdomen/)
critDivisor = 9
elsif asg == 20 or (asg == 19 and bodyArea =~ /chest|back|abdomen|arms|hands|legs/) or (asg == 18 and bodyArea =~ /chest|back|abdomen|arms|hands/) or (asg == 17 and bodyArea =~ /chest|back|abdomen/)
critDivisor = 11
else
respond "Unknown AsG!"
break
end
expectedRank = (rawDamage.round / critDivisor).floor
if expectedRank > 9
expectedRank = 9
end
echo "EXPECTED: #{expectedRank}"
echo "ACTUAL: #{critRank}"
if critRank < (expectedRank.to_f / 2).round
critPadding = rawDamage - expectedRank * critDivisor + 1
echo "At least #{critPadding} points of Crit Padding!"
elsif critRank > expectedRank
critWeighting = critRank * critDivisor - rawDamage.round
echo "At least #{critWeighting} points of Crit Weighting!"
end
arrData.push([target,checkright,outcome,rawDamage,asg,critType,c ritRank,bodyArea,charDexBonus,critWeighting,critPa dding].join(","))
end
}
}
}
end
n += 1
}
File.open(filePath, File::APPEND|File::RDWR) { |file| file.puts(arrData) }
end
}