##### Crawl Init file ###############################################
# Stop using dark blue for unseen tiles
# by telling the game that the terminal
# can render dark grey
bold_brightens_foreground = true
# Quality of life
# ===============
default_manual_training = true
auto_hide_spells = true
# Viewport
# ========
view_max_width = 60
view_max_height = 60
# Webtiles
# ========
tile_display_mode = tiles
tile_web_mouse_control = false
tile_cell_pixels = 42
# HP/MP Colors/Warnings
# ==================
hp_warning = 50
mp_warning = 50
hp_colour = 95:yellow, 75:brown, 50:magenta, 25:red
# Travel
# ======
travel_one_unsafe_move = true
travel_avoid_terrain = deep water
travel_delay = -1
explore_delay = 5
explore_wall_bias = 5
show_travel_trail = true
# Autofight / Automagic
# =====================
autofight_stop = 50
autofight_warning = 100
# Force More Messages
# ===================
show_more = false
fm := force_more_message
# Events
# fm += You riposte
# HP loss
fm += HP: \d+/\d+ \(-\d+\).*!+
# Statuses
fm += You feel strangely unstable
fm += You are (confused|paralysed|sleeping|corroded|poisoned)
# Threats
fm += You feel you are being watched by something
fm += wielding.*(distortion|chaos|electrocution|venom)
fm += quivering.*tipped darts
fm += carrying a wand
# Autoinscriptions
# ================
ai := autoinscribe
ai += potions? of curing:@q1
ai += potions? of heal wounds:@q2
ai += scrolls? of identify:@r1
ai += scrolls? of teleportation:@r2
ai += .*-tipped darts?:=f =F
ai += throwing nets?:=f =F
ai += boomerangs? of dispersal:=f =F
#---------------------------------------------------------------------------- #
# LUA #
#---------------------------------------------------------------------------- #
{
local prev_hp = nil
local prev_mp = nil
function bar(current, change, max, length)
local length = length or 12
local fraction_filled = current / max
local fraction_changed = math.abs(change / max)
local characters_filled = math.min(length, math.floor(length * fraction_filled))
local characters_changed = math.min(length, math.ceil(length * fraction_changed))
local filled = ''..string.rep('=', characters_filled)..''
local lost = ''..string.rep('-', characters_changed)..''
local rest = string.rep('-', length - characters_filled - characters_changed)
return ' '..filled..lost..rest..' '
end
function bighit(hp_loss, hp_max, fraction)
if hp_loss >= 0 then return '' end
-- Add '!' per every 10th of HP by default
multiplier = fraction and 1/fraction or 10
local fraction_changed = math.abs(hp_loss / hp_max)
local ouch = string.rep('!', math.floor(fraction_changed * multiplier))
return ouch == '' and '' or ' '..ouch
end
function announce_damage()
local hp_curr, hp_max = you.hp()
local mp_curr, mp_max = you.mp()
-- Skips message on initializing game
if prev_hp ~= nil and prev_mp ~= nil then
local hp_diff = hp_curr - prev_hp
local mp_diff = mp_curr - prev_mp
local message = nil
if hp_diff == 0 and mp_diff < 0 then
message = string.format("MP: %s/%s (%s)", mp_curr, mp_max, mp_diff)
elseif hp_diff < 0 and mp_diff == 0 then
message = string.format("HP: %s/%s (%s)", hp_curr, hp_max, hp_diff)
elseif hp_diff < 0 and mp_diff < 0 then
message = string.format("HP: %s/%s (%s)", hp_curr, hp_max, hp_diff)
message = message .. string.format(" MP: %s/%s (%s)", mp_curr, mp_max, mp_diff)
end
if message ~= nil then
if hp_diff < 0 then
-- Always warn about HP loss
message = message..bar(hp_curr, hp_diff, hp_max)
message = message..bighit(hp_diff, hp_max, 0.1)
end
local channel =
hp_curr < hp_max * 0.5 and "danger"
or hp_diff < 0 and "warning"
or "plain"
crawl.mpr(message, channel)
end
end
-- Set previous hp/mp and form at end of turn
prev_hp = hp_curr
prev_mp = mp_curr
end
-- Run every player turn
function ready()
-- Display damage taken in log
announce_damage()
end
}