: if you.race() == "Mummy" and you.class() == "Monk" then < robe_of_shame = true function ready() if you.turns() == 0 and robe_of_shame then robe_of_shame = false crawl.sendkeys("Tada\r") end end > : end own #### Autopickup autopickup = $?% ae += fruit ae := autopickup_exceptions # Exceptions ae += (useless|evil)_item ae += dangerous_item.*scrolls? of (holy word|noise|torment) ae += potions? of (flight|lignification|mutation) ae += wand of (confusion|enslavement|fireball|flame|frost|lightning) ae += wand of (magic darts|paralysis|polymorph|random effects|slowing) ae += (beef jerk|pizza) : if you.race() ~= "Vampire" then ae += potions? of.*blood : end # Inclusions ae += 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 function inventory() return iter.invent_iterator:new(items.inventory()) end local function pickup_stackable(it, name) local class = it.class(true) local subtype = it.subtype() local ego = it.ego(true) if class == "potion" or class == "scroll" then for inv in inventory() do if class == inv.class(true) and subtype == inv.subtype() then return true end end elseif class == "missile" then for inv in inventory() do if class == inv.class(true) and subtype == inv.subtype() and ego == inv.ego(true) then return true end end elseif class == "miscellaneous" and (subtype == "fan of gales" or subtype == "lamp of fire" or subtype == "phial of floods" or subtype == "stone of tremors" or subtype == "disc of storms" or subtype == "lantern of shadows") then for inv in inventory() do if subtype == inv.subtype() then return false end end end return end clear_autopickup_funcs() add_autopickup_func(pickup_equipment) add_autopickup_func(pickup_stackable) } default_autopickup = true pickup_thrown = true assign_item_slot = forward pickup_menu_limit = 1 drop_filter = drop_filter += useless_item #### Travel & exploration travel_delay = -1 explore_delay = -1 rest_delay = -1 explore_greedy = true explore_stop = explore_stop += items,stairs,shops,altars,portals,runed_doors explore_stop += greedy_items,greedy_pickup_smart,greedy_visited_item_stack explore_stop += greedy_visited_item_stack,greedy_sacrificeable auto_sacrifice = before_explore travel_key_stop = true auto_exclude = auto_exclude += oklob,statue,roxanne,hyperactive,lightning spire,norris,rupert,sigmund,ogre,priest,wizard,basilisk,hydra,fire,sorceror,natasha,donald,blork,yiuf,dowan,duvessa,kirke,erolcha,grinder,gastronok,mara,maud,harold,sonja,eustachio #### Resting runrest_safe_poison = 80:100 runrest_ignore_monster = runrest_ignore_monster += ^butterfly$:1 runrest_ignore_monster += ^wandering mushroom$:1 rest_wait_both = true rest_wait_percent = 100 #### Interface & commands default_manual_training = true autopickup_starting_ammo = true auto_switch = false travel_open_doors = true easy_unequip = true equip_unequip = true jewellery_prompt = true show_uncursed = true easy_confirm = all allow_self_target = no confirm_butcher = never easy_eat_chunks = false auto_eat_chunks = true easy_quit_item_prompts = false easy_exit_menu = false ability_menu = false sort_menus = true:equipped,identified,basename,art,ego,glowing,qualname,curse,charged,slot autofight_stop = 85 autofight_throw = false autofight_throw_nomove = true autofight_fire_stop = false autofight_caught = true autofight_wait = true fail_severity_to_confirm = 3 easy_door = true #### Messages & display hp_warning = 50 mp_warning = 0 hp_colour = 100:green, 99:lightgray, 75:yellow, 50:lightred, 25:red mp_colour = 100:green, 99:lightgray, 75:yellow, 50:lightred, 25:red status_caption_colour = brown enemy_hp_colour = green green brown brown magenta red lightgrey clear_messages = false show_more = true small_more = true show_newturn_mark = true show_game_turns = true item_stack_summary_minimum = 4 msg_condense_repeats = true show_travel_trail = false skill_focus = false 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 view_delay = 300 use_animations = use_animations += beam,range,monster_in_sight cloud_status = true tile_display_mode = tiles #### Character dump & notes dump_on_save = true dump_item_origins = none dump_item_origin_price = -1 dump_message_count = 30 dump_order = header,hiscore,stats,misc,mutations,skills,spells,inventory dump_order += overview,screenshot,monlist,messages,action_counts,vaults dump_order += notes,kills dump_book_spells = true # user_note_prefix = - note_items = note_items += of Zot,experience,acquirement,running,of resistance, Archmagi note_items += crystal plate armour,dragon armour note_items += artefact,wand of (heal wounds|hasting|teleportation) note_monsters = note_monsters += orb of fire note_hp_percent = 10 note_all_skill_levels = true note_xom_effects = true note_messages = note_messages += Your scales start note_messages += You feel monstrous note_messages += protects you from harm note_messages += You (fall through|are sucked into) a shaft note_chat_messages = false note_dgl_messages = true #### Autoinscriptions ai := autoinscribe ai += (bad|dangerous)_item.*scroll:!r ai += scrolls? of silence:!r ai += manual of:!d ai += scrolls? of identify:@r1 ai += scrolls? of teleportation:@r4 !r ai += scrolls? of blinking:!r ai += large rock:Ruk #### Key bindings # Useless commands bindkey = [R] CMD_NO_CMD_DEFAULT bindkey = [T] CMD_NO_CMD_DEFAULT bindkey = [O] CMD_NO_CMD_DEFAULT # bindkey = []] CMD_NO_CMD_DEFAULT bindkey = [}] CMD_NO_CMD_DEFAULT # Macro keys bindkey = [`] CMD_NO_CMD_DEFAULT bindkey = [1] CMD_NO_CMD_DEFAULT bindkey = [2] CMD_NO_CMD_DEFAULT bindkey = [3] CMD_NO_CMD_DEFAULT bindkey = [4] CMD_NO_CMD_DEFAULT bindkey = [6] CMD_NO_CMD_DEFAULT bindkey = [7] CMD_NO_CMD_DEFAULT bindkey = [8] CMD_NO_CMD_DEFAULT bindkey = [9] CMD_NO_CMD_DEFAULT # bindkey = [0] CMD_NO_CMD_DEFAULT # Wizmode #bindkey = [&] CMD_NO_CMD_DEFAULT # Targeting bindkey = [\] CMD_TARGET_OBJ_CYCLE_FORWARD bindkey = [^I] CMD_TARGET_CYCLE_FORWARD # Saving bindkey = [S] CMD_SAVE_GAME_NOW #### Glyphs # Features display_char = wall:x2592 display_char = permawall:x2593 display_char = wall_magic:x2591 cset_unicode = item_gold:xa3 cset_unicode = cloud:# feature = (closed|runed|sealed) door {+,,} # Free glyphs: a, j, k, I, U # TODO: free up R mon := mon_glyph mon = # Uniques # TODO: recheck all of this mon += Louise:blue # Insects mon += giant cockroach:brown B mon += demonic crawler:green B mon += worker ant:red B mon += queen ant:lightgreen B mon += soldier ant:white B # Flying insects mon += queen bee:lightgreen y mon += vampire mosquito:lightgrey y # Canines mon += hog:lightred mon += hell hog:lightmagenta # Beasts mon += ice beast:ice Y mon += sky beast:mutagenic Y # Drakes mon += swamp drake:brown l mon += wind drake:white l mon += lindwurm:lightcyan l mon += death drake:lightgrey l # Gargoyles and statues mon += gargoyle:lightgrey 8 mon += war gargoyle:lightmagenta 8 mon += molten gargoyle:yellow 8 mon += spellforged servitor:magenta 8 # Weapons mon += dancing weapon:7 mon += spectral weapon:green 7 # Demonspawn mon += blood saint:9 mon += warmonger:9 mon += corrupter:9 mon += black sun:9 # Others mon += fungus:lightgrey f mon += thorn hunter:cyan f mon += boggart:magenta i mon += greater mummy:lightmagenta M mon += ancient lich:lightmagenta L mon += ancient champion:lightcyan z mon += curse skull:lightmagenta z mon += lightning spire:lightcyan { show_player_species = true #### Item colours item := item_glyph item = item += (potion|scroll|wand|jewellery):lightgrey item += spellbook:red item += wand of (heal wounds|hasting|teleportation):yellow item += scrolls? of (blinking|teleportation):yellow item += potions? of (haste|heal wounds|magic):yellow item += scrolls? of (acquirement|brand weapon|enchant|recharging):cyan item += potions? of (beneficial mutation|cure mutation|experience):cyan item += unidentified.*(potion|scroll|book|wand|jewellery):lightblue item += unidentified.*manual:white item += useless_item.*(potion|scroll):darkgrey #### Messages ignore := runrest_ignore_message ignore = stop := runrest_stop_message stop = more := force_more_message more = # TODO: recheck all of this # Annoyances ignore += You hear.*splatter ignore += You feel.*sick ignore += disappears in a puff of smoke ignore += engulfed in a cloud of smoke ignore += standing in the rain ignore += engulfed in white fluffiness ignore += You walk carefully through the ignore += The winds around you calm down. ignore += Lightning arcs down from a storm cloud ignore += (crumbles|melts) away\. ignore += (merges|forms) itself .* the air ignore += grinding sound ignore += contamination has completely ignore += chunks of flesh in your inventory.*rotted away ignore += rod.*has recharged ignore += your breath back ignore += pray: ignore += talk: ignore += talk_visual: ignore += friend_spell: ignore += friend_enchant: ignore += friend_action: ignore += sound: # Bad things stop += found.*trap stop += (blundered into a|invokes the power of) Zot stop += You fall through a shaft stop += fire darake stop += Rupert stop += Norris stop += Sigmund stop += Arachne stop += Robin stop += Ijib stop += jessica stop += Terence stop += stop += A sentinel's mark forms upon you\. stop += A huge blade swings out and slices into you stop += sense of stasis stop += flesh start stop += (starving|devoid of blood) stop += wrath finds you stop += lose consciousness # Expiring effects stop += You feel yourself slow down stop += Your hearing returns stop += Your transformation is almost over stop += back to life stop += uncertain stop += time is quickly running out stop += life is in your own hands stop += is no longer charmed stop += hell_effect: # Important features : if you.god() == "Ashenzari" then more += You have a vision of.*gates? : else more += interdimensional caravan more += distant snort more += roar of battle more += wave of frost more += hiss of flowing sand more += sound of rushing water more += heat about you more += crackle of arcane power more += Found a gateway leading out of the Abyss : end more += Found .* abyssal rune of Zot more += The mighty Pandemonium lord .* resides here # Interrupts more += You don't .* that spell more += You fail to use your ability more += You can't (read|drink|do) more += You cannot .* in your current state more += There's nothing to (close|open) nearby more += not good enough to have a special ability more += no means to grasp more += That item cannot be evoked more += You are held in a net more += You have disarmed more += You don't have any such object more += do not work when you're silenced more += You can't unwield # Bad things more += Your surroundings flicker more += sense of stasis more += You cannot teleport right now more += You fall through a shaft more += A sentinel's mark forms upon you more += (blundered into a|invokes the power of) Zot more += enter a teleport trap more += Ouch! That really hurt! more += dispelling energy hits you more += You convulse more += You are blasted by holy energy! more += You are (blasted|electrocuted)! more += You are.*(confused|poisoned) more += flesh start more += (starving|devoid of blood) more += god:(sends|finds|silent|anger) more += lose consciousness more += You are too injured to fight blindly more += calcifying dust hits more += Space warps.*around you more += Space bends around you more += hits you.*distortion more += watched by something more += flickers and vanishes! more += distortion # Hell effects more += hell_effect: # Expiring effects more += You feel yourself slow down more += Your hearing returns more += uncertain more += time is quickly running out more += life is in your own hands more += is no longer charmed more += You start to feel a little slower # Others more += You have reached level more += You have finished (your manual|forgetting about) #### Message colours $danger := lightred $warning := yellow $boring := darkgrey msc := message_colour msc = menu := menu_colour menu = # TODO: recheck all of this # Multi-turn channel.multiturn = mute # Allies msc += mute:returns to your side msc += mute:a demon appears msc += lightgrey:The deck of cards disappears msc += mute:puff of smoke msc += mute:carefully avoids msc += mute:is recalled msc += mute:wall.*burn.*your msc += mute:dissolves? into (sparkling lights|shadows) msc += mute:(crumbles|melts) away\. msc += mute:(merges|forms) itself .* the air msc += mute:you swap places msc += mute:your.*(looks stronger|shudders|resists) msc += mute:your.*(stumbles backwards|holds.*ground) # msc += mute:(something|your).*(misses|does no damage) msc += mute:your.*(blinks|safely over) msc += mute:(phases out.*|misses) (your|something).* msc += mute:your.*(picks up|drops) msc += mute:your.*basks in the mutagenic energy msc += mute:your.*(struggles|tears|pulls away).*(web|net) msc += mute:constricts?.*no damage # Other msc += mute:meld.*your body msc += mute:begins to bleed from.*wounds msc += mute:An air elemental.*itself.*the air msc += mute:You feel a.*surge of power msc += mute:You cannot train any new skill msc += mute:Moving in this stuff is going to be slow # Default colours msc += $danger:strangely unstable msc += $danger:Space warps.* around you msc += $danger:Space bends around you msc += $danger:sense of stasis msc += $danger:clumsily bash msc += $danger:goes berserk msc += $danger:The blast of calcifying dust hits you msc += $danger:You are engulfed in calcifying dust msc += $danger:is moving more slowly msc += lightgrey:Something appears (at your feet|before you) msc += $danger:^Something .* you msc += $danger:You block its attack msc += $danger:constricts you msc += $danger:you convulse msc += $danger:You feel a build-up of mutagenic energy msc += $danger:place you under penance msc += $item_dmg:acid corrodes msc += $item_dmg:catch(es)? fire msc += $item_dmg:freezes? and shatters? msc += $item_dmg:covered with spores msc += $item_dmg:devours some of your food msc += $item_dmg:rots? away msc += $warning:ticking.*clock msc += $warning:dying ticks msc += $warning:distant snort msc += $warning:odd grinding sound msc += $warning:creaking of ancient gears msc += $warning:floor suddenly vibrates msc += $warning:a sudden draft msc += $warning:coins.*counted msc += $warning:tolling.*bell msc += $warning:roar of battle msc += $warning:creaking.*portcullis msc += $warning:portcullis is probably msc += $warning:wave of frost msc += $warning:crackling.*melting msc += $warning:hiss.*sand msc += $warning:sound.*rushing water msc += $warning:rusting.*drain msc += $warning:drain falling apart msc += $warning:oppressive heat msc += $warning:rumble.*avalanche of rocks msc += $warning:crackle.*arcane power msc += $warning:crackle.*magical portal msc += $warning:fails to return msc += $warning:no longer ripe msc += $boring:You start (resting|waiting) msc += $boring:Unknown command msc += $boring:but (do no|doesn't do any) damage msc += $boring:(prevent|prevents) you from hitting # Selected items menu += inventory:white:\w \+\s menu += inventory:white:\w \#\s menu += darkgrey:(melded) menu += red:.*evil_item.* menu += lightred: cursed menu += darkgrey:.*useless_item.* menu += inventory:lightgreen:.*equipped.* menu += white:.*artefact.* menu += lightblue:^unidentified .*(potion|scroll|wand|jewellery|deck).* menu += lightblue:^unidentified .*weapon.*(runed|glowing) menu += lightblue:^unidentified .*armour.*(runed|glowing) menu += lightblue:^unidentified .*armour.*(embroidered|shiny|dyed) # Food menu += darkgrey:.*inedible.* menu += darkgrey:.*evil_eating.* menu += darkgrey:.*mutagenic.* # Default letters spell_slot += .*:yuiopYUIOP tile_player_tile =tile:mons_drowned_soul language = GRUNT # 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 > -- To use this create a macro with the following function call in game -- ===HDAtravel -- This file can be included in your rc file with the following line: -- include += HDAtravel.rc # This still has plenty of bugs, submit them at: # https://github.com/HilariousDeathArtist/DCSSConfigFile # or find me on crawl.s-z.org confirm_butcher = never easy_eat_chunks = true auto_eat_chunks = true auto_drop_chunks = yes easy_eat_contaminated = true autoinscribe += bread ration:@e1 autoinscribe += meat ration:@e2 autoinscribe += chunk:@w0 autoinscribe += staff of energy:@w1 ################## # HDAtravel # ################## -- Rests up to at least 75% hp (or missing at least 30hp) and 50% mp (or missing at least 20mp) -- Eats chunks automatically, handled by auto_eat_chunks interface option -- Travels to the nearest corpse if we have no chunks and are at Very Hungry or Hungry or using Gourmand and at Full -- Automatically chops valid corpses if we are standing on them and we have no chunks -- Will stop autotravel at Near Starving -- Channels MP if you have staff of energy or worship Sif when you have extra chunks -- Casts regen out of combat if you have spare chunks and are missing hp -- TODO: better detection of non-edible corpses before standing on them -- TODO: Fix up for Vampire, Ghoul, and possibly Spriggan/Mummy -- NOTE: If you don't have rP you will still chop poisonous corpses, but not pick up their chunks : function HDAtravel() : local mp, max_mp = you.mp() : local hp, max_hp = you.hp() : local first_monster = next(getMonsterList()) : local already_checked = (no_results() or dont_know_how_to_get_there()) : local you_are_barbed = (have_barbs() and not removed_barbs()) : local is_safe = (first_monster == nil) : local missing_mp = (mp < max_mp) : local missing_hp = (hp < max_hp) : local need_to_recover = should_rest(hp, mp, max_hp, max_mp) : local have_no_chunks = have_no_chunks() : local you_are_sif = string.find(you.god(), "Sif") : local you_are_yred = string.find(you.god(), "Yred") : local you_are_zin = string.find(you.god(), "Zin") : local you_are_good = string.find(you.god(), "Shining") or string.find(you.god(), "Elyvilon") or you_are_zin : local sacrifice_god = you_worship_sacrifice_god() : local you_are_mummy = string.find(you.race(), "Mummy") : local you_are_vampire = string.find(you.race(), "Vampire") : local you_are_bloodless = you.hunger_name() == "bloodless" : local you_are_ghoul = string.find(you.race(), "Ghoul") : local you_are_bloodless = you.hunger_name() == "bloodless" : local you_do_not_eat = string.find(you.race(), "Spriggan") or you_are_mummy : local lichform = string.find(you.transform(), "lich") : local bladehands = string.find(you.transform(), "blade") : local dragonform = string.find(you.transform(), "dragon") : local melded_weapon = (bladehands or dragonform) : local you_are_regen = you.regenerating() : local you_know_sublimation = known_spells["Sublimation of Blood"] and (spells.fail("Sublimation of Blood") < 20) and (mp>3) : local you_know_animate_skeleton = known_spells["Animate Skeleton"] and (spells.fail("Animate Skeleton") < 20) and (mp>1) : local you_know_animate_dead = known_spells["Animate Dead"] and (spells.fail("Animate Dead") < 20) and (mp>4) : local chunks_are_equipped = is_weapon("chunk") : local distort_weapon = is_weapon("distort") : local vamp_weapon = is_weapon("vamp") and not chunks_are_equipped : local have_a_weapon = weapon_in_inventory() : local gourmand_and_hungry = you_are_gourmand() and not (you_are_very_full() or you_are_engorged() or you_are_ghoul) : local ghoul_missing_hp = you_are_ghoul and ((hp < (max_hp - 5)) or you.rot() > 0) : local want_to_eat = (you_are_hungry() or gourmand_and_hungry or ghoul_missing_hp) and not you_do_not_eat : local have_spare_chunks = not have_no_chunks and not you_are_hungry() : local you_have_staff_of_energy = is_in_inventory("staff of energy") : local have_potion_of_blood = is_in_inventory("potion of blood") or is_in_inventory("potions of blood") : local staff_of_energy_is_equipped = is_weapon("staff of energy") : local staff_of_power_is_equipped = is_weapon("staff of power") : local staff_of_energy_letter = find_item_letter("staff of energy") : local chunks_letter = find_item_letter("chunk") : local you_are_hungerless = you_are_mummy or lichform : local no_food_issues = (you_are_hungerless or have_spare_chunks) : local should_channel_mp = ((max_mp - mp) > 5) and no_food_issues : local can_cast_regen = known_spells["Regeneration"] and (mp>3) and (spells.fail("Regeneration") < 20) : local you_have_regen_ring = is_in_inventory("regeneration") : local regen_ring_letter = find_item_letter("regeneration") : local regen_ring_is_equipped = is_ring("regeneration") : local should_regen_hp = (not (you_are_good or you_are_regen or lichform)) and ((hp/max_hp) < 0.80) and (you_have_regen_ring or can_cast_regen) and not you_are_bloodless : local should_sublimate = (not (you_are_good or lichform)) and ((mp/max_mp) < 0.60) and you_know_sublimation and mp>2 and ((hp/max_hp) > 0.95) : local should_animate_skeleton = (not you_are_good) and you_know_animate_skeleton and mp>1 and (not can_not_animate()) : local should_animate_dead = (not you_are_good) and you_know_animate_dead and mp>4 and (not can_not_animate()) : local you_want_spare_chunks = (not (have_spare_chunks or you_do_not_eat)) and (can_cast_regen or you_have_staff_of_energy or you_are_sif) : local you_want_chunks = (not you_are_hungerless and (number_of_chunks() == 0) and (want_to_eat or you_want_spare_chunks)) or you_are_vampire or (you_are_ghoul and number_of_chunks() < 4) : --crawl.mpr(string.format("you.piety_rank() is: %s", you.piety_rank())) : --crawl.mpr(string.format("you_want_chunks is: %s", you_want_chunks and "True" or "False")) : --crawl.mpr(string.format("want_to_eat is: %s", want_to_eat and "True" or "False")) : --crawl.mpr(string.format("number_of_chunks is: %s", number_of_chunks())) : --crawl.mpr(string.format("ghoul_missing_hp is: %s", ghoul_missing_hp and "True" or "False")) : --crawl.mpr(string.format("you.hunger_name() is: %s", you.hunger_name())) : --crawl.mpr(string.format("have_spare_chunks is: %s", have_spare_chunks and "True" or "False")) : --crawl.mpr(string.format("can_cast_regen is: %s", can_cast_regen and "True" or "False")) : --crawl.mpr(string.format("you_are_not_ghoul is: %s", you_are_not_ghoul and "True" or "False")) : --crawl.mpr(string.format("you_want_spare_chunks is: %s", you_want_spare_chunks and "True" or "False")) : --crawl.mpr(string.format("you_are_hungerless is: %s", you_are_hungerless and "True" or "False")) : --crawl.mpr(string.format("have_no_chunks is: %s", have_no_chunks and "True" or "False")) : if (is_safe) then : if you_are_barbed then : rest() : elseif should_sublimate and not (you_are_vampire or lichform) then : crawl.mpr("Autocasting Sublimation of Blood.") : sendkeys('zm') : elseif should_channel_mp and you_are_sif and (you.piety_rank() > 0) then : crawl.mpr("Autochanneling using Sif.") : sendkeys('aa') : elseif should_regen_hp and can_cast_regen then : crawl.mpr("Autocasting Regen.") : --This assumes casting regen is bound to zr : sendkeys('zr') : elseif (not melded_weapon) and (should_channel_mp and you_have_staff_of_energy and no_food_issues) and (not (distort_weapon or vamp_weapon)) and you_are_not_felid() then : if not staff_of_energy_is_equipped then : crawl.mpr("Switching to staff of energy.") : sendkeys('w1') : end : crawl.mpr("Autochanneling using staff of energy.") : sendkeys('v') : elseif (weapon_in_slot_a() or uses_unarmed()) and (no_weapon() and have_a_weapon) or (staff_of_energy_is_equipped and (not (staff_of_energy_letter == 'a')) or (chunks_are_equipped and (not (chunks_letter == 'a')))) then : if uses_unarmed() then : crawl.mpr("Switching to unarmed.") : sendkeys('w-') : else : crawl.mpr("Switching to main weapon.") : sendkeys('wa') : end : elseif want_to_eat and number_of_chunks() > 0 then : crawl.mpr("Autoeating chunks.") : sendkeys('e') : elseif you_want_chunks and on_corpses() and not on_chunks() and (not can_not_butcher()) then : if should_animate_skeleton then : crawl.mpr("Autocasting Animate Skeleton for chunks.") : sendkeys('zA') : else : crawl.mpr("Autochopping corpse.") : sendkeys('c') : end : elseif you_want_chunks and (not (you_are_zin or need_to_recover or on_chunks() or on_corpses() or already_checked)) then : crawl.mpr("You may need something to eat soon, looking for food.") : find_corpses() : elseif you_are_starving_or_near() and (number_of_chunks == 0) and (not (on_chunks() or on_corpses())) then : local have_bread = is_in_inventory("bread ration") : local have_meat = is_in_inventory("meat ration") : if have_bread or have_meat then : local result = crawl.yesnoquit("Eat a ration?", true, 'e') : if result == 1 and have_bread then : sendkeys('e1') : elseif result == 1 then : sendkeys('e2') : elseif result == 0 then : autoexplore() : end : if not (is_in_inventory("bread ration") or is_in_inventory("meat ration")) then : crawl.mpr("That was your last ration! You should go get more.") : end : else : crawl.mpr("No rations left! You should look for food.") : end : elseif need_to_recover and not you_are_starving() then : if you_are_bloodless and have_potion_of_blood then : crawl.mpr("Autoquaffing potion of blood.") : sendkeys('q1') : else : rest() : end : elseif you_are_yred and (you.piety_rank() >= 3) and (item_in_view("corpse") or item_in_view("skeleton") or on_corpses()) and not recently_mass_animated() then : crawl.mpr("Autocasting Mass Animate Remains.") : sendkeys('aa') : elseif (not sacrifice_god) and (item_in_view("corpse") or item_in_view("skeleton") or on_corpses()) and should_animate_dead and not already_animated() then : crawl.mpr("Autocasting Animate Dead.") : sendkeys('zA') : elseif (not sacrifice_god) and on_corpses() and should_animate_skeleton then : crawl.mpr("Autocasting Animate Skeleton.") : sendkeys('zA') : elseif you_are_yred and (you.piety_rank() >= 1) and on_corpses() then : crawl.mpr("Autocasting Animate Remains.") : sendkeys('aa') : else : --This does the general travelling : autoexplore() : end : else : --This will provide the "foo is nearby" message : autoexplore() : end : end < function sendkeys(command) crawl.flush_input() crawl.sendkeys(command) coroutine.yield(true) crawl.flush_input() end function should_rest(hp, mp, max_hp, max_mp) local you_are_mummy = string.find(you.race(), "Mummy") local you_are_deep_dwarf = string.find(you.race(), "Deep Dwarf") return (mp < (max_mp*0.50) or ((max_mp-mp) > 20) or ((hp < (max_hp*0.80)) or ((max_hp-hp) > 30) and not you_are_deep_dwarf) or you.slowed() or you.poisoned() or you.confused() or you.exhausted() or (((hp < max_hp) or (mp < max_mp)) and you_are_mummy)) end -- Hungry, Very Hungry, Near Starving, Starving function you_are_hungry() return not you_are_not_hungry() and ((string.find(you.hunger_name(), "hungry")) or you_are_starving_or_near()) end -- Normal Satiation function you_are_not_hungry() return (string.find(you.hunger_name(), "not hungry")) end -- Engorged function you_are_engorged() return (string.find(you.hunger_name(), "completely stuffed")) end -- Very full function you_are_very_full() return (string.find(you.hunger_name(), "very full")) end -- Near Starving function you_are_near_starving() return (string.find(you.hunger_name(), "near starving")) end -- Near Starving, Starving function you_are_starving_or_near() return (string.find(you.hunger_name(), "starving")) end -- Starving function you_are_starving() return you_are_starving_or_near() and not you_are_near_starving() end function autoexplore() sendkeys('o') end function have_barbs() return string.find(crawl.messages(10), escape("The barbed spikes become lodged in your body")) or string.find(crawl.messages(10), escape("The barbed spikes dig painfully into your body as you move")) end function already_animated() return string.find(crawl.messages(20), escape("Autocasting Animate Dead")) end function removed_barbs() return string.find(crawl.messages(10), escape("You carefully extract the manticore spikes from your body")) or string.find(crawl.messages(10), escape("The manticore spikes snap loose")) end function no_results() return string.find(crawl.messages(10), escape("Can't find anything matching that")) or string.find(crawl.messages(10), escape("You may need something to eat soon")) end function dont_know_how_to_get_there() return string.find(crawl.messages(10), escape("know how to get there")) or string.find(crawl.messages(10), escape("Have to go through")) end function can_not_animate() return string.find(crawl.messages(10), escape("There is nothing here that can be animated")) end function can_not_bottle() return string.find(crawl.messages(10), escape("There isn't anything to bottle here")) end function recently_mass_animated() return string.find(crawl.messages(10), escape("Autocasting Mass Animate Remains")) end function can_not_butcher() return string.find(crawl.messages(10), escape("anything suitable to butcher here")) or string.find(crawl.messages(10), escape("isn't edible")) end function can_not_eat_that() return string.find(crawl.messages(10), escape("You can't eat that")) --These strings don't seem to show up in messages --or string.find(crawl.messages(10), escape("Not only inedible but also greatly harmful")) --or string.find(crawl.messages(10), escape("It is caustic")) end function rest() sendkeys('5') end function you_are_gourmand() return you.gourmand() or (not you_are_not_ghoul()) or (not you_are_not_felid()) or (not you_are_not_troll()) or (string.find(you.race(), "Kobold")) end function have_no_chunks() for it in inventory() do if string.find(it.name(), "chunk") then return false end end return true end function have_rotten_chunks() for it in inventory() do if string.find(it.name(), "chunk") and string.find(it.name(), "rott") then return false end end return true end function number_of_chunks() for it in inventory() do --if string.find(it.name(), "chunk") then --crawl.mpr(it.name() .." is edible: " .. (food.can_eat(it) and "True" or "False") .. " and dangerous: " .. (food.dangerous(it) and "True" or "False")) --end if string.find(it.name(), "chunk") and (not string.find(it.name(), "book")) and food.can_eat(it) and not food.dangerous(it) then return it.quantity end end return 0 end function is_in_inventory(str) for it in inventory() do if string.find(it.name(), str) then return true end end return false end function weapon_in_inventory() for it in inventory() do if string.find(it.class(true), "weapon") then return true end end return false end function weapon_in_slot_a() local it = items.inslot(0) if it then return string.find(it.class(true), "weapon") else return false end end function find_item_letter(str) for i = 0,51 do it = items.inslot(i) if it then if string.find(it.name(), str) then return items.index_to_letter(i) end end end return false end function you_worship_sacrifice_god() return string.find(you.god(), "Trog") --or string.find(you.god(), "Oka") --or string.find(you.god(), "Makhleb") or string.find(you.god(), "Beogh") or string.find(you.god(), "Lugonu") --or string.find(you.god(), "Nemelex") end function on_corpses() local fl = you.floor_items() for it in iter.invent_iterator:new(fl) do if string.find(it.name(), "corpse") and not string.find(it.name(), "rotting") and not string.find(it.name(), "plague") then return true end end return false end function on_chunks() for it in floor_items() do if string.find(it.name(), "chunk") then return true else return false end end end function you_are_carnivore() return you.saprovorous() end function you_are_not_ghoul() return not (string.find(you.race(), "Ghoul")) end function you_are_not_troll() return not (string.find(you.race(), "Troll")) end function you_are_not_felid() return not (string.find(you.race(), "Felid")) end function you_are_not_octopode() return not (string.find(you.race(), "Octopode")) end function find_corpses() local race = you.race() local god = you.god() local exclude_this = "" if string.find(god, "Shining") then exlude_this = race end sendkeys(string.char(6) .. "@corpse&&!!rott&&!!skel&&!!sky&&!!necrop&&!!ugly&&!!vampire&&!!corpse rot&&!!&&!!botono" .. exclude_this .. "\ra\r") end function inventory() return iter.invent_iterator:new(items.inventory()) end function floor_items() return iter.invent_iterator:new(you.floor_items()) end function no_weapon() return (items.equipped_at("Weapon") == nil) and not uses_unarmed() end function uses_unarmed() return not you_are_not_ghoul() or not you_are_not_troll() or not you_are_not_felid() or (you.skill("Unarmed Combat") >= 3) end function is_weapon(str) local weapon = items.equipped_at("Weapon") if weapon then return string.find(weapon.name(), str) else return false end end function is_ring(str) local ring1 = items.equipped_at("Left Ring") local ring2 = items.equipped_at("Right Ring") if ring1 and ring2 then return string.find(ring1.name(), str) or string.find(ring2.name(), str) elseif ring1 then return string.find(ring1.name(), str) elseif ring2 then return string.find(ring2.name(), str) else return false end end function item_in_view(str) local x,y for x = -8,8 do for y = -8,8 do if not (x == 0 and y == 0) then local pile = items.get_items_at(x,y) if pile ~= nil then for it in iter.invent_iterator:new(pile) do if string.find(it.name(), str) and you.see_cell_no_trans(x,y) then return true end end end end end end return false end -- Returns a table where the key is the monster description and value is the total number of that mob in your vision function getMonsterList() local monsters = {} for x = -7,7 do for y = -7,7 do m = monster.get_monster_at(x, y) local attitude_hostile = 0 if m and (m:attitude() == attitude_hostile) and not (m:is_firewood()) then desc = m:desc() if (monsters[desc] == nil) then monsters[desc] = 1 else monsters[desc] = monsters[desc] + 1 end end end end return monsters end --Escapes the special characters in a string for pattern matching function escape(str) --Escapes parens and dash "()-" local escaped = str:gsub('[%(%)%-]','%\%1') --Removes any coloration parts of the string return (escaped:gsub('<[^<]*>','')) end local function init_spells() local spell_list = {} for _, spell_name in ipairs(you.spells()) do spell_list[spell_name] = true end return spell_list end known_spells = init_spells() >