#-#-# Automatically Compiled Units
#-#-# Generated from https://github.com/shacknetisp/crawl-rc
#-#-# Units Begin
#-#-# Unit: 00_nrc (header/00_nrc.lua)
: --
{
nrc = {}
}
#-#-# Unit: 01_settings (header/01_settings.lua)
: --
{
nrc.settings = {
values = {},
defaults = {},
get = function(k)
local v = nrc.settings.values[k]
if v == nil then
return nrc.settings.defaults[k]
else
return v
end
end,
set = function(k, v)
nrc.settings.values[k] = v
end,
default = function(k, v)
nrc.settings.defaults[k] = v
end,
} --
}
#-#-# Unit: 10_ready (header/10_ready.lua)
: --
{
nrc.ready_f = {}
function nrc.register_ready(f)
table.insert(nrc.ready_f, f)
end
nrc.ready_start_f = {}
function nrc.register_ready_start(f)
table.insert(nrc.ready_start_f, f)
end
local fired = false
nrc.register_ready(function()
if you.turns() == 0 and not fired then
fired = true
for _,v in ipairs(nrc.ready_start_f) do
v()
end
end
end)
}
#-#-# Unit: 20_check_version (header/20_check_version.lua)
: --
{
function nrc.check_version(a, b)
a = a or 0
b = b or 0
local ca, cb = crawl.version("major"):match("(%d*).(%d*)")
ca = tonumber(ca)
cb = tonumber(cb)
return (ca > a) or (ca == a and cb >= b)
end
}
#-#-# Unit: features (header/features.lua)
: --
{
local f = {}
nrc.features = f
-- Shortcuts.
local v = nrc.check_version
-- You are a two-state vampire.
f.you_two_state_vampire = you.race() == "Vampire" and ({alive = true, bloodless = true})[you.hunger_name()]
-- You are a blood-potion vampire.
f.you_blood_vampire = you.race() == "Vampire" and not f.you_two_state_vampire
-- You can select which skills to train.
f.you_select_skills = you.race() ~= "Gnoll"
-- You can mutate.
f.you_mutate = not ({Mummy = true, Ghoul = true})[you.race()]
-- Holy damage does not affect you.
f.you_ignore_holy = not ({Mummy = true, Ghoul = true, Vampire = true, Demonspawn = true})[you.race()]
-- Torment does not affect you.
f.you_ignore_torment = ({Mummy = true, Ghoul = true})[you.race()]
}
#-#-# Unit: world (header/world.lua)
: --
{
nrc.world = {}
function nrc.world.has_skeleton(x, y)
for _,v in ipairs(items.get_items_at(x, y) or {}) do
if v.has_skeleton then
return true
end
end
return false
end
}
#-#-# Unit: you (header/you.lua)
: --
{
nrc.you = {}
function nrc.you.starving()
return you.hunger_name() == "starving" or you.hunger_name() == "fainting"
end
function nrc.you.castable(spell, fail)
return (
-- Normally castable?
spells.memorised(spell)
and you.mp() >= spells.mana_cost(spell)
-- Penalized?
and not spells.god_hates(spell)
and spells.fail_severity(spell) <= (fail or 0)
-- Statuses.
and not you.confused()
and not you.paralysed()
and not you.berserk()
and not you.silenced()
and not nrc.you.starving()
-- Actions.
and not you.turn_is_over()
and not you.taking_stairs()
)
end
function nrc.you.cast(spell, force)
crawl.sendkeys(crawl.get_command(force and "CMD_FORCE_CAST_SPELL" or "CMD_CAST_SPELL"), spells.letter(spell))
end
}
#-#-# Unit: armor_pickup (modules/armor_pickup.lua)
: --
{
local slots = {
cloak = "Cloak",
helmet = "Helmet",
gloves = "Gloves",
boots = "Boots",
} --
add_autopickup_func(function(it, name)
if it.class(true) ~= "armour" then return nil end
if it.is_useless then return nil end
local sub = it.subtype()
if not slots[sub] then return nil end
if sub == "gloves" and you.has_claws() > 0 then return nil end
local eq = items.equipped_at(slots[sub])
return not eq
end)
}
#-#-# Unit: 10_regeneration (autocast/10_regeneration.lua)
: --
{
nrc.settings.default("regen_hp_limit", 0.9)
nrc.settings.default("regen_mp_limit", 0.5)
nrc.register_ready(function()
local hp, mhp = you.hp()
local mp, mmp = you.mp()
if not you.regenerating() and nrc.you.castable("Regeneration") and (hp < mhp * nrc.settings.get("regen_hp_limit") or you.poisoned()) and mp >= mmp * nrc.settings.get("regen_mp_limit") and you.feel_safe() then
nrc.you.cast("Regeneration")
end
end)
}
#-#-# Unit: 50_deflect_missiles (autocast/50_deflect_missiles.lua)
: --
{
nrc.settings.default("dmsl_mp_limit", 0.75)
nrc.register_ready(function()
local mp, mmp = you.mp()
if not you.status("deflect missiles") and nrc.you.castable("Deflect Missiles", 1) and mp >= mmp * nrc.settings.get("dmsl_mp_limit") and you.feel_safe() then
nrc.you.cast("Deflect Missiles")
end
end)
}
#-#-# Unit: action (butcher_override/action.lua)
: --
{
function butcher_override()
-- Animate skeleton.
if nrc.you.castable("Animate Skeleton") and nrc.world.has_skeleton(0, 0) then
nrc.you.cast("Animate Skeleton")
-- If no special option, just butcher as usual.
else
crawl.do_commands{"CMD_BUTCHER"}
end
end
}
#-#-# Unit: macro (butcher_override/macro.txt)
: --
macros += M c ===butcher_override
#-#-# Unit: call (HDamage/call.lua)
: --
{
nrc.register_ready(function() AnnounceDamage() end)
}
#-#-# Unit: HDamage.rc (HDamage/HDamage.rc.url)
: --
# From: http://crawl.berotato.org/crawl/rcfiles/crawl-git/HDamage.rc
# Ask HilariousDeathArtist to fix things
# To use this you must add have a call to AnnounceDamage() in the ready() function like below:
# This is important if you override this ready() function
<
function ready()
AnnounceDamage()
end
>
###############
# 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")) 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
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
>
#-#-# Unit: behaviour (base/behaviour.txt)
: --
default_manual_training = true
auto_butcher = true
auto_eat_chunks = true
autofight_stop = 60
equip_unequip = true
rest_wait_ancestor = true
#-#-# Unit: blood_vampires (base/blood_vampires.txt)
: --
: if nrc.features.you_blood_vampire then
item_slot += potion of blood:q
: end
#-#-# Unit: interface (base/interface.txt)
: --
hp_warning = 60
hp_colour = 70:yellow, 40:red
show_more = false
bold_brightens_foreground = true
view_max_width = 81
view_max_height = 50
travel_delay = -1
rest_delay = -1
#-#-# Unit: item_assign (base/item_assign.txt)
: --
# Slot for evocation macro 1.
item_slot += crystal ball of energy:c
ai := autoinscribe
# Super-common utilities.
ai += potions? of curing:@q1
ai += scrolls? of identify:@r1
ai += scrolls? of remove curse:@r2
ai += blowgun:@w1
ai += ( ration):@e1
# Quick switch for utility staves.
ai += staff of wizardry:@w5
ai += staff of power:@w6
ai += staff of energy:@w7
# Sometimes I run out of other ammo and start tabbing nets by accident.
ai += throwing net:!f
#-#-# Unit: item_pickup (base/item_pickup.txt)
: --
ae := autopickup_exceptions
: if nrc.features.you_mutate then
: if you.god() ~= "Zin" then
ae ^= scrolls? of holy word
: end
# You'll never need these with TROG.
: if you.god() == "Trog" then
ae += >potions? of brilliance
ae += >potions? of berserk
: end
: if you.race() == "Formicid" then
ae += >wand of digging
: end
# Magical staves can provide resistances even when you're not a caster.
ae += fast enemy.
ae += >
#-#-# Unit: spells (base/spells.txt)
: --
ss := spell_slot
ss += animate skeleton:S
ss += blink:B
ss += deflect missiles:D
ss += passwall:P
ss += regeneration:R
#-#-# Unit: lua_console (macros/lua_console.txt)
: --
bindkey = [^D] CMD_LUA_CONSOLE
#-#-# Unit: macros (macros/macros.txt)
: --
# Conventions:
# - Fn Keys: Spells (see spell_fn_macros)
# "Prayer", first god ability.
macros += M p aa
# Recap items on current level.
macros += M ] *f@\{13}
# Evocation macros.
macros += M 1 Vc
macros += M 2 Vd
#-#-# Unit: spell_fn_macros (macros/spell_fn_macros.bash)
: --
# Bind first 11 spells to function keys.
macros += M \{-1011} za
macros += M \{-1073741882} za
macros += M \{-1012} zb
macros += M \{-1073741883} zb
macros += M \{-1013} zc
macros += M \{-1073741884} zc
macros += M \{-1014} zd
macros += M \{-1073741885} zd
macros += M \{-1015} ze
macros += M \{-1073741886} ze
macros += M \{-1016} zf
macros += M \{-1073741887} zf
macros += M \{-1017} zg
macros += M \{-1073741888} zg
macros += M \{-1018} zh
macros += M \{-1073741889} zh
macros += M \{-1019} zi
macros += M \{-1073741890} zi
macros += M \{-1020} zj
macros += M \{-1073741891} zj
macros += M \{-1021} zk
macros += M \{-1073741892} zk
#-#-# Unit: skill_menu (modules/skill_menu.lua)
: --
{
-- Display skill menu on game start.
nrc.register_ready_start(function()
-- If you select your skills or have random skills.
if nrc.features.you_select_skills or you.class() == "Wanderer" then
crawl.sendkeys("m")
end
end)
}
#-#-# Unit: ready_apply (footer/ready_apply.txt)
: --
<
function ready()
for _,v in ipairs(nrc.ready_f) do
v()
end
end
>