##### Crawl Init file ###############################################
# For descriptions of all options, as well as some more in-depth information
# on setting them, consult the file
# options_guide.txt
# in your /docs directory. If you can't find it, the file is also available
# online at:
# https://github.com/crawl/crawl/blob/master/crawl-ref/docs/options_guide.txt
#
# Crawl uses the first file of the following list as its option file:
# * init.txt in the -rcdir directory (if specified)
# * .crawlrc in the -rcdir directory (if specified)
# * init.txt (in the Crawl directory)
# * ~/.crawl/init.txt (Unix only)
# * ~/.crawlrc (Unix only)
# * ~/init.txt (Unix only)
# * settings/init.txt (in the Crawl directory)
##### Some basic explanation of option syntax #######################
# Lines beginning with '#' are comments. The basic syntax is:
#
# field = value or field.subfield = value
#
# Only one specification is allowed per line.
#
# The terms are typically case-insensitive except in the fairly obvious
# cases (the character's name and specifying files or directories when
# on a system that has case-sensitive filenames).
#
# White space is stripped from the beginning and end of the line, as
# well as immediately before and after the '='. If the option allows
# multiple comma/semicolon-separated terms (such as
# autopickup_exceptions), all whitespace around the separator is also
# trimmed. All other whitespace is left intact.
#
# There are three broad types of Crawl options: true/false values (booleans),
# arbitrary values, and lists of values. The first two types use only the
# simple =, with later options - which includes your options that are different
# from the defaults - overriding earlier ones. List options allow using +=, ^=,
# -=, and = to append, prepend, remove, and reset, respectively. Usually you will
# want to use += to add to a list option. Lastly, there is := which you can use
# to create an alias, like so:
# ae := autopickup_exceptions
# From there on, 'ae' will be treated as if it you typed autopickup_exceptions,
# so you can save time typing it.
#
##### Other files ###################################################
# You can include other files from your options file using the 'include'
# option. Crawl will treat it as if you copied the whole text of that file
# into your options file in that spot. You can uncomment some of the following
# lines by removing the beginning '#' to include some of the other files in
# this folder.
# Some useful, more advanced options, implemented in LUA.
# include = advanced_optioneering.txt
# Alternative vi bindings for Dvorak users.
# include = dvorak_command_keys.txt
# Alternative vi bindings for Colemak users.
# include = colemak_command_keys.txt
# Alternative vi bindings for Neo users.
# include = neo_command_keys.txt
# Override the vi movement keys with a non-command.
# include = no_vi_command_keys.txt
# Turn the shift-vi keys into safe move, instead of run.
# include = safe_move_shift.txt
explore_auto_rest = false
autofight_stop = 80
hp_warning = 78
view_delay = 300
# include = advanced_optioneering.txt
####### Do not modify the following values
{
AUTOMAGIC_NONE = 0 -- No auto magic at all
AUTOMAGIC_PERSIST = 1 -- Only magic which persists across stairs
-- like shroud of golubria
AUTOMAGIC_ALL = 2 -- All auto magic, including that which does
-- not persists across stairs like summons
SPELL_COST_SHROUD_OF_G = 2
SPELL_FAIL_SEVERITY_SAFE = 0 -- Grey
SPELL_FAIL_SEVERITY_SLIGHTLY_DANGEROUS = 1 -- White
SPELL_FAIL_SEVERITY_DANGEROUS = 2 -- Yellow
SPELL_FAIL_SEVERITY_QUITE_DANGEROUS = 3 -- Light Red
SPELL_FAIL_SEVERITY_EXTREMELY_DANGEROUS = 4 -- Red
SPELL_FAIL_SEVERITY_POTENTIALLY_LETHAL = 5 -- Purple
SPELL_SHROUD_OF_GOLUBRIA = "Shroud of Golubria"
-- SPELLS_SUMMON_CFG[1]={cost=8, max_summon=4, name="Summon Horrible Things", monsters={"large abomination", "tentacled monstrosity"}}
SPELLS_SUMMON_CFG={}
SPELLS_SUMMON_CFG[1]={cost=7, max_summon=1, name="Spellforged Servitor", monsters={"spellforged servitor"}}
SPELLS_SUMMON_CFG[2]={cost=7, max_summon=2, name="Monstrous Menagerie", monsters={"manticore", "lindwurm", "sphinx"}}
SPELLS_SUMMON_CFG[3]={cost=6, max_summon=1, name="Summon Cactus Giant", monsters={"cactus giant"}}
SPELLS_SUMMON_CFG[4]={cost=5, max_summon=1, name="Summon Mana Viper", monsters={"mana viper"}}
SPELLS_SUMMON_CFG[5]={cost=3, max_summon=1, name="Summon Ice Beast", monsters={"ice beast"}}
SPELLS_SUMMON_CFG[6]={cost=3, max_summon=1, name="Call Canine Familiar", monsters={"inugami"}}
SPELLS_SUMMON_CFG[7]={cost=2, max_summon=1, name="Call Imp", monsters={"cerulean imp"}}
SPELLS_SUMMON_CFG[8]={cost=1, max_summon=2, name="Summon Small Mammal", monsters={"rat", "quokka", "bat", "ball python"}}
SPELLS_SUMMON_CFG[9]={cost=5, max_summon=1, name="Iskenderun's Battlesphere", monsters={"battlesphere"}}
}
####### Do not modify the previous values
# Set travel delay to -1 for instant-travel, set to 1 to see travel paths
show_travel_trail=true
travel_key_stop = true
default_manual_training = true
travel_delay = 5
#include = macros_offline.txt
# just keep exploring
explore_stop -= stairs, items
explore_stop += glowing_items, artefacts, runes
{
MIN_MP_REST_PERCENT = 100
MIN_HP_REST_PERCENT = 100
-- Spells will only be autocast if their fail rate is
-- this or better and their severity is yellow or better.
-- Or if their fail rate is twice this or better and
-- their severity is white or better.
SPELL_REQUIRED_FAIL_RATE = 9
}
{
function xx()
end
}
{
function jdebug(msg)
-- crawl.mpr(msg)
end
}
#####################################################
# Ready Function - gets called when action required #
#####################################################
{
itemcount = 0
automagic = AUTOMAGIC_ALL
automatic_printed = false
auto_active = false
auto_resting = false
auto_exploring = false
auto_buffing = false
original_depth = -1
original_where = "-1"
function ready()
LuthTravel()
end
}
{
-- Requirements which apply to all auto spells
function general_allow_auto_spell(fight_prio)
local res = (
(you.feel_safe() or fight_prio)
and automagic>AUTOMAGIC_NONE
and you.contaminated()==0
)
--crawl.mpr ("general_allow_auto_spell()="..tostring(res))
return res
end
}
##############
# Auto magic #
##############
{
function total_cost_castable()
local cost = 0
if is_castable_shroud_of_g() then cost = cost+SPELL_COST_SHROUD_OF_G end
cost = cost + total_cost_castable_summons()
return cost
end
}
{
function total_cost_castable_summons()
local cost = 0
for _, spell_cfg in ipairs(SPELLS_SUMMON_CFG) do
if is_castable_summon(spell_cfg) then
cost = cost + spell_cfg.cost*spell_cfg.max_summon
end
end
return cost
end
}
{
function total_cost_needed_spells()
local cost = 0
if need_cast_shroud_of_golubria() then cost = cost+SPELL_COST_SHROUD_OF_G end
cost = cost + total_cost_needed_summons()
return cost
end
}
{
function total_cost_needed_summons()
local cost = 0
for _, spell_cfg in ipairs(SPELLS_SUMMON_CFG) do
if need_cast_summon(spell_cfg) then
needed_summons = spell_cfg.max_summon - num_summon_active(spell_cfg)
cost = cost + spell_cfg.cost*needed_summons
end
end
return cost
end
}
{
-- Returns true if a spell was cast
function auto_spell_maybe(fight_prio)
if you.contaminated()~=0 then
crawl.mpr("No auto magic while you are contaminaged.")
return false
end
if general_allow_auto_spell(fight_prio) then
if cast_shroud_of_g_maybe() then return true end
--jdebug("not cast_shroud_of_g_maybe()")
if auto_summon_maybe(fight_prio) then return true end
--jdebug("JADO not auto_summon_maybe()")
else
--jdebug("JADO not auto_spell_maybe()")
end
return false
end
}
{
-- Return true if a summon spell was cast
function auto_summon_maybe(fight_prio)
for _, spell_cfg in ipairs(SPELLS_SUMMON_CFG) do
if summon_maybe(spell_cfg, fight_prio) then
return true
else
jdebug("Do not cast "..spell_cfg.name)
end
end
return false
end
}
{
function spell_is_safe(spell_name)
return ( spells.fail_severity(spell_name) <= SPELL_FAIL_SEVERITY_SLIGHTLY_DANGEROUS and spells.fail(spell_name) <= SPELL_REQUIRED_FAIL_RATE*2 ) or
( spells.fail_severity(spell_name) <= SPELL_FAIL_SEVERITY_DANGEROUS and spells.fail(spell_name) <= SPELL_REQUIRED_FAIL_RATE )
end
}
{
lastTimeSummonCanineFamiliar = you.time() - 200
function extra_can_cast_canine_familiar()
return (not (string.find(crawl.messages(30), escape("canine familiar is too injured to answer")))) and
((you.time()-lastTimeSummonCanineFamiliar) > 200) -- 20 decaAuts
end
}
######################
# Control auto magic #
######################
{
function enable_automagic()
if automagic>=AUTOMAGIC_ALL then
crawl.mpr("All automagic is already enabled")
else
automagic = automagic+1
if automagic == AUTOMAGIC_ALL then
crawl.mpr("Enabled all automagic")
else
crawl.mpr("Enabled persistent across stairs automagic but not other automatic")
end
end
end
function disable_automagic()
if automagic<=AUTOMAGIC_NONE then
crawl.mpr("All automagic is already disabled")
else
automagic = automagic-1
if automagic == AUTOMAGIC_NONE then
crawl.mpr("Disabled all automagic")
else
crawl.mpr("Disabled some automagic but across stairs is still enabled")
end
end
end
}
#####################
# Auto Summon fight #
#####################
{
function auto_summon_fight()
if auto_spell_maybe(true) then
return
end
end
}
#################
# Auto Summon #
#################
{
-- lastTimeSummon = you.time()
function summon_maybe(spell_cfg, fight_prio)
local mp, max_mp = you.mp()
jdebug("check "..spell_cfg.name)
jdebug("need_cast_summon="..tostring(need_cast_summon(spell_cfg)))
jdebug("should_rest_magic="..tostring(should_rest_magic(mp, max_mp)))
jdebug("fight_prio="..tostring(fight_prio))
jdebug("is_castable_summon="..tostring(is_castable_summon(spell_cfg)))
if need_cast_summon(spell_cfg) and
( (not should_rest_magic(mp, max_mp)) or
(fight_prio and is_castable_summon(spell_cfg))
) then
crawl.mpr("Casting "..spell_cfg.name..".")
c=spells.letter(spell_cfg.name)
sendkeys("z"..c)
if spell_cfg.name=="Call Canine Familiar" then
lastTimeSummonCanineFamiliar = you.time()
end
return true
end
return false
end
}
{
function num_summon_active(spell_cfg)
local num_summons = 0
for x = -7,7 do
for y = -7,7 do
m = monster.get_monster_at(x, y)
local attitude_friendly = 4
if m and (m:attitude() == attitude_friendly) then
for _ , spell_monster_name in ipairs(spell_cfg.monsters) do
if m:name() == spell_monster_name then
num_summons = num_summons + 1
break
end
end
end
end
end
return num_summons
end
}
{
function is_castable_summon(spell_cfg)
--jdebug("known_spells["..spell_cfg.name.."]="..tostring(known_spells[spell_cfg.name]))
--jdebug("spell_is_safe(spell_cfg.name)="..tostring(spell_is_safe(spell_cfg.name)))
return automagic >= AUTOMAGIC_ALL and
known_spells[spell_cfg.name]~=nil and
spell_is_safe(spell_cfg.name)
end
}
{
function need_cast_summon(spell_cfg)
if spell_cfg.name=="Call Canine Familiar" and not extra_can_cast_canine_familiar() then
return false
end
--jdebug("num_summon_active="..tostring(num_summon_active(spell_cfg)).." spell_cfg.max_summon="..tostring(spell_cfg.max_summon))
return is_castable_summon(spell_cfg) and num_summon_active(spell_cfg)Casting Shroud of Golubria.")
c=spells.letter(SPELL_SHROUD_OF_GOLUBRIA)
sendkeys("z"..c)
return true
end
return false
end
function is_castable_shroud_of_g()
--crawl.mpr ( "known_spells[SPELL_SHROUD_OF_GOLUBRIA]="..tostring(known_spells[SPELL_SHROUD_OF_GOLUBRIA]~=nil))
--crawl.mpr ( "spell_is_safe(SPELL_SHROUD_OF_GOLUBRIA) = " .. tostring(spell_is_safe(SPELL_SHROUD_OF_GOLUBRIA)) )
--crawl.mpr ( "you.status(shrouded)=" .. tostring( you.status("shrouded") ) )
return automagic>=AUTOMAGIC_PERSIST and
known_spells[SPELL_SHROUD_OF_GOLUBRIA]~=nil and
spell_is_safe(SPELL_SHROUD_OF_GOLUBRIA)
end
function is_active_shroud_of_g()
return you.status("shrouded")
end
function need_cast_shroud_of_golubria()
return is_castable_shroud_of_g() and not is_active_shroud_of_g()
end
}
#############
# Auto rest #
#############
{
function StartLuthTravel()
auto_active = true
auto_resting = true
auto_exploring = true
auto_buffing = true
num_rests = 0
original_depth = you.depth()
original_where = you.where()
LuthTravel()
end
function LuthTravel()
print_automagic()
if string.find(crawl.messages(5), escape("Done explore")) or
string.find(crawl.messages(5), escape("Done exploring")) or
string.find(crawl.messages(5), escape("Your pack is full")) or
string.find(crawl.messages(5), escape("stopping explore")) or
string.find(crawl.messages(10), escape("Your transformation is almost over.")) or
string.find(crawl.messages(10), escape("Your deflect missiles spell is about to expire...")) or
string.find(crawl.messages(10), escape("Your repel missiles spell is about to expire...")) or
string.find(crawl.messages(10), escape("You feel less protected from missiles.")) or
string.find(crawl.messages(10), escape("You start to feel a little slower.")) or
string.find(crawl.messages(10), escape("You feel sluggish.")) or
string.find(crawl.messages(10), escape("You are starting to lose your buoyancy.")) or
string.find(crawl.messages(10), escape("Your icy armour starts to melt.")) or
string.find(crawl.messages(10), escape("Your icy armour evaporates.")) or
string.find(crawl.messages(10), escape("You feel closer to the material plane.")) or
string.find(crawl.messages(10), escape("You are firmly grounded in the material plane once more.")) or
string.find(crawl.messages(10), escape("Your icy shield starts to melt.")) or
string.find(crawl.messages(10), escape("Your icy shield evaporates.")) or
string.find(crawl.messages(10), escape("A sentinel's mark forms upon you")) or
string.find(crawl.messages(10), escape("watched by something")) or
string.find(crawl.messages(10), escape("Space warps horribly around you")) or
string.find(crawl.messages(10), escape("falls away")) or
string.find(crawl.messages(10), escape("offers you knowledge")) or
string.find(crawl.messages(10), escape("You have escaped")) or
string.find(crawl.messages(10), escape("You die")) or
string.find(crawl.messages(10), escape("stairsv")) or
string.find(crawl.messages(10), escape("Found a staircase to the Ecumenical Temple")) or
string.find(crawl.messages(10), escape("finished your manual")) or
string.find(crawl.messages(10), escape("tormentor")) or
string.find(crawl.messages(10), escape("fiend")) or
string.find(crawl.messages(10), escape("tzitzimi")) or
string.find(crawl.messages(10), escape("hell sentinel")) or
string.find(crawl.messages(10), escape("cacodemon")) or
string.find(crawl.messages(10), escape("monster_warning:neqoxec")) or
string.find(crawl.messages(10), escape("calcifying dust hits")) or
string.find(crawl.messages(10), escape("lethally poison")) or
string.find(crawl.messages(10), escape("abyssal rune of Zot")) or
string.find(crawl.messages(10), escape("Training target")) or
string.find(crawl.messages(10), escape("You have finished your manual")) or
string.find(crawl.messages(10), escape("Your transformation is almost over")) or
string.find(crawl.messages(10), escape("You now have enough gold to")) or
string.find(crawl.messages(10), escape("orbs of fire")) or
string.find(crawl.messages(10), escape("orb of fire")) or
string.find(crawl.messages(10), escape("lich")) or
string.find(crawl.messages(10), escape("The mighty Pandemonium lord")) or
string.find(crawl.messages(10), escape("wielding wand of")) or
string.find(crawl.messages(10), escape("of distortion")) or
string.find(crawl.messages(10), escape("abyssal rune of Zot")) or
string.find(crawl.messages(10), escape("confused")) or
string.find(crawl.messages(10), escape("poisoned")) or
string.find(crawl.messages(10), escape("A sentinel's mark forms upon you")) or
string.find(crawl.messages(10), escape("You sense a monster nearby")) or
string.find(crawl.messages(10), escape("There is an entrance")) or
string.find(crawl.messages(10), escape("Could not explore")) or
string.find(crawl.messages(10), escape("Partly explored")) or
string.find(crawl.messages(10), escape("shaft"))
then
auto_active = false
end
if
string.find(crawl.messages(10), escape("Ashenzari invites you")) or
you.where() ~= original_where or
you.depth() ~= original_depth
then
auto_active = false
auto_exploring = false
auto_resting = false
auto_exploring = false
end
if (not auto_resting) and (not auto_exploring) and (not auto_buffing) and (not auto_active) then
return
end
if (not auto_resting) and (not auto_exploring) and (not auto_buffing) and auto_active then
auto_resting = true
auto_exploring = true
auto_buffing = true
end
if not is_safe_to_travel() then
auto_resting = false
auto_exploring = false
auto_buffing = false
auto_active = false
if (not you.feel_safe()) then
--This will provide the "foo is nearby" message
autoexplore()
end
return
end
local action_done=false
if auto_resting then
--crawl.mpr("continue rest time=" .. tostring(you.time()))
action_done = auto_rest()
--crawl.mpr("rested="..tostring(rested).." auto_exploring="..tostring(auto_exploring))
if action_done then return end
auto_resting = false
end
if auto_buffing then
if auto_spell_maybe(false) then
return true
end
auto_buffing = false
end
if auto_exploring then
--crawl.mpr("spell_maybe is false");
--crawl.mpr("Continue travel")
auto_exploring = false
autoexplore()
end
end
function print_automagic()
if automagic_printed then return end
if automagic==AUTOMAGIC_NONE then
crawl.mpr("AUTOMAGIC: NONE")
elseif automagic==AUTOMAGIC_PERSIST then
crawl.mpr("AUTOMAGIC: ONLY PERSISTENT MAGIC")
elseif automagic==AUTOMAGIC_ALL then
crawl.mpr("AUTOMAGIC: ALL")
else
crawl.mpr("AUTOMAGIC: ERROR")
end
automagic_printed = true
end
function is_safe_to_travel()
return you.feel_safe()
and (not you.slowed())
and (not you.poisoned())
and (not you.confused())
and (not you.exhausted())
end
num_rests = 0
function auto_rest_start()
num_rests = 0
auto_active = false
auto_buffing = false
auto_resting = true
auto_exploring = false
auto_rest()
end
-- Returns true if rest was performed
function auto_rest()
if (not you.feel_safe()) then
--This will provide the "foo is nearby" message
autoexplore()
auto_exploring = false
auto_resting = false
auto_buffing = false
return false
end
local rested = rest_maybe()
if rested then
num_rests=num_rests + 1
else
--crawl.mpr(Rested "..tostring(num_rests).." time(s)")
end
if (not you.feel_safe()) then
--This will provide the "foo is nearby" message
autoexplore()
auto_exploring = false
auto_resting = false
auto_buffing = false
end
--crawl.mpr("auto_rest returns"..str(rested))
return rested
end
function at_feet()
return iter.invent_iterator:new(you.floor_items())
end
}
#########
# Aux #
#########
##################################
# Auxiliary Function Definitions #
##################################
{
function debug(name,what)
if what == nil then
crawl.mpr(string.format("%s: nil",name))
elseif type(what) == "boolean" then
crawl.mpr(string.format("%s: %s",name,what and "true" or "false"))
else
crawl.mpr(string.format("%s: %s",name,what))
end
end
}
{
last_time_autoexplore = 0.0
times_not_advance = 0
function autoexplore()
sendkeys("o")
end
}
{
function rest_once()
sendkeys(".")
end
}
{
function is_in_inventory(str)
for it in inventory() do
if string.find(it.name(), str) then
return true
end
end
return false
end
}
{
function inventory()
return iter.invent_iterator:new(items.inventory())
end
}
{
function floor_items()
return iter.invent_iterator:new(you.floor_items())
end
}
{
function is_equipped(where,str)
local eq = items.equipped_at(where)
if weapon then
return string.find(eq.name(), str)
else
return false
end
end
}
{
local function init_spells()
local spell_list = {}
for _, spell_name in ipairs(you.spells()) do
spell_list[spell_name] = true
end
return spell_list
end
known_spells = init_spells()
}
{
function sendkeys(command)
--crawl.flush_input()
----crawl.sendkeys(command)
--crawl.process_keys(command)
----crawl.process_command()
--crawl.flush_input()
crawl.flush_input()
crawl.sendkeys(command)
crawl.flush_input()
end
}
{
function should_rest_magic(mp, max_mp)
if mp==max_mp then return false end
jdebug("total_cost_needed_spells()="..tostring(total_cost_needed_spells()))
jdebug("total_cost_castable="..tostring(total_cost_castable()))
local min_mp = max_mp*(MIN_MP_REST_PERCENT/100.0)
local effective_mp = mp + ( total_cost_castable() - total_cost_needed_spells() )
jdebug("effective_mp="..tostring(effective_mp).." min_mp="..tostring(min_mp))
return effective_mp < min_mp
end
}
{
function should_rest(hp, mp, max_hp, max_mp)
local you_are_mummy = string.find(you.race(), "Mummy") ~= nil
local you_are_deep_dwarf = string.find(you.race(), "Deep Dwarf") ~= nil
local need_mp = should_rest_magic(mp, max_mp)
local need_mummy = ((hp < max_hp) or (mp < max_mp)) and you_are_mummy
local need_hp = hp < (max_hp*(MIN_HP_REST_PERCENT/100.0))
--crawl.mpr("should_rest_magic(mp, mp)="..tostring(should_rest_magic(mp, max_mp)))
return ( need_mp
or need_hp
or need_mummy
or you.slowed()
or you.poisoned()
or you.confused()
or you.exhausted()
)
end
}
{
function have_barbs()
return string.find(crawl.messages(10), escape("The barbed spikes become lodged in your body"))
or string.find(crawl.messages(10), escape("The barbed spikes dig painfully into your body as you move"))
end
}
{
function already_animated()
return string.find(crawl.messages(20), escape("Autocasting Animate Dead"))
end
}
{
function removed_barbs()
return string.find(crawl.messages(10), escape("You carefully extract the manticore spikes from your body"))
or string.find(crawl.messages(10), escape("The manticore spikes snap loose"))
end
}
{
function no_results()
return string.find(crawl.messages(10), escape("Can't find anything matching that"))
end
}
{
function dont_know_how_to_get_there()
return string.find(crawl.messages(10), escape("know how to get there"))
or string.find(crawl.messages(10), escape("Have to go through"))
end
}
{
function can_not_animate()
return string.find(crawl.messages(10), escape("There is nothing here that can be animated"))
end
}
{
function can_not_bottle()
return string.find(crawl.messages(10), escape("There isn't anything to bottle here"))
end
}
{
function recently_mass_animated()
return string.find(crawl.messages(10), escape("Autocasting Mass Animate Remains"))
end
}
{
function weapon_in_inventory()
for it in inventory() do
if string.find(it.class(true), "weapon") then
return true
end
end
return false
end
}
{
function weapon_in_slot_a()
local it = items.inslot(0)
if it then
return string.find(it.class(true), "weapon")
else
return false
end
end
}
{
function find_item_letter(str)
for i = 0,51 do
it = items.inslot(i)
if it then
if string.find(it.name(), str) then
return items.index_to_letter(i)
end
end
end
return false
end
}
{
function you_worship_sacrifice_god()
return string.find(you.god(), "Trog")
--or string.find(you.god(), "Oka")
--or string.find(you.god(), "Makhleb")
or string.find(you.god(), "Beogh")
or string.find(you.god(), "Lugonu")
--or string.find(you.god(), "Nemelex")
end
}
{
function on_corpses()
local fl = you.floor_items()
for it in iter.invent_iterator:new(fl) do
if string.find(it.name(), "corpse")
and not string.find(it.name(), "rotting")
and not string.find(it.name(), "plague") then
return true
end
end
return false
end
}
{
function you_are_not_ghoul()
return not (string.find(you.race(), "Ghoul"))
end
}
{
function you_are_not_troll()
return not (string.find(you.race(), "Troll"))
end
}
{
function you_are_not_felid()
return not (string.find(you.race(), "Felid"))
end
}
{
function you_are_not_octopode()
return not (string.find(you.race(), "Octopode"))
end
}
{
function find_corpses()
local race = you.race()
local god = you.god()
local exclude_this = ""
if string.find(god, "Shining") then
exlude_this = race
end
sendkeys(string.char(6) .. "@corpse&&!!rott&&!!skel&&!!sky&&!!necrop&&!!ugly&&!!vampire&&!!corpse rot&&!!&&!!botono" .. exclude_this .. "\ra\r")
end
}
{
function no_weapon()
return (items.equipped_at("Weapon") == nil) and not uses_unarmed()
end
}
{
function uses_unarmed()
return not you_are_not_ghoul()
or not you_are_not_troll()
or not you_are_not_felid()
or (you.skill("Unarmed Combat") >= 3)
end
}
{
function is_weapon(str)
local weapon = items.equipped_at("Weapon")
if weapon then
return string.find(weapon.name(), str)
else
return false
end
end
}
{
function is_ring(str)
local ring1 = items.equipped_at("Left Ring")
local ring2 = items.equipped_at("Right Ring")
if ring1 and ring2 then
return string.find(ring1.name(), str) or string.find(ring2.name(), str)
elseif ring1 then
return string.find(ring1.name(), str)
elseif ring2 then
return string.find(ring2.name(), str)
else
return false
end
end
}
{
function item_in_view(str)
local x,y
for x = -8,8 do
for y = -8,8 do
if not (x == 0 and y == 0) then
local pile = items.get_items_at(x,y)
if pile ~= nil then
for it in iter.invent_iterator:new(pile) do
if string.find(it.name(), str) and you.see_cell_no_trans(x,y) then
return true
end
end
end
end
end
end
return false
end
}
{
-- Returns a table where the key is the monster description and value is the total number of that mob in your vision
function getMonsterList()
local monsters = {}
for x = -7,7 do
for y = -7,7 do
m = monster.get_monster_at(x, y)
local attitude_hostile = 0
if m and (m:attitude() == attitude_hostile) and not (m:is_firewood()) then
desc = m:desc()
if (monsters[desc] == nil) then
monsters[desc] = 1
else
monsters[desc] = monsters[desc] + 1
end
end
end
end
return monsters
end
}
{
--Escapes the special characters in a string for pattern matching
function escape(str)
--Escapes parens and dash "()-"
local escaped = str:gsub('[%(%)%-]','%\%1')
--Removes any coloration parts of the string
return (escaped:gsub('<[^<]*>',''))
end
}
{
-- Returns true if an action has been performed
-- False otherwise.
function rest_maybe()
if (not you.feel_safe()) then return false end
local mp, max_mp = you.mp()
local hp, max_hp = you.hp()
local first_monster = next(getMonsterList())
local already_checked = (no_results() or dont_know_how_to_get_there())
local you_are_barbed = (have_barbs() and not removed_barbs())
local is_safe = (first_monster == nil)
local missing_mp = (mp < max_mp)
local missing_hp = (hp < max_hp)
local need_to_recover = should_rest(hp, mp, max_hp, max_mp)
local you_are_sif = string.find(you.god(), "Sif")
local you_are_yred = string.find(you.god(), "Yred")
local you_are_zin = string.find(you.god(), "Zin")
local you_are_good = string.find(you.god(), "Shining") or string.find(you.god(), "Elyvilon") or you_are_zin
local sacrifice_god = you_worship_sacrifice_god()
local you_are_mummy = string.find(you.race(), "Mummy")
local you_are_vampire = string.find(you.race(), "Vampire")
local you_are_ghoul = string.find(you.race(), "Ghoul")
local lichform = string.find(you.transform(), "lich")
local bladehands = string.find(you.transform(), "blade")
local dragonform = string.find(you.transform(), "dragon")
local melded_weapon = (bladehands or dragonform)
local you_are_regen = you.regenerating()
local you_know_sublimation = known_spells["Sublimation of Blood"] and (spells.fail("Sublimation of Blood") < 20) and (mp>3)
local you_know_animate_skeleton = known_spells["Animate Skeleton"] and (spells.fail("Animate Skeleton") < 20) and (mp>1)
local you_know_animate_dead = known_spells["Animate Dead"] and (spells.fail("Animate Dead") < 20) and (mp>4)
local distort_weapon = is_weapon("distort")
local vamp_weapon = is_weapon("vamp")
local have_a_weapon = weapon_in_inventory()
local ghoul_missing_hp = you_are_ghoul and ((hp < (max_hp - 5)) or you.rot() > 0)
local you_have_staff_of_energy = is_in_inventory("staff of energy")
local have_potion_of_blood = is_in_inventory("potion of blood") or is_in_inventory("potions of blood")
local staff_of_energy_is_equipped = is_weapon("staff of energy")
local staff_of_power_is_equipped = is_weapon("staff of power")
local staff_of_energy_letter = find_item_letter("staff of energy")
local should_channel_mp = (need_to_recover and (max_mp>mp) )
local can_cast_regen = known_spells["Regeneration"] and (mp>3) and (spells.fail("Regeneration") < 20)
local you_have_regen_ring = is_in_inventory("regeneration")
local regen_ring_letter = find_item_letter("regeneration")
local regen_ring_is_equipped = is_ring("regeneration")
local should_regen_hp = (not (you_are_good or you_are_regen or lichform)) and ((hp/max_hp) < 0.80) and (you_have_regen_ring or can_cast_regen)
local should_sublimate = (not (you_are_good or lichform)) and ((mp/max_mp) < 0.60) and you_know_sublimation and mp>2 and ((hp/max_hp) > 0.95)
local should_animate_skeleton = (not you_are_good) and you_know_animate_skeleton and mp>1 and (not can_not_animate())
local should_animate_dead = (not you_are_good) and you_know_animate_dead and mp>4 and (not can_not_animate())
if you_are_barbed then
rest_once()
--elseif should_sublimate and not (you_are_vampire or lichform) then
-- crawl.mpr("Autocasting Sublimation of Blood.")
-- sendkeys('zm')
--elseif should_channel_mp and you_are_sif and (you.piety_rank() > 0) then
-- crawl.mpr("Autochanneling using Sif.")
-- sendkeys('aa')
--elseif should_regen_hp and can_cast_regen then
-- crawl.mpr("Autocasting Regen.")
-- --This assumes casting regen is bound to zr
-- sendkeys('zr')
elseif need_to_recover then
-- crawl.mpr("DEBUG: Doing normal rest")
rest_once()
-- end
else
--crawl.mpr("DEBUG: return false - no rest")
return false -- No resting to be done
end
--crawl.mpr("DEBUG: return true - something done")
return true -- Rest was performed
end
}
# Other config
explore_wall_bias = 100
travel_open_doors = false
#Safety
runrest_stop_message += Your transformation is almost over.
runrest_stop_message += Your deflect missiles spell is about to expire...
runrest_stop_message += Your repel missiles spell is about to expire...
runrest_stop_message += You feel less protected from missiles.
runrest_stop_message += You start to feel a little slower.
runrest_stop_message += You feel sluggish.
runrest_stop_message += You are starting to lose your buoyancy.
runrest_stop_message += Your icy armour starts to melt.
runrest_stop_message += Your icy armour evaporates.
runrest_stop_message += You feel closer to the material plane.
runrest_stop_message += You are firmly grounded in the material plane once more.
runrest_stop_message += Your icy shield starts to melt.
runrest_stop_message += Your icy shield evaporates.
runrest_stop_message ^= .*spellforged servitor disappears.*
runrest_stop_message += .*spellforged servitor disappears.*
runrest_stop_message += Your battlesphere wavers and loses cohesion.
runrest_stop_message ^= .*quokka disappears in a puff.*
runrest_stop_message ^= .*ball python disappears in a puff.*
runrest_stop_message ^= .*cerulean imp disappears in a puff.*
runrest_stop_message ^= .*rat disappears in a puff.*
runrest_stop_message ^= .*bat disappears in a puff.*
runrest_stop_message ^= .*inugami disappears in a puff.*
runrest_stop_message ^= .*lindwurm disappears in a puff.*
runrest_stop_message ^= .*manticore disappears in a puff.*
runrest_stop_message ^= .*sphinx disappears in a puff.*
runrest_stop_message ^= .*sphinx disappears in a puff.*
runrest_stop_message ^= .*large abomination disappears in a puff.*
runrest_stop_message ^= .*tentacled monstrosity disappears in a puff.*
runrest_stop_message += A sentinel's mark forms upon you
runrest_stop_message += watched by something
runrest_stop_message += Space warps horribly around you
runrest_stop_message += falls away
runrest_stop_message += offers you knowledge
runrest_stop_message += You have escaped
runrest_stop_message += You die
runrest_stop_message += stairs
runrest_stop_message += Found a staircase to the Ecumenical Temple
runrest_stop_message ^= .*Ecumenical Temple.*
runrest_stop_message += finished your manual
runrest_stop_message += monster_warning:tormentor
runrest_stop_message += monster_warning:fiend
runrest_stop_message += monster_warning:tzitzimi
runrest_stop_message += monster_warning:hell sentinel
runrest_stop_message += monster_warning:cacodemon
runrest_stop_message += monster_warning:neqoxec
runrest_stop_message += calcifying dust hits
runrest_stop_message += lethally poison
runrest_stop_message += Found .* abyssal rune of Zot
runrest_stop_message ^= .*You fall into a shaft.*
runrest_stop_message += mutation:
runrest_stop_message += duration:
runrest_stop_message += timed_portal:
runrest_stop_message += hell_effect:
runrest_stop_message += Training target .* reached!
runrest_stop_message += You have finished your manual
runrest_stop_message += Your transformation is almost over
runrest_stop_message += Vehument offers you knowledge more += You now have enough gold to
runrest_stop_message += Space .* around you
runrest_stop_message += .orbs? of fire. comes? into view
runrest_stop_message += .pandemonium comes? into view
runrest_stop_message += .lich. comes? into view
runrest_stop_message += The mighty Pandemonium lord .* resides here
runrest_stop_message += * wielding wand of *
runrest_stop_message += .*wielding.*of distortion
runrest_stop_message += Found .* abyssal rune of Zot
runrest_stop_message += You are(?!.longer).(confused|poisoned)
runrest_stop_message += A sentinel's mark forms upon you
runrest_stop_message += Ashenzari invites you.*
runrest_stop_message += Could not explore
runrest_stop_message += Zot will find you
show_more = false
force_more_message += A sentinel's mark forms upon you
force_more_message += watched by something
force_more_message += Space warps horribly around you
force_more_message += falls away
force_more_message += offers you knowledge
force_more_message += You have escaped
force_more_message += You die
force_more_message += stairs
force_more_message += Found a staircase to the Ecumenical Temple
force_more_message ^= .*Ecumenical Temple.*
force_more_message += finished your manual
force_more_message += monster_warning:tormentor
force_more_message += monster_warning:fiend
force_more_message += monster_warning:tzitzimi
force_more_message += monster_warning:hell sentinel
force_more_message += monster_warning:cacodemon
force_more_message += monster_warning:neqoxec
force_more_message += calcifying dust hits
force_more_message += lethally poison
force_more_message += Found .* abyssal rune of Zot
force_more_message += mutations:
force_more_message += duration:
force_more_message += timed_portal:
force_more_message += hell_effect:
force_more_message += Training target .* reached!
force_more_message += You have finished your manual
force_more_message += Your transformation is almost over
force_more_message += Vehument offers you knowledge more += You now have enough gold to
force_more_message += Space .* around you
force_more_message += .orbs? of fire. comes? into view
force_more_message += .pandemonium comes? into view
force_more_message += .lich. comes? into view
force_more_message += The mighty Pandemonium lord .* resides here
force_more_message += * wielding wand of *
force_more_message += (?!.(Here|Aim):).*wielding.*of distortion
force_more_message += Found .* abyssal rune of Zot
force_more_message += You are(?!.longer).(confused|poisoned)
force_more_message += A sentinel's mark forms upon you
force_more_message += Ashenzari invites you.*
force_more_message ^= .*You fall into a shaft.*
#################
# Online macros #
#################
bindkey = [^K] CMD_DISPLAY_RELIGION
#bindkey = [^D] CMD_DISPLAY_RELIGION
#spell_slot += mystic blast:b
#spell_slot += conjure flame:c
#spell_slot += dazzling spray:d
#spell_slog += regeneration:g
#spell_slot += haste:h
spell_slot += conjure ball lightning:L
# Key Mappings:
# +: auto rest
macros += K + ===auto_rest_start
#F1 Go upstairs
macros += M \{-265} X<
macros += K1 \{-265} .
#F2 select other upstairs
macros += K1 \{-266} <
#F2 Enable automagic
macros += M \{-266} ===enable_automagic
#F3 Disable automagic
macros += M \{-267} ===disable_automagic
# Show status
#macros += M \{} ===xx
F4: auto explore
macros += M \{-268} ===StartLuthTravel
spell_slot ^= magic dart:a
spell_slot ^= sand blast:a
macros += M \{-1018} zH
macros += K2 \{-1018} f
macros += K3 \{-1018} Y
spell_slot += searing ray:b
spell_slot += stone arrow:b
macros += M \{-1012} zI
macros += K2 \{-1012} f
macros += K3 \{-1012} Y
#Numpad insert
macros += K \{-1000} .
macros += K2 \{-1000} .
#F10 Summon 2
macros += M \{-274} zF
macros += K2 \{-274} f
#F9
#spell_slot += Summon 1
macros += M \{-273} zD
macros += K2 \{-273} f
#F8
macros += M \{-272} zp
macros += K2 \{-272} f
macros += K3 \{-272} Y
spell_slot += fulminant prism:p
#F7 Spell forged servitor
macros += M \{-271} zE
macros += K2 \{-271} f
macros += K3 \{-271} Y
#F6 Iskenderun battlesphere
macros += M \{-270} zD
macros += K2 \{-270} f
macros += K3 \{-270} Y
#F5
macros += M \{-269} ===auto_summon_fight
#1
macros += M 1 zH
macros += K2 1 f
macros += K3 1 Y
#2
macros += M 2 zH
macros += K2 2 f
macros += K3 2 Y
#3
macros += M 3 zJ
macros += K2 3 f
macros += K3 3 Y
#4
macros += M 4 zE
macros += K2 4 f
macros += K3 4 Y
#0
macros += M 0 zE
macros += K2 4 f
macros += K3 4 Y
spell_slot += .*:ABCDEFGHIJKLMNOPQRSTUVWXYZ