# TEAMCAPTAIN Mahakala ## ## magus.rc ################################################################################################ ## ## BEGIN ################################################################################################ : rc_msg("Initializing magus.rc ...") : crawl.enable_more(false) ## ## Globals.rc ################################################################################################ # PAUSE variable for ForceMorePrompts.rc $PAUSE_MORE := PAUSE { -- Pause for AnnounceDamage.lua PAUSE_MORE = "PAUSE" -- Standard Colors (ignoring black, not visible) COLORS = { ["darkgrey"] = "darkgrey", ["lightgrey"] = "lightgrey", ["white"] = "white", ["blue"] = "blue", ["lightblue"] = "lightblue", ["green"] = "green", ["lightgreen"] = "lightgreen", ["cyan"] = "cyan", ["lightcyan"] = "lightcyan", ["red"] = "red", ["lightred"] = "lightred", ["magenta"] = "magenta", ["lightmagenta"] = "lightmagenta", ["yellow"] = "yellow", ["brown"] = "brown"} } ## ## Utils.lua ################################################################################################ { function withColor(color, str) return string.format("<%s>%s", color, str, color) end function rc_out(symbol, color, msg) crawl.mpr(string.format("%s <%s>%s", symbol, color, msg, color)) end function rc_msg(msg) rc_out("🤖", "blue", msg) end function rc_scs(msg) rc_out("✅", "green", msg) end function rc_err(msg) rc_out("❌", "lightred", msg) end function table_has(table, match) for index, value in ipairs(table) do if value == match then return true end end return false end } ## ## Lua Setup ################################################################################################ ## ## AnnounceDamage.lua ################################################################################################ { local Messages = { ["HPSimple"] = function(delta) return withColor(COLORS.white, string.format("HP[%s]", delta_color(0 - delta)) ) end, ["HPMax"] = function (color, hp, hpm, delta) crawl.mpr( withColor(COLORS.lightgreen, string.format("You now have %s max hp (%s).", hpm, delta_color(delta)) ) ) end, ["HPLoss"] = function (color, hp, hpm, loss) crawl.mpr( string.format("%s%s", withColor(COLORS.red, string.format("You take %s damage,", loss)), withColor(color, string.format(" and now have %s/%s hp.", hp, hpm)) ) ) end, ["HPGain"] = function (color, hp, hpm, gain) crawl.mpr( string.format("%s%s", withColor(COLORS.lightgreen, string.format("You regained %s hp,", gain)), withColor(color, string.format(" and now have %s/%s hp.", hp, hpm)) ) ) end, ["HPFull"] = function (color, hp) crawl.mpr( withColor(COLORS.lightgreen, string.format("Your hp is fully restored (%s).", hp) ) ) end, ["HPMassivePause"] = function () crawl.mpr( withColor(COLORS.lightred, string.format("MASSIVE DAMAGE!! (%s)", PAUSE_MORE) ) ) end, ["MPSimple"] = function(delta) return withColor(COLORS.white, string.format("MP[%s]", delta_color(0 - delta)) ) end, ["MPLoss"] = function (color, mp, mpm, loss) crawl.mpr( string.format("%s%s", withColor(COLORS.cyan, string.format("You lost %s mp,", loss)), withColor(color, string.format(" and now have %s/%s mp.", mp, mpm)) ) ) end, ["MPGain"] = function (color, mp, mpm, gain) crawl.mpr( string.format("%s%s", withColor(COLORS.cyan, string.format("You regained %s mp,", gain)), withColor(color, string.format(" and now have %s/%s mp.", mp, mpm)) ) ) end, ["MPFull"] = function (color, mp) crawl.mpr( withColor(COLORS.cyan, string.format("Your mp is fully restored (%s).", mp)) ) end, [""]=""} local prev_hp = 0 local prev_hp_max = 0 local prev_mp = 0 local prev_mp_max = 0 function delta_color(delta) local color = delta < 0 and COLORS.red or COLORS.green local signDelta = delta < 0 and delta or "+"..delta return string.format("<%s>%s", color, signDelta, color) end -- Simplified condensed HP and MP output -- Print a single condensed line showing HP & MP change -- e.g.😨 HP[-2] MP[-1] function simple_announce_damage(curr_hp, max_hp, hp_diff, mp_diff) local emoji = "" local message = nil -- MP[-1] if hp_diff == 0 and mp_diff ~= 0 then message = Messages.MPSimple(mp_diff) -- HP[-2] elseif hp_diff ~= 0 and mp_diff == 0 then message = Messages.HPSimple(hp_diff) -- HP[-2] MP[-1] elseif hp_diff ~= 0 and mp_diff ~= 0 then message = string.format("%s %s", Messages.HPSimple(hp_diff), Messages.MPSimple(mp_diff)) else -- No changes end if message ~= nil then if curr_hp <= (max_hp * 0.25) then emoji = "😱" elseif curr_hp <= (max_hp * 0.50) then emoji = "😨" elseif curr_hp <= (max_hp * 0.75) then emoji = "😮" elseif curr_hp < max_hp then emoji = "😕" else emoji = "😎" end crawl.mpr(string.format("\n%s %s", emoji, message)) end end -- Try to sync with colors defined in Interface.rc function color_by_max(message_func, curr, max, diff) if curr <= (max * 0.25) then message_func(COLORS.red, curr, max, diff) elseif curr <= (max * 0.50) then message_func(COLORS.lightred, curr, max, diff) elseif curr <= (max * 0.75) then message_func(COLORS.yellow, curr, max, diff) else message_func(COLORS.lightgrey, curr, max, diff) end end function announce_damage() -- TODO Define Colors.Red, Colors.Green, etc. -- TODO Move current/previous into array pair -- Save previous as last_hp -- Shift current into previous -- Early return if last_hp was == 0 local curr_hp, max_hp = you.hp() local curr_mp, max_mp = you.mp() --Skips message on initializing game if prev_hp > 0 then local hp_diff = prev_hp - curr_hp local max_hp_diff = max_hp - prev_hp_max local mp_diff = prev_mp - curr_mp local max_mp_diff = max_mp - prev_mp_max -- Simplified condensed HP and MP output simple_announce_damage(curr_hp, max_hp, hp_diff, mp_diff) -- HP Max if max_hp_diff > 0 then Messages.HPMax(COLORS.green, curr_hp, max_hp, max_hp_diff) elseif max_hp_diff < 0 then Messages.HPMax(COLORS.yellow, curr_hp, max_hp, max_hp_diff) end -- HP Loss -- Ensure we lost MORE than the change in max hp -- i.e. a change in max hp should not be considered damage if (hp_diff > 0 and hp_diff > math.abs(max_hp_diff)) then color_by_max(Messages.HPLoss, curr_hp, max_hp, hp_diff) if hp_diff > (max_hp * 0.20) then Messages.HPMassivePause() end end -- HP Gain -- More than 1 HP gained if (hp_diff < 0) then -- Remove the negative sign by taking absolute value local hp_gain = math.abs(hp_diff) if (hp_gain > 1) and not (curr_hp == max_hp) then color_by_max(Messages.HPGain, curr_hp, max_hp, hp_gain) end if (curr_hp == max_hp) then Messages.HPFull(nil, curr_hp) end end -- MP Gain -- More than 1 MP gained if (mp_diff < 0) then -- Remove the negative sign by taking absolute value local mp_gain = math.abs(mp_diff) if (mp_gain > 1) and not (curr_mp == max_mp) then color_by_max(Messages.MPGain, curr_mp, max_mp, mp_gain) end if (curr_mp == max_mp) then Messages.MPFull(nil, curr_mp) end end -- MP Loss -- Ensure we lost MORE than the change in max mp -- i.e. a change in max mp should not be considered loss if (mp_diff > 0 and mp_diff > math.abs(max_mp_diff)) then color_by_max(Messages.MPLoss, curr_mp, max_mp, mp_diff) end end --Set previous hp/mp and form at end of turn prev_hp = curr_hp prev_hp_max = max_hp prev_mp = curr_mp prev_mp_max = max_mp end } ## ## OpenSkills.lua ################################################################################################ { -- Open skills menu at start of runs local need_skills_opened = true local function start_open_skills() if you.turns() == 0 and need_skills_opened then need_skills_opened = false crawl.sendkeys("m") end end -- Runs once when parsed during rc init start_open_skills() } ################################################################################################ ## ## NoteVersion.lua ################################################################################################ { local didRun = false function note_version() if didRun then return end local version = "magus.rc [v1.9.6]" crawl.take_note(version) didRun = true end } ## ## TurnReady.lua ################################################################################################ { -- Run every player turn function ready() -- rc_msg("Running ready function...") -- Display damage taken in log announce_damage() note_version() end } ## ## RC Options (http://crawl.akrasiac.org/docs/options_guide.txt) ################################################################################################ ## ## Init.rc ################################################################################################ # When set to `true` or `full`, the game will pregenerate the entire # connected dungeon when starting a new character. This leads to # deterministic dungeon generation relative to a particular game seed, at # the cost of a slow game start. If set to `incremental`, the game will # generate levels as needed so that it always generates them in the same # order, also producing a deterministic dungeon. You still may encounter # variation in bazaars, the abyss, pandemonium, and ziggurats, and for # incremental pregeneration, artefacts. When set to `false` or `classic`, # the game will generate all levels on level entry, as was the rule before # 0.23. Some servers may disallow full pregeneration. # https://github.com/crawl/crawl/blob/master/crawl-ref/docs/options_guide.txt#L421 # # `incremental` produces deterministic results and `full` is not supported # by webtiles, so we set this to `incremental` here for the best result pregen_dungeon = incremental ## ## Travel.rc ################################################################################################ autofight_stop = 70 autofight_caught = true # Prevent travel from routing through deep water. # By default, this option is commented out. For merfolk and/or characters with # permanent levitation, this will prevent travel or explore from going through any water # travel_avoid_terrain = deep water # Wait until your HP and MP are both at rest_wait_percent before moving rest_wait_percent = 100 explore_auto_rest = true # Set to -1 for instant-travel, set to 1 to see travel paths travel_delay = -1 explore_delay = -1 # Adjusts how much autoexplore favours attempting to discover room perimeters and corners. # At higher values, autoexplore will more heavily favour visiting squares that are next to walls; # at 0 it will not favour them at all. explore_wall_bias = 3 # auto explore stop defaults explore_stop = stairs,shops,altars,portals,branches,runed_doors,runes explore_stop += artefacts,glowing_items,greedy_pickup_smart,greedy_visited_item_stack ## ## Interface.rc ################################################################################################ # hp and mp bar coloring view_delay = 300 hp_colour = 100:lightgreen, 99:lightgray, 75:yellow, 50:lightred, 25:red mp_colour = 100:cyan, 99:lightgray, 75:yellow, 50:lightred, 25:red hp_warning = 50 # monster colors monster_list_colour = monster_list_colour += friendly:green,neutral:brown monster_list_colour += good_neutral:brown,strict_neutral:brown monster_list_colour += trivial:darkgrey,easy:lightgrey monster_list_colour += tough:yellow,nasty:lightred # new characters start with manual skill (instead of automatic) default_manual_training = true # Unequip already equipped items by selecting in equip menus (i.e. w, W, P) equip_unequip = true # Cannot target self with risky magic allow_self_target = no # mini map size, [X] pixels per tile tile_map_pixels = 8 # Zot count status # If you spend the indicated number of turns in this branch without descending to # a new floor, Zot will find and consume you. # always_show_zot determines whether to show the "Zot" status light at all times # even when you've got plenty of time left. defaults to `false` always_show_zot = true ## ## Bindkey.rc ################################################################################################ # All commands and their key binds # https://github.com/jmbjr/dcss/blob/master/crawl-ref/docs/keybind.txt # CTRL+N will autofight without moving # bindkey = [^N] CMD_AUTOFIGHT_NOMOVE ## ## AutoInscribe.rc ################################################################################################ show_god_gift = unident ai := autoinscribe # Inscribe forbidden items for PickupEquipment ai += forbidden:forbidden ai += (bad|dangerous)_item.*potion:!q ai += (bad|dangerous)_item.*scroll:!r ai += potions? of berserk rage:!q ai += scrolls? of (blinking|immolation|magic mapping|silence|vulnerability):!r ai += of faith:!P ai += manual of:!d # Inscribe distortion weapons if you are not worshipping Lugonu : if you.god() ~= "Lugonu" then ai += distortion:!w ai += (Sonja|Psyche):!w : end # Prevent auto quivering and cycling ammo ai += (large rock|throwing net|curare|of dispersal):=f # Warn before throwing ai += (throwing net|of dispersal):!f # Convenient shortcuts ai += curing:@q1 ai += potions? of heal wounds:@q2 ai += potions? of haste:@q3 ai += scrolls? of teleportation:@r4 ai += identify:@r1 ai += remove curse:@r2 ai += chunks of flesh:@e1 # Automated inscription for sorting armor & weapons # e.g. `mace` to find any mace ai += (dagger|quick blade|short sword|rapier):short ai += (falchion|long sword|scimitar|demon blade|eudemon blade|double sword|great sword|triple sword):long ai += (hand axe|war axe|broad axe|battleaxe|executioner's axe):axe ai += (whip|club|mace|flail|morningstar|demon whip|sacred scourge|dire flail|eveningstar|great mace|giant club|giant spiked club):mace ai += (spear|trident|halberd|scythe|demon trident|trishula|glaive|bardiche):polearm ai += (staff|quarterstaff|lajatang):staff # throwing match tests (https://regexr.com/5cs44) # should match # - stone # - dart # - throwing net # - boomerang # - javelin # - large rock # - ...and plurals of all above # should not match # - dart slug # - a chunk of flesh # - moonstone # - soapstone # - a stone giant corpse ai += (dart(?! slug)|throwing net|(?javelin : end # Only Troll & Ogre pickup large rocks : if not table_has({"Ogre", "Troll"}, you.race()) then ae += >large rock : end # Jewellery : if table_has({"Gargoyle", "Vampire", "Mummy", "Ghoul"}, you.race()) then ae += >rings? of (poison resistance) : end : if table_has({"Deep Dwarf"}, you.race()) then ae += >amulets? of (regeneration) : end # Scrolls : if table_has({"Vampire", "Mummy", "Ghoul"}, you.race()) then ae += >scrolls? of (holy word) : else ae += scrolls? of (teleportation) : else ae += scrolls? of (amnesia|noise) ae += potions? of (degeneration|stabbing) # Miscellaneous ae += <(tins of tremorstones) # Pickup runes but not 'runed' anything ae += > note_items += artefact note_items += experience,of Zot,acquirement,Archmagi note_items += crystal plate,pearl dragon scales,gold dragon scales # note some auto inscribes # do not match curare note_messages += (?> 🤖 colortest <%s>%s", color, color, color)) -- end -- end -- colortest() -- rc_out("COLORS", COLORS.brown, COLORS.brown) } ## ## END ################################################################################################ : rc_scs("Successfully initialized magus.rc [v1.9.6]") : crawl.enable_more(true)