autofight_stop = 70
show_more = false
travel_delay = 8
spell_slot ^= Freeze:a
spell_slot ^= Frozen Ramparts:b
spell_slot ^= Ozocubu's Armour:c
spell_slot ^= Hailstorm:e
spell_slot ^= Blink:f
spell_slot ^= Swiftness:f
spell_slot ^= Ozocubu's Refrigeration:g
spell_slot ^= Sublimation of Blood:h
spell_slot ^= Borgnjor's Vile Clutch:h
spell_slot ^= Dragon Form:j
explore_greedy_visit = artefacts,glowing_items
travel_key_stop = true
hp_warning = 50
mp_warning = 33
{
-- 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()
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
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
-- Autopickup of stackable items
-- Doesn't work properly at the moment, oops
local function pickup_stackable(it, name)
local class = it.class(true)
local subtype = it.subtype()
local ego = it.ego(true)
if class == "miscellaneous"
and (subtype == "fan of gales"
or subtype == "lamp of fire"
or subtype == "phial of floods"
or subtype == "lightning rod"
or subtype == "crystal ball of energy") then
if it.stacks() then return false end
elseif class == "potion"
or class == "scroll"
or class == "missile"
or class == "miscellaneous" then
if it.stacks() then return true end
end
return
end
clear_autopickup_funcs()
add_autopickup_func(pickup_equipment)
add_autopickup_func(pickup_stackable)
}
# Wait until your HP and MP are both at rest_wait_percent before moving
rest_wait_percent = 100
explore_auto_rest = true
######## Function Section ########################
{
function ready()
OpenSkills()
hp_percent()
mp_percent()
AnnounceDamage()
end
}
{
function hp_percent()
a,b=you.hp() return 100*a/b
end
}
{
function mp_percent()
a,b=you.mp() return 100*a/b
end
}
{
function Petrifying_Check()
if you.petrifying() then
crawl.yesno("You are now petrifying so your action will be checked. (Y or N to confirm.)", false, false, true, true)
crawl.mpr("Consider to using tele/blink, Yara, cancellation or other emergency measures......", 5)
end
end
}
{
local need_skills_opened = true
function OpenSkills()
if you.turns() == 0 and need_skills_opened then
need_skills_opened = false
crawl.sendkeys("m")
crawl.mpr("Don't forget about skills", 3)
end
end
}
{
local early = true
function hpWarning_Early()
if you.hp() < 21 and hp_percent() < 30 and you.xl() < 9 and early then
crawl.yesno("Low HP: Be careful! (Y or N to confirm.)", false, false, true, true)
crawl.mpr("The dice are ABSOLUTELY not on your side......", 5)
early = false
end
if you.hp() > 20 and hp_percent() > 29 and you.xl() < 9 then
early = true
end
end
}
{
local mid = true
function hpWarning_Mid()
if you.hp() < 35 and you.xl() < 20 and you.xl() > 8 and mid then
crawl.yesno("Low HP: Be careful! (Y or N to confirm.)", false, false, true, true)
crawl.mpr("Consider to using tele/blink, potion or other emergency measures......", 5)
mid = false
end
if you.hp() > 34 and you.xl() < 20 and you.xl() > 8 then
mid = true
end
end
}
{
local late = true
function hpWarning_Late()
if you.hp() < 60 and you.xl() == 27 and not you.status("death's door") and not you.status("death's door (expiring)") and late then
crawl.yesno("Low HP: Be careful! (Y or N to confirm.)", false, false, true, true)
crawl.mpr("Keep playing discreetly even on late-game......", 5)
late = false
end
if you.hp() > 59 and you.xl() == 27 then
late = true
end
end
}
{
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")) then
max_hp_decreased = true
elseif (current_form:find("dragon") or
current_form:find("statue") or
current_form:find("tree") or
current_form:find("ice")) 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
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
}