more += distortion
force_more_message += transformation, weakening
runrest_stop_message += friend_action:
runrest_stop_message += melt, evaporates, transformation, flicker, weakening
auto_sacrifice = true
auto_butcher = true
explore_auto_rest = true
autofight_stop = 70
rest_wait_percent = 100
tile_web_mouse_control = false
auto_exclude += web
flash_screen_message += wielding.*distortion
use_animations -= player
easy_floor_use = true
force_more_message += fall into a
force_more_message += toss it
force_more_message += Xom
force_more_message += You are engulfed in calcifying dust
force_more_message += creaks loudly
force_more_message += almost over
force_more_message += You revert
force_more_message += goes berserk
force_more_message += "Detected throwing nets!"
runrest_stop_message ^= Your transformation is almost over
runrest_stop_message ^= You revert
runrest_stop_message ^= has ended
runrest_stop_message ^= faded away
interrupt_memorise += sense_monster
interrupt_memorise += monster
confirm_action += Exsanguinate
confirm_action += "Evoke Invisibility"
confirm_action += "Evoke Blink"
travel_avoid_terrain += deep water
autoinscribe += atropa-tipped dart:!f
autoinscribe += datura-tipped dart:!f
autoinscribe += boomerang of dispersal:!f
autoinscribe += boomerangs of dispersal:!f
autopickup_exceptions += phantom,condenser,beasts,phial
launcher_autoquiver = true
prompt_menu=false
###############
# Damage Calc #
###############
<
local previous_hp = 0
local previous_mp = 0
local previous_form = ""
local was_berserk_last_turn = false
function AnnounceDamage()
local current_hp, max_hp = you.hp()
local current_mp, max_mp = you.mp()
--Things that increase hp/mp temporarily really mess with this
local current_form = you.transform()
local you_are_berserk = you.berserk()
local max_hp_increased = false
local max_hp_decreased = false
if (current_form ~= previous_form) then
if (previous_form:find("dragon") or
previous_form:find("statue") or
previous_form:find("tree") or
previous_form:find("ice")) or
previous_form:find("hydra")then
max_hp_decreased = true
elseif (current_form:find("dragon") or
current_form:find("statue") or
current_form:find("tree") or
previous_form:find("ice")) or
previous_form:find("hydra")then
max_hp_increased = true
end
end
if (was_berserk_last_turn and not you_are_berserk) then
max_hp_decreased = true
elseif (you_are_berserk and not was_berserk_last_turn) then
max_hp_increased = true
end
--crawl.mpr(string.format("previous_form is: %s", previous_form))
--crawl.mpr(string.format("current_form is: %s", current_form))
--crawl.mpr(string.format("max_hp_increased is: %s", max_hp_increased and "True" or "False"))
--crawl.mpr(string.format("max_hp_decreased is: %s", max_hp_decreased and "True" or "False"))
--crawl.mpr(string:format("you_are_berserk is: %s", you_are_berserk and "True" or "False"))
--crawl.mpr(string:format("was_berserk_last_turn is: %s", was_berserk_last_turn and "True" or "False"))
--Skips message on initializing game
if previous_hp > 0 then
local hp_difference = previous_hp - current_hp
local mp_difference = previous_mp - current_mp
if max_hp_increased or max_hp_decreased then
if max_hp_increased then
crawl.mpr("You now have " .. current_hp .. "/" .. max_hp .. " hp.")
else
crawl.mpr("You now have " .. current_hp .. "/" .. max_hp .. " hp.")
end
else
--On losing health
if (current_hp < previous_hp) then
if current_hp <= (max_hp * 0.30) then
crawl.mpr("You take " .. hp_difference .. " damage, and have " .. current_hp .. "/" .. max_hp .. " hp.")
elseif current_hp <= (max_hp * 0.50) then
crawl.mpr("You take " .. hp_difference .. " damage, and have " .. current_hp .. "/" .. max_hp .. " hp.")
elseif current_hp <= (max_hp * 0.70) then
crawl.mpr("You take " .. hp_difference .. " damage, and have " .. current_hp .. "/" .. max_hp .. " hp.")
elseif current_hp <= (max_hp * 0.90) then
crawl.mpr("You take " .. hp_difference .. " damage, and have " .. current_hp .. "/" .. max_hp .. " hp.")
else
crawl.mpr("You take " .. hp_difference .. " damage, and have " .. current_hp .. "/" .. max_hp .. " hp.")
end
if hp_difference > (max_hp * 0.20) then
crawl.mpr("MASSIVE DAMAGE!!")
end
end
--On gaining more than 1 health
if (current_hp > previous_hp) then
--Removes the negative sign
local health_inturn = (0 - hp_difference)
if (health_inturn > 1) and not (current_hp == max_hp) then
if current_hp <= (max_hp * 0.30) then
crawl.mpr("You regained " .. health_inturn .. " hp, and now have " .. current_hp .. "/" .. max_hp .. " hp.")
elseif current_hp <= (max_hp * 0.50) then
crawl.mpr("You regained " .. health_inturn .. " hp, and now have " .. current_hp .. "/" .. max_hp .. " hp.")
elseif current_hp <= (max_hp * 0.70) then
crawl.mpr("You regained " .. health_inturn .. " hp, and now have " .. current_hp .. "/" .. max_hp .. " hp.")
elseif current_hp <= (max_hp * 0.90) then
crawl.mpr("You regained " .. health_inturn .. " hp, and now have " .. current_hp .. "/" .. max_hp .. " hp.")
else
crawl.mpr("You regained " .. health_inturn .. " hp, and now have " .. current_hp .. "/" .. max_hp .. " hp.")
end
end
if (current_hp == max_hp) then
crawl.mpr("Health restored: " .. current_hp .. "")
end
end
--On gaining more than 1 magic
if (current_mp > previous_mp) then
--Removes the negative sign
local mp_inturn = (0 - mp_difference)
if (mp_inturn > 1) and not (current_mp == max_mp) then
if current_mp < (max_mp * 0.25) then
crawl.mpr("You regained " .. mp_inturn .. " mp, and now have " .. current_mp .. "/" .. max_mp .. " mp.")
elseif current_mp < (max_mp * 0.50) then
crawl.mpr("You regained " .. mp_inturn .. " mp, and now have " .. current_mp .. "/" .. max_mp .. " mp.")
else
crawl.mpr("You regained " .. mp_inturn .. " mp, and now have " .. current_mp .. "/" .. max_mp .. " mp.")
end
end
if (current_mp == max_mp) then
crawl.mpr("MP restored: " .. current_mp .. "")
end
end
--On losing magic
if current_mp < previous_mp then
if current_mp <= (max_mp / 5) then
crawl.mpr("You now have " .. current_mp .. "/" ..max_mp .." mp.")
elseif current_mp <= (max_mp / 2) then
crawl.mpr("You now have " .. current_mp .. "/" ..max_mp .." mp.")
else
crawl.mpr("You now have " .. current_mp .. "/" ..max_mp .." mp.")
end
end
end
end
--Set previous hp/mp and form at end of turn
previous_hp = current_hp
previous_mp = current_mp
previous_form = current_form
was_berserk_last_turn = you_are_berserk
end
>
####################
# Opens skill menu #
####################
<
local need_skills_opened = true
function OpenSkills()
if you.turns() == 0 and need_skills_opened then
need_skills_opened = false
crawl.sendkeys("m")
end
end
>
########################################################
## Safe movement: alert when enemies appear ##
########################################################
{
safe_move_toggle = true
function toggle_safe_move()
if safe_move_toggle then
safe_move_toggle = false
crawl.message("safe move off", 0)
crawl.setopt("mon_glyph += player : red")
else
safe_move_toggle = true
crawl.message("safe move on", 0)
crawl.setopt("mon_glyph += player : green")
end
end
safe = you.feel_safe()
function update_safe()
local old_safe = safe
safe = you.feel_safe()
if not safe and old_safe and safe_move_toggle then
crawl.mpr("Danger!", "warning")
crawl.more()
end
end
function check_contam()
if you.contaminated() > 1 then
crawl.setopt("confirm_action += Irradiate")
else
crawl.setopt("confirm_action -= Irradiate")
end
end
function repeat_spell_warns()
-- - is a special character in Lua. If you find the creator of Lua, give them a kick from me.
if string.find(you.status(), "ce%-armoured") then
crawl.setopt("confirm_action += Ozocubu's Armour")
else
crawl.setopt("confirm_action -= Ozocubu's Armour")
end
end
function log_status()
crawl.mpr(you.status())
end
}
macros += M ` ===toggle_safe_move
########################################################
## Don't warn for allies if a toggle is on ##
########################################################
hurt_allies_toggle = False
autorefresh_needed = False
{
function toggle_hurt_allies()
if hurt_allies_toggle then
hurt_allies_toggle = false
crawl.message("hurt allies off", 0)
crawl.setopt("mon_glyph += player : red")
else
hurt_allies_toggle = true
crawl.message("hurt allies on", 0)
crawl.setopt("mon_glyph += player : green")
end
end
function c_answer_prompt(prompt)
if hurt_allies_toggle and prompt:find("Really attack your") then
crawl.mpr("here")
return true
end
if prompt:find("while wielding") then
crawl.mpr("Needed")
autorefresh_needed = true
end
end
}
macros += M 1 ===toggle_hurt_allies
########################################################
## Swap weapon to inscribed on explore/rest ##
## Also warn before resting if rest not needed ##
########################################################
{
queued_actions = {}
function swap_for_autoexplore()
local w = items.equipped_at("Weapon")
if w and string.find(w.inscription, "autoexplore") then
return nil
else
for i, j in ipairs(items.inventory()) do
if string.find(j.inscription, "autoexplore") then
return items.index_to_letter(j.slot)
end
end
return nil
end
end
function swap_for_autorest()
local w = items.equipped_at("Weapon")
if w and string.find(w.inscription, "autorest") then
return nil
else
for i, j in ipairs(items.inventory()) do
if string.find(j.inscription, "autorest") then
return items.index_to_letter(j.slot)
end
end
return nil
end
end
function autorefresh_slot()
local w = items.equipped_at("Weapon")
if w and string.find(w.inscription, "autorefresh") then
return items.index_to_letter(w.slot)
end
end
function should_rest()
if you.breath_timeout() then
return true
end
if hp_percent() ~= 100 then
return true
end
if mp_percent() ~= 100 then
return true
end
bad_statuses = {"hop", "contam", "slowed", "potion", "cooldown", "berserk", "mark", "corr", "weakened", "spewing sludge", "Wisp%-form", "weak%-willed", "silenced"}
for k, v in pairs(bad_statuses) do
if string.find(string.lower(you.status()), string.lower(v)) then
crawl.mpr("Waiting off " .. v)
return true
end
end
if you.god() == "Hepliaklqana" and you.piety_rank() > 0 then
found_ancestor = false
for x=-los,los do
for y=-los,los do
mons = monster.get_monster_at(x, y)
if mons ~= nil then
if string.find(mons:desc(true), "insubstantial memory") then
if mons:damage_level() > 0 then
crawl.mpr("Waiting for ancestor to heal")
return true
end
found_ancestor = true
end
end
end
end
if not found_ancestor then
crawl.mpr("Waiting for ancestory")
return true
end
end
if you.god() == "Yredelemnul" then
for x=-los,los do
for y=-los,los do
mons = monster.get_monster_at(x, y)
if mons ~= nil then
if string.find(mons:desc(true), "bound") then
if mons:damage_level() > 0 then
crawl.mpr("Waiting for bound soul to heal")
return true
end
end
end
end
end
end
return false
end
function custom_autoexplore()
no_explore_statuses = {"mark"}
for k, v in pairs(no_explore_statuses) do
if string.find(string.lower(you.status()), string.lower(v)) then
crawl.mpr("Not autoexploring with " .. v)
return
end
end
if not you.feel_safe() then
crawl.mpr("But you're not safe!")
return
end
if dangerous_friend then
crawl.mpr("Not exploring near that thing")
return
end
if should_rest() then
crawl.sendkeys("5")
return
end
local action = ""
local swap = swap_for_autoexplore()
if swap then
crawl.mpr("Swap")
action = "w" .. swap
crawl.sendkeys(action)
queued_actions = {"o"}
return
end
if autorefresh_needed then
crawl.mpr("refresh")
local refresh = autorefresh_slot()
if refresh then
crawl.sendkeys("w -")
queued_actions = {"w" .. refresh, "o"}
autorefresh_needed = False
return
end
end
crawl.sendkeys("o")
end
function hp_percent() a,b=you.hp() return 100*a/b end
function mp_percent()
a,b=you.mp()
if a == 0 and b == 0 then
return 100
end
return 100*a/b
end
function custom_rest()
if not you.feel_safe() then
crawl.mpr("But you're not safe!")
return
end
local swap = swap_for_autorest()
if swap then
action = "w" .. swap
crawl.sendkeys(action)
end
if not you.feel_safe() then
return
end
if autorefresh_needed then
local refresh = autorefresh_slot()
if refresh then
crawl.mpr("autorefresh")
crawl.sendkeys("w -")
if not you.feel_safe() then
return
end
crawl.sendkeys("w" .. refresh)
end
autorefresh_needed = False
end
if not should_rest() then
if crawl.yesno("Wait 100 turns?", true, 'n') then
crawl.sendkeys("5")
end
else
crawl.sendkeys("5")
end
end
function check_queue()
if next(queued_actions) == nil then
return
end
if not you.feel_safe() then
crawl.mpr('Not safe, discarding queue')
queued_actions = {}
return
end
action = table.remove(queued_actions, 1)
crawl.mpr('Executing queued action')
crawl.sendkeys(action)
end
function queue_and_do_first(actions)
if next(queued_actions) ~= nil then
crawl.mpr('Already have queued actions - confused. Clearing.')
queued_actions = {}
return
end
queued_actions = actions
check_queue()
end
function test_queue()
queue_and_do_first({"n", "n"})
end
function queue_statue()
crawl.mpr('Queue statue')
queue_and_do_first({"we", "zs", "w-"})
end
function queue_storm()
crawl.mpr('Queue storm')
queue_and_do_first({"PUI", "zb", "PIU"})
end
}
function exclude_all_hostiles()
for x=-los,los do
for y=-los,los do
mons = monster.get_monster_at(x, y)
if mons ~= nil then
if mons:attitude() == 0 and not mons:is_firewood() then
travel.set_exclude(mons:x_pos(), mons:y_pos(),los)
end
end
end
end
end
macros += M / ===queue_statue
macros += M o ===custom_autoexplore
macros += M 5 ===custom_rest
macros += M 3 ===queue_storm
macros += M 4 ===log_status
########################################################
## Alert if swapping when not safe ##
########################################################
{
function custom_armour_swap()
if not you.feel_safe() then
if crawl.yesno("Swap armour despite not safe?", true, 'n') then
crawl.sendkeys("W")
end
else crawl.sendkeys("W")
end
end
}
macros += M W ===custom_armour_swap
########################################################
## Equipment autopickup (by Medar and various others) ##
########################################################
{
local function pickup_equipment(it, name)
if it.is_useless then return end
local class = it.class(true)
if class == "armour" then
local good_slots = {cloak="Cloak", helmet="Helmet",
gloves="Gloves", boots="Boots"}
st, _ = it.subtype()
-- Autopickup found aux armour if 1) we don't have any or 2) it's artefact,
-- or 3) if we don't have artefact or ego armour, and the found armour is
-- ego.
if good_slots[st] ~= nil then
if good_slots[st] == "Gloves" and you.has_claws() > 0 then return end
if it.artefact then return true end
local cur = items.equipped_at(good_slots[st])
if cur == nil then return true end
if cur.branded or cur.artefact then return end
if it.branded then return true end
-- Autopickup found body armour of the same kind we're wearing, according
-- to conditions (2) and (3) above used for aux slots.
elseif st == "body" then
local cur = items.equipped_at("armour")
if cur == nil then return end
if cur.name("qual") ~= it.name("qual") then return end
if it.artefact then return true end
if cur.branded or cur.artefact then return end
if it.branded then return true end
end
end
return
end
add_autopickup_func(pickup_equipment)
}
###############
# Spell slots #
###############
force_targeter=true
# Set Alias for Spell Slots
slot := spell_slot
# Try to keep in alphabetic order (by keybind)
slot += Freeze:a
slot += Borgnjor's Vile Clutch:b
slot += Stone Arrow:c
slot += Call Canine Familiar:c
slot += Confuse:c
slot += Conjure Flame:c
slot += Control Undead:c
slot += Freezing Aura:c
slot += Frozen Ramparts:f
slot += Fireball:f
slot += Apportation:g
slot += Iskenderun's Battlesphere:i
slot += Summon Ice Beast:i
slot += Lee's Rapid Deconstruction:l
slot += Summon Lightning Spire:l
slot += Lightning Bolt:l
slot += Sublimation of Blood:m
slot += Iskenderun's Mystic Blast:m
slot += Mephitic Cloud:m
slot += Ozocubu's Armour:o
slot += Petrify:p
slot += Slow:s
slot += Sticky Flame:s
slot += Passwall:w
slot += Vampiric Draining:v
slot += Blink:B
slot += Death's Door:D
slot += Swiftness:S
slot += Borgnjor's Revivification:B
item_slot ^= potions? of curing:q
item_slot ^= potions? of heal wounds:l
item_slot ^= potions? of haste:h
item_slot ^= potions? of might:d
item_slot ^= potions? of agility:s
item_slot ^= potions? of resistance:n
item_slot ^= ring of poison resistance:P
item_slot ^= ring of positive energy:N
item_slot ^= ring of protection from cold:I
item_slot ^= ring of protection from fire:F
item_slot ^= ring of protection from magic:mM
item_slot ^= ring of resist corrosion:C
item_slot ^= ring of see invisible:S
item_slot ^= ring of wizardry:W
item_slot ^= scrolls? of blinking:B
item_slot ^= scrolls? of fear:g
item_slot ^= scrolls? of identify:i
item_slot ^= scrolls? of teleportation:t
item_slot ^= scrolls? of remove curse:w
item_slot ^= wand of digging:D
#####################
# Check for summons #
#####################
{
dangerous_friend = false
function summon_check()
los = you.los()
found_beast = false
ally_spell_pairs = {}
ally_spell_pairs["ice beast"]="Summon Ice Beast"
ally_spell_pairs["animated"]="Animate Armour"
ally_spell_pairs["spellforged"]="Spellforged Servitor"
ally_spell_pairs["cactus"]="Summon Cactus Giant"
ally_spell_pairs["mana"]="Mana Viper"
spell_set_pairs = {}
for k, v in pairs(ally_spell_pairs) do
spell_set_pairs[v] = false
end
dangerous_friend = false
for x=-los,los do
for y=-los,los do
mons = monster.get_monster_at(x, y)
if mons ~= nil then
if mons:attitude() == 4 then
for k, v in pairs(ally_spell_pairs) do
if string.find(mons:name(), k) == 1 then
spell_set_pairs[v] = true
end
if string.find(mons:name(), "tentacle segment") then
dangerous_friend = true
end
end
end
end
end
end
for k, v in pairs(spell_set_pairs) do
if v then
crawl.setopt("confirm_action += " .. k)
else
crawl.setopt("confirm_action -= " .. k)
end
end
if string.find(you.status(), "nimating") then
crawl.setopt("confirm_action += Animate Dead")
else
crawl.setopt("confirm_action -= Animate Dead")
end
if you.res_shock() == 0 then
crawl.setopt("confirm_action += Conjure Ball Lightning")
else
crawl.setopt("confirm_action -= Conjure Ball Lightning")
end
end
}
{
function god_based_checks()
if you.god() == "Ashenzari" then
crawl.setopt("force_more_message -= malevolen")
crawl.setopt("flash_screen_message -= malevolen")
else
crawl.setopt("force_more_message += malevolen")
crawl.setopt("flash_screen_message += malevolen")
end
end
function exclude_all_hostiles()
for x=-los,los do
for y=-los,los do
mons = monster.get_monster_at(x, y)
if mons ~= nil then
if mons:attitude() == 0 and not mons:is_firewood() then
travel.set_exclude(mons:x_pos(), mons:y_pos(),los)
end
end
end
end
end
found_throwing_net_last = false
function describe_bad_monsters()
found_throwing_net = false
for x=-los,los do
for y=-los,los do
mons = monster.get_monster_at(x, y)
if mons ~= nil then
if mons:attitude() == 0 then
if string.find(mons:desc(true), "throwing net") then
found_throwing_net = true
end
end
end
end
end
if found_throwing_net and not found_throwing_net_last then
crawl.mpr("Detected throwing nets!")
end
found_throwing_net_last= found_throwing_net
end
function feat_is_stair(feat)
return (feat:find("stone_stairs_up") or
(feat:find("exit_") and (feat == "exit_hell" or feat == "exit_vaults"
or feat == "exit_zot" or feat == "exit_slime_pits"
or feat == "exit_orcish_mines" or feat == "exit_lair"
or feat == "exit_crypt" or feat == "exit_snake_pit"
or feat == "exit_elven_halls" or feat == "exit_tomb"
or feat == "exit_swamp" or feat == "exit_shoals"
or feat == "exit_spider_nest" or feat == "exit_depths"
or feat == "exit_temple" or feat == "exit_dungeon"))
or feat == "escape_hatch_up"
or feat:find("stone_stairs_down")
or feat:find("enter_")
or feat == "escape_hatch_down")
end
function feat_is_open(feat)
local fname = feat:lower()
-- Unique substrings that identify solid features.
local solid_features = {"wall", "grate", "tree", "mangrove",
"endless_lava", "open_sea", "statue", "idol",
"malign_gateway", "sealed_door", "closed_door",
"runed_door", "explore_horizon"}
for i,p in ipairs(solid_features) do
if fname:find(p) then
return false
end
end
return true
end
function can_see(x, y)
return (x == 0 and y == 0) or view.cell_see_cell(0, 0, x, y)
end
function bog_check()
crawl.setopt("confirm_action -= Eringya's Noxious Bog")
for x=-4,4 do
for y=-4,4 do
local feat = view.feature_at(x,y)
if feat_is_stair(feat) and can_see(x, y) then
solids = 0
for dx=-1,1 do
for dy = -1,1 do
if not (feat_is_open(view.feature_at(x+dx,y+dy)) and
can_see(x+dx, y+dy)) then
solids = solids + 1
end
end
end
if solids < 2 then
crawl.setopt("confirm_action += Eringya's Noxious Bog")
end
end
end
end
end
}
macros += M ] ===exclude_all_hostiles
########################################################
## Stuff with silly message parsing ##
########################################################
{
function c_message(text, channel)
if text:find("You feel charge building up") then
crawl.setopt("confirm_action += Maxwell's Capacitive Coupling")
end
if text:find("electric haze") then
crawl.setopt("confirm_action -= Maxwell's Capacitive Coupling")
end
if text:find("condenses as gold") then
crawl.setopt("confirm_action -= Maxwell's Capacitive Coupling")
end
if text:find("without a target") then
crawl.setopt("confirm_action -= Maxwell's Capacitive Coupling")
end
if text:find("insufficient charge dissipates harmlessly") then
crawl.setopt("confirm_action -= Maxwell's Capacitive Coupling")
end
if text:find("electricity discharges through something") then
crawl.setopt("confirm_action -= Maxwell's Capacitive Coupling")
end
end
}
########################################################
## Ready. Always at the bottom. ##
########################################################
{
turn_count = 0
function ready()
if you.turns() ~= turn_count then
AnnounceDamage()
OpenSkills()
update_safe()
check_contam()
repeat_spell_warns()
check_queue()
summon_check()
god_based_checks()
describe_bad_monsters()
bog_check()
turn_count = you.turns()
end
end
}