Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eherbs.lic] v2.1.0 spellcast/ranged heals only option #1749

Merged
merged 5 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 111 additions & 25 deletions scripts/eherbs.lic
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -2383,6 +2385,8 @@ module EHerbs
respond ' --potions=<on/off> Try to use potions first'
respond ' --650=<on/off> Cast Assume Aspect (650) Yierka' if Spell[650].known?
respond ' --1035=<on/off> 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 <on/off> same as above"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }
Expand Down
Loading