From 3bba7a7075718d446519b9c087e8859b87125a23 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Sun, 19 Jan 2025 10:44:06 -0500 Subject: [PATCH 1/5] [eherbs.lic] v2.1.0 spellcast/ranged heals only option --- scripts/eherbs.lic | 102 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 77 insertions(+), 25 deletions(-) diff --git a/scripts/eherbs.lic b/scripts/eherbs.lic index e64912392..75d36116c 100644 --- a/scripts/eherbs.lic +++ b/scripts/eherbs.lic @@ -14,7 +14,9 @@ game: Gemstone tags: healing, herbs requires: Lich >= 4.6.0 - version: 2.0.18 + version: 2.1.0 + 2.1.0 (2025-01-19) + - add --spellcast and --ranged options to healdown to be able to do those again 2.0.18 (2025-01-06) - fix for min_stock_doses to persist thru current session running 2.0.17 (2025-01-06) @@ -2820,37 +2822,73 @@ module EHerbs def self.next_herb_type herb_type = nil herb_type = 'blood' if percenthealth < 50 && !EHerbs.data[:skippable].include?('blood') - unless herb_type - (%w[head neck torso limbs nerves] - EHerbs.data[:skippable]).each do |area| - if Wounds.send(area) > 1 - herb_type = "major #{EHerbs.data[:areas][area]} wound" - break + unless EHerbs.data[:spellcast_only] || EHerbs.data[:ranged_only] + unless herb_type + (%w[head neck torso limbs nerves] - EHerbs.data[:skippable]).each do |area| + if Wounds.send(area) > 1 + herb_type = "major #{EHerbs.data[:areas][area]} wound" + break + end end end - end - unless herb_type - (%w[head neck torso limbs nerves] - EHerbs.data[:skippable]).each do |area| - if Wounds.send(area) == 1 - herb_type = "minor #{EHerbs.data[:areas][area]} wound" - break + unless herb_type + (%w[head neck torso limbs nerves] - EHerbs.data[:skippable]).each do |area| + if Wounds.send(area) == 1 + herb_type = "minor #{EHerbs.data[:areas][area]} wound" + break + end end end - end - herb_type = 'severed limb' if herb_type.nil? && Scars.limbs == 3 && !EHerbs.data[:skippable].include?('limbs') - herb_type = 'missing eye' if herb_type.nil? && (Scars.reye == 3 || Scars.leye == 3) && !EHerbs.data[:skippable].include?('torso') - unless herb_type - (%w[head neck torso limbs nerves] - EHerbs.data[:skippable]).each do |area| - if Scars.send(area) > 1 - herb_type = "major #{EHerbs.data[:areas][area]} scar" - break + herb_type = 'severed limb' if herb_type.nil? && Scars.limbs == 3 && !EHerbs.data[:skippable].include?('limbs') + herb_type = 'missing eye' if herb_type.nil? && (Scars.reye == 3 || Scars.leye == 3) && !EHerbs.data[:skippable].include?('torso') + unless herb_type + (%w[head neck torso limbs nerves] - EHerbs.data[:skippable]).each do |area| + if Scars.send(area) > 1 + herb_type = "major #{EHerbs.data[:areas][area]} scar" + break + end + end + end + unless herb_type + (%w[head neck torso limbs nerves] - EHerbs.data[:skippable]).each do |area| + if Scars.send(area) == 1 && !EHerbs.data[:skip_scars] + herb_type = "minor #{EHerbs.data[:areas][area]} scar" + break + end end end end - unless herb_type - (%w[head neck torso limbs nerves] - EHerbs.data[:skippable]).each do |area| - if Scars.send(area) == 1 && !EHerbs.data[:skip_scars] - herb_type = "minor #{EHerbs.data[:areas][area]} scar" - break + if EHerbs.data[:spellcast_only] || EHerbs.data[:ranged_only] + unless herb_type + (%w[limbs head nerves] - EHerbs.data[:skippable]).each do |area| + if EHerbs.data[:spellcast_only] && area =~ /head|nerves/ + if [Wounds.head, Wounds.leftEye, Wounds.rightEye, Wounds.nsys].max > 1 + herb_type = "major #{EHerbs.data[:areas][area]} wound" + break + end + elsif area == 'limbs' + if [Wounds.leftArm, Wounds.leftHand, Wounds.rightArm, Wounds.rightHand].max > 1 + herb_type = "major #{EHerbs.data[:areas][area]} wound" + break + end + end + end + end + herb_type = 'severed limb' if herb_type.nil? && [Scars.rightHand, Scars.rightArm, Scars.leftHand, Scars.rightHand].max == 3 && !EHerbs.data[:skippable].include?('limbs') + herb_type = 'missing eye' if EHerbs.data[:spellcast_only] && herb_type.nil? && [Scars.rightEye, Scars.leftEye].max == 3 && !EHerbs.data[:skippable].include?('torso') + unless herb_type + (%w[limbs head nerves] - EHerbs.data[:skippable]).each do |area| + if EHerbs.data[:spellcast_only] && area =~ /head|nerves/ + if [Scars.head, Scars.leftEye, Scars.rightEye, Scars.nsys].max > 1 + herb_type = "major #{EHerbs.data[:areas][area]} scar" + break + end + elsif area == 'limbs' + if [Scars.leftArm, Scars.leftHand, Scars.rightArm, Scars.rightHand].max > 1 + herb_type = "major #{EHerbs.data[:areas][area]} scar" + break + end + end end end end @@ -3059,6 +3097,20 @@ module EHerbs else EHerbs.data[:no_get] = false end + if Script.current.vars.any? { |var| var =~ /^(?:--)?spellcast$/i } + EHerbs.data[:spellcast_only] = true + Script.current.vars.delete_if { |var| var =~ /^(?:--)?spellcast$/i } + Script.current.vars[0] = Script.current.vars[1..-1].join(' ') + else + EHerbs.data[:spellcast_only] = false + end + if Script.current.vars.any? { |var| var =~ /^(?:--)?ranged$/i } + EHerbs.data[:ranged_only] = true + Script.current.vars.delete_if { |var| var =~ /^(?:--)?ranged$/i } + Script.current.vars[0] = Script.current.vars[1..-1].join(' ') + else + EHerbs.data[:ranged_only] = false + end if Script.current.vars.any? { |var| var =~ /^blood$/i } || EHerbs.data[:blood_toggle] # and not Script.current.vars.any? { |var| var =~ /^stock blood/ } EHerbs.data[:blood_only] = true Script.current.vars.delete_if { |var| var =~ /^blood$/i } From 4266dc6f6a00f3f0ffb07d877cc1189de5f9f349 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Sun, 19 Jan 2025 11:39:48 -0500 Subject: [PATCH 2/5] update help output for both new commands --- scripts/eherbs.lic | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/eherbs.lic b/scripts/eherbs.lic index 75d36116c..d762df73f 100644 --- a/scripts/eherbs.lic +++ b/scripts/eherbs.lic @@ -2385,6 +2385,8 @@ module EHerbs respond ' --potions= Try to use potions first' respond ' --650= Cast Assume Aspect (650) Yierka' if Spell[650].known? respond ' --1035= Cast Song of Tonis (1035)' if Spell[1035].known? + respond ' --spellcast Attempt to only heal wounds that would prevent spellcasting' + respond ' --ranged Attempt to only heal wounds that would prevent ranged combat usage' respond respond " Change default options (so you don't have to specify the option every time):" respond " #{$clean_lich_char}#{Script.current.name} set buy same as above" From cd18aca62f3edf277946e62c4d9f43a037d94e55 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:02:24 -0500 Subject: [PATCH 3/5] logic correction in herb usage for new cmds --- scripts/eherbs.lic | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/scripts/eherbs.lic b/scripts/eherbs.lic index d762df73f..899e58985 100644 --- a/scripts/eherbs.lic +++ b/scripts/eherbs.lic @@ -2862,9 +2862,22 @@ module EHerbs end if EHerbs.data[:spellcast_only] || EHerbs.data[:ranged_only] unless herb_type - (%w[limbs head nerves] - EHerbs.data[:skippable]).each do |area| - if EHerbs.data[:spellcast_only] && area =~ /head|nerves/ - if [Wounds.head, Wounds.leftEye, Wounds.rightEye, Wounds.nsys].max > 1 + (%w[limbs head nerves torso] - EHerbs.data[:skippable]).each do |area| + if EHerbs.data[:spellcast_only] && area == 'head' + if [Wounds.head].max > 1 + herb_type = "major #{EHerbs.data[:areas][area]} wound" + break + end + elsif EHerbs.data[:spellcast_only] && area == 'torso' + if [Wounds.leftEye, Wounds.rightEye].max > 1 + herb_type = "major #{EHerbs.data[:areas][area]} wound" + break + elsif [Wounds.leftEye, Wounds.rightEye].max == 1 + herb_type = "minor #{EHerbs.data[:areas][area]} wound" + break + end + elsif EHerbs.data[:spellcast_only] && area == 'nerves' + if [Wounds.nsys].max > 1 herb_type = "major #{EHerbs.data[:areas][area]} wound" break end @@ -2879,15 +2892,25 @@ module EHerbs herb_type = 'severed limb' if herb_type.nil? && [Scars.rightHand, Scars.rightArm, Scars.leftHand, Scars.rightHand].max == 3 && !EHerbs.data[:skippable].include?('limbs') herb_type = 'missing eye' if EHerbs.data[:spellcast_only] && herb_type.nil? && [Scars.rightEye, Scars.leftEye].max == 3 && !EHerbs.data[:skippable].include?('torso') unless herb_type - (%w[limbs head nerves] - EHerbs.data[:skippable]).each do |area| - if EHerbs.data[:spellcast_only] && area =~ /head|nerves/ - if [Scars.head, Scars.leftEye, Scars.rightEye, Scars.nsys].max > 1 - herb_type = "major #{EHerbs.data[:areas][area]} scar" + (%w[limbs head nerves torso] - EHerbs.data[:skippable]).each do |area| + if EHerbs.data[:spellcast_only] && area == 'head' + if [Scars.head].max > 1 + herb_type = "major #{EHerbs.data[:areas][area]} wound" + break + end + elsif EHerbs.data[:spellcast_only] && area == 'torso' + if [Scars.leftEye, Scars.rightEye].max > 1 + herb_type = "major #{EHerbs.data[:areas][area]} wound" + break + end + elsif EHerbs.data[:spellcast_only] && area == 'nerves' + if [Scars.nsys].max > 1 + herb_type = "major #{EHerbs.data[:areas][area]} wound" break end elsif area == 'limbs' if [Scars.leftArm, Scars.leftHand, Scars.rightArm, Scars.rightHand].max > 1 - herb_type = "major #{EHerbs.data[:areas][area]} scar" + herb_type = "major #{EHerbs.data[:areas][area]} wound" break end end From 78fb1cdd14a06b60184938840e928666f279bc0b Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:04:19 -0500 Subject: [PATCH 4/5] typo error in scar section --- scripts/eherbs.lic | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/eherbs.lic b/scripts/eherbs.lic index 899e58985..58ea9f2c9 100644 --- a/scripts/eherbs.lic +++ b/scripts/eherbs.lic @@ -2895,22 +2895,22 @@ module EHerbs (%w[limbs head nerves torso] - EHerbs.data[:skippable]).each do |area| if EHerbs.data[:spellcast_only] && area == 'head' if [Scars.head].max > 1 - herb_type = "major #{EHerbs.data[:areas][area]} wound" + herb_type = "major #{EHerbs.data[:areas][area]} scar" break end elsif EHerbs.data[:spellcast_only] && area == 'torso' if [Scars.leftEye, Scars.rightEye].max > 1 - herb_type = "major #{EHerbs.data[:areas][area]} wound" + herb_type = "major #{EHerbs.data[:areas][area]} scar" break end elsif EHerbs.data[:spellcast_only] && area == 'nerves' if [Scars.nsys].max > 1 - herb_type = "major #{EHerbs.data[:areas][area]} wound" + herb_type = "major #{EHerbs.data[:areas][area]} scar" break end elsif area == 'limbs' if [Scars.leftArm, Scars.leftHand, Scars.rightArm, Scars.rightHand].max > 1 - herb_type = "major #{EHerbs.data[:areas][area]} wound" + herb_type = "major #{EHerbs.data[:areas][area]} scar" break end end From ee58db3445565f2fb48ec658da52934dff31c3dd Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:20:17 -0500 Subject: [PATCH 5/5] healdown wounds to rank0 due to scars not populating Due to XMLData.injuries not populating scars if a wound is present, change logic for to healdown wounds to rank 0 instead of rank 1 --- scripts/eherbs.lic | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/eherbs.lic b/scripts/eherbs.lic index 58ea9f2c9..9d65c6ed4 100644 --- a/scripts/eherbs.lic +++ b/scripts/eherbs.lic @@ -2867,6 +2867,9 @@ module EHerbs if [Wounds.head].max > 1 herb_type = "major #{EHerbs.data[:areas][area]} wound" break + elsif [Wounds.head].max == 1 + herb_type = "minor #{EHerbs.data[:areas][area]} wound" + break end elsif EHerbs.data[:spellcast_only] && area == 'torso' if [Wounds.leftEye, Wounds.rightEye].max > 1 @@ -2880,11 +2883,17 @@ module EHerbs if [Wounds.nsys].max > 1 herb_type = "major #{EHerbs.data[:areas][area]} wound" break + elsif [Wounds.nsys].max == 1 + herb_type = "minor #{EHerbs.data[:areas][area]} wound" + break end elsif area == 'limbs' if [Wounds.leftArm, Wounds.leftHand, Wounds.rightArm, Wounds.rightHand].max > 1 herb_type = "major #{EHerbs.data[:areas][area]} wound" break + elsif [Wounds.leftArm, Wounds.leftHand, Wounds.rightArm, Wounds.rightHand].max == 1 + herb_type = "minor #{EHerbs.data[:areas][area]} wound" + break end end end