############## # Autopickup # ############## ae := autopickup_exceptions autopickup_starting_ammo = true # autopickup = $?!:"/%}|\ # Artefacts ae += scroll.*amnesia ae += wand of random effects # ae += >wand of paralysis # ae += >wand of lightning # ae += >wand of confusion # ae += >wand of digging # ae += >wand of mindblast ae += >wand of polymorph # ae += >wand of flame # ae += >wand of charming # Evocables # ae += 2) or armourname:find("dragon") or armourname:find("troll") then return it.artefact else return it.artefact or it.branded or it.ego end end return true end if (sub_type == "shield") then if equipped_item then return it.artefact or it.branded or it.ego end end end end) } ------------------------- -- Dynamic Force Mores -- ------------------------- { safe = you.feel_safe() function update_safe() local old_safe = safe safe = you.feel_safe() if not safe and old_safe then crawl.mpr("Danger!", "warning") crawl.more() end end function ready() update_safe() end } { last_turn = you.turns() fm_patterns = { {name = "XL5", cond = "xl", cutoff = 5, pattern = "adder|gnoll"}, {name = "50mhp", cond = "mhp", cutoff = 50, pattern = "orc priest|electric eel|gnoll"}, {name = "60mhp", cond = "mhp", cutoff = 60, pattern = "acid dragon|steam dragon|manticore|ogre|centaur|killer bee|water moccasin"}, {name = "80mhp", cond = "mhp", cutoff = 80, pattern = "gargoyle|meliai|yaktaur|orc warrior|troll"}, {name = "90mhp", cond = "mhp", cutoff = 90, pattern = "efreet|molten gargoyle|tengu conjurer|orc (warlord|knight)"}, {name = "110mhp", cond = "mhp", cutoff = 110, pattern = {"centaur warrior|deep elf|cyclops|efreet|molten gargoyle", "tengu conjurer|yaktaur captain|necromancer|deep troll earth mage|boulder beetle|stone giant|ugly thing|two-headed ogre|ogre mage"}}, {name = "160mhp", cond = "mhp", cutoff = 160, pattern = {"(fire|ice|quicksilver|shadow|storm) dragon", "(fire|frost) giant", "war gargoyle","hydra","thorn hunter","minotaur","merfolk javelineer"}}, {name = "500mhp", cond = "mhp", cutoff = 500, pattern = "orb of fire|caustic shrike|curse skull|curse toe|iron giant|juggernaut|shining eye"}, } -- end fm_patterns active_fm = {} -- Set to true to get a message when the fm change notify_fm = false -- Wrapper of crawl.mpr() that prints text in white by default. if not mpr then mpr = function (msg, color) if not color then color = "white" end crawl.mpr("<" .. color .. ">" .. msg .. "") end end function init_force_mores() for i,v in ipairs(fm_patterns) do active_fm[#active_fm + 1] = false end end function update_force_mores() local activated = {} local deactivated = {} local hp, maxhp = you.hp() for i,v in ipairs(fm_patterns) do local msg = nil if type(v.pattern) == "table" then for j, p in ipairs(v.pattern) do if msg == nil then msg = p else msg = msg .. "|" .. p end end else msg = v.pattern end msg = "(" .. msg .. ").*into view" local action = nil local fm_name = v.pattern if v.name then fm_name = v.name end if not v.cond and not active_fm[i] then action = "+" elseif v.cond == "xl" then if active_fm[i] and you.xl() >= v.cutoff then action = "-" elseif not active_fm[i] and you.xl() < v.cutoff then action = "+" end elseif v.cond == "rf" then if active_fm[i] and you.res_fire() >= v.cutoff then action = "-" elseif not active_fm[i] and you.res_fire() < v.cutoff then action = "+" end elseif v.cond == "rc" then if active_fm[i] and you.res_cold() >= v.cutoff then action = "-" elseif not active_fm[i] and you.res_cold() < v.cutoff then action = "+" end elseif v.cond == "relec" then if active_fm[i] and you.res_shock() >= v.cutoff then action = "-" elseif not active_fm[i] and you.res_shock() < v.cutoff then action = "+" end elseif v.cond == "rpois" then if active_fm[i] and you.res_poison() >= v.cutoff then action = "-" elseif not active_fm[i] and you.res_poison() < v.cutoff then action = "+" end elseif v.cond == "rcorr" then if active_fm[i] and you.res_corr() then action = "-" elseif not active_fm[i] and not you.res_corr() then action = "+" end elseif v.cond == "rn" then if active_fm[i] and you.res_draining() >= v.cutoff then action = "-" elseif not active_fm[i] and you.res_draining() < v.cutoff then action = "+" end elseif v.cond == "fly" then if active_fm[i] and not you.flying() then action = "-" elseif not active_fm[i] and you.flying() then action = "+" end elseif v.cond == "mhp" then if active_fm[i] and maxhp >= v.cutoff then action = "-" elseif not active_fm[i] and maxhp < v.cutoff then action = "+" end end if action == "+" then activated[#activated + 1] = fm_name elseif action == "-" then deactivated[#deactivated + 1] = fm_name end if action ~= nil then local opt = "force_more_message " .. action .. "= " .. msg crawl.setopt(opt) active_fm[i] = not active_fm[i] end end if #activated > 0 and notify_fm then mpr("Activating force_mores: " .. table.concat(activated, ", ")) end if #deactivated > 0 and notify_fm then mpr("Deactivating force_mores: " .. table.concat(deactivated, ", ")) end end local last_turn = nil function force_mores() if last_turn ~= you.turns() then update_force_mores() last_turn = you.turns() end end init_force_mores() } ######################### # Equipement Autopickup # ######################### { local need_skills_opened = true local have_gds = false function ready() force_mores() if you.turns() == 0 and need_skills_opened then need_skills_opened = false crawl.sendkeys("m") end end local want_axe = false local want_bow = false local want_polearm = false local want_shield = true local want_body = false local function pickup_equipment(it, name) if it.is_useless then return end local class = it.class(true) local name = it.name() 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 name:find("scarf") and you.xl()<20 then return true end if cur.branded or cur.artefact then return end if it.branded then return true end elseif st == "body" and want_body then local cur = items.equipped_at("armour") if cur == nil then return end if have_gds == false and name:find("gold dragon scales") then have_gds = true return true end if you.xl() > 10 then if not it.artefact and not possible_brand(name) then return end end local aValue = cur.ac * 20 if cur.plus then aValue = aValue + cur.plus * 10 end local bValue = it.ac * 20 if it.plus then bValue = bValue + it.plus * 10 end if it.artefact then bValue = bValue + 120 end if possible_brand(name) then bValue = bValue + 20 end if bValue > aValue then return true end elseif st == "shield" and want_shield then if you.base_skill("Shields") > 14 and it.ac < 5 then return end if it.artefact then return true end local cur = items.equipped_at("Shield") if cur == nil then if you.xl()<14 then return true else return end end if it.ac >= cur.ac then if it.branded or possible_brand(name) then return true end end end elseif class == "weapon" then if it.ego() == "Distortion" then return end local cur = items.equipped_at("Weapon") if cur == nil then return end local aValue = cur.damage * 10 if cur.plus then aValue = aValue + cur.plus * 5 end if cur.hands == 2 and want_shield then aValue = aValue - 40 end if cur.ego() == "vampirism" then aValue = aValue + 75 end if cur.ego() == "flaming" or cur.ego() == "freezing" or cur.ego() == "electrocution" or cur.ego() == "chopping" then aValue = aValue + 35 end if cur.ego() == "venom" or cur.ego() == "draining" or cur.ego() == "protection" then aValue = aValue + 20 end local bValue = it.damage * 10 if it.plus then bValue = bValue + it.plus * 5 end if it.ego() == "vampirism" then bValue = bValue + 50 end if it.hands == 2 and want_shield then bValue = bValue - 40 end if it.ego() == "flaming" or it.ego() == "freezing" or it.ego() == "electrocution" or it.ego() == "chopping" then bValue = bValue + 35 end if it.ego() == "venom" or it.ego() == "draining" or it.ego() == "protection" then bValue = bValue + 20 end if it.artefact and not it.fully_identified then bValue = bValue + 100 end if possible_brand(name) then bValue = bValue + 75 end if name:find("enchant") then bValue = bValue + 15 end if it.weap_skill == "Axes" and want_axe then if you.xl() < 18 then if possible_brand(name) or it.ego() == "flaming" then return true end end if bValue > aValue then return true end elseif it.weap_skill == "Polearms" and want_polearm then if bValue > aValue then return true end elseif it.weap_skill == "Bows" and want_bow then if you.xl() < 18 then if name:find("runed") or name:find("glowing") or name:find("shiny") then return true end end local bValue = it.damage * 10 if it.plus then bValue = bValue + it.plus * 3 end if it.ego() == "flaming" or it.ego() == "freezing" then bValue = bValue + 20 end if it.artefact and not it.fully_identified then bValue = bValue + 100 end if name:find("runed") or name:find("glowing") or name:find("shiny") then bValue = bValue + 50 end if bValue > aValue then return true end end end return end add_autopickup_func(pickup_equipment) function possible_brand(name) if name:find("runed") or name:find("glowing") or name:find("dyed") or name:find("embroidered") or name:find("shiny") then return true end return end } ################## # Ready Function # ################## { local need_skills_opened = true function ready() force_mores() -- Skill menu at game start by rwbarton if you.turns() == 0 and need_skills_opened then need_skills_opened = false crawl.sendkeys("m") end end }