diff --git a/scripts/eherbs.lic b/scripts/eherbs.lic index e64912392..9d65c6ed4 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) @@ -2383,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" @@ -2820,37 +2824,105 @@ 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 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 + 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 + 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 + 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 + 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 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]} scar" + break + end + elsif EHerbs.data[:spellcast_only] && area == 'torso' + if [Scars.leftEye, Scars.rightEye].max > 1 + 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]} 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 +3131,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 }