Advertisement
Guest User

Untitled

a guest
May 25th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.50 KB | None | 0 0
  1. include += HDAColors.rc
  2. include += HDamage.rc
  3. include += HDAForceMore.rc
  4. {
  5.  
  6. reminded_mindelay = {}
  7.  
  8. function ready()
  9. crawl.enable_more(true)
  10. UpdateKnowledge()
  11. newmessages = crawl.messages(50)
  12.  
  13. if newmessages:find("finish memorising") or newmessages:find("unravels") then
  14. known_spells = init_spells()
  15. end
  16. known_abils = init_abils()
  17.  
  18. if you.skill(weapon_skill) >= weapon_target_skill and reminded_mindelay[weapon_type] ~= true and you.train_skill(weapon_skill) == 1 then
  19. crawl.mpr("Your wielded weapon is at mindelay!")
  20. crawl.more()
  21. sendkeys('m')
  22. reminded_mindelay[weapon_type] = true
  23. end
  24.  
  25. check_safe_invisible(newmessages)
  26. safe_from_oos = true
  27. --check_safe_oos(newmessages)
  28. AnnounceDamage()
  29.  
  30. if hp <= max_hp * 0.25 and not warning_25 and not waiting_to_autoexplore then
  31. crawl.mpr(string.format("<lightred>HP at %i%%!</lightred>",hp / max_hp * 100))
  32. crawl.more()
  33. warning_25 = true
  34. warning_50 = true
  35. elseif hp <= max_hp * 0.5 and not warning_50 and not waiting_to_autoexplore then
  36. crawl.mpr(string.format("<red>HP at %i%%!</red>",hp / max_hp * 100))
  37. crawl.more()
  38. warning_50 = true
  39. end
  40.  
  41. if hp > max_hp * 0.25 then warning_25 = false end
  42. if hp > max_hp * 0.5 then warning_50 = false end
  43.  
  44. local casted_permanent_spells = false
  45. if options.autopick_on and you_safe then
  46. Autobutcher()
  47. casted_permanent_spells = PermanentSpells()
  48. end
  49.  
  50. OpenSkills()
  51. if not casted_permanent_spells then FinishResting() end
  52.  
  53. if pillardancing and next_move == nil then Pillardance() end
  54. end
  55.  
  56. function permanent_vars()
  57. vars = ""
  58. vars = vars .. stringify_var("safe_from_invisible",safe_from_invisible)
  59. vars = vars .. stringify_var("desired_thirst",desired_thirst)
  60. return vars
  61. end
  62.  
  63. table.insert(chk_lua_save, permanent_vars)
  64.  
  65. --#############
  66. --# Debugging #
  67. --#############
  68.  
  69.  
  70. function DebugOutput()
  71. debug("you_turns")
  72. debug("you.status()")
  73. debug('you_status')
  74. debug("you.god()")
  75.  
  76. debug("you_are_safe()")
  77. debug("safe_from_invisible")
  78. debug("safe_from_oos")
  79. debug("options.autopick_on")
  80. debug("autopickup_off_because")
  81.  
  82. debug("stringify_array(missiles_have)")
  83. debug("stringify_array(equipped_at)")
  84.  
  85. debug("have_chunks")
  86. debug("you_like_chunks")
  87. debug("you_hunger")
  88.  
  89. debug("you_rot")
  90. debug("you_should_rest")
  91. debug("stringify_array(you_debuffs)")
  92. debug("you_debuffed")
  93. debug("stringify_array(you_buffs)")
  94. debug("you_buffed")
  95.  
  96. debug("see_corpses()")
  97. debug("over_corpses()")
  98. debug("see_skeletons()")
  99. debug("over_skeletons()")
  100.  
  101. debug("stringify_array(you_spells)")
  102. debug("stringify_array(known_spells)")
  103. debug("stringify_array(known_abils)")
  104.  
  105. debug("weapon_type")
  106. debug("weapon_target_skill")
  107. debug("weapon_skill")
  108. end
  109.  
  110. --######################
  111. --# Calculate Artprops #
  112. --######################
  113.  
  114. function CalculateArtprops()
  115. local attr = { Str = 0, Dex = 0, Int = 0, HP = 0, MP = 0, Slay = 0, EV = 0, AC = 0 }
  116. local pluses = { rF = 0, rC = 0, Stlth = 0, rN = 0, MR = 0 }
  117. local actions = { Blink = 0, Inv = 0, Fly = 0 }
  118. local intr = { rMut = 0, rPois = 0, rElec = 0, SInv = 0, rCorr = 0, Regen = 0, Clar = 0, Ward = 0, Spirit = 0 }
  119. local ignore = { Contam = 0, channel = 0 }
  120. for it in inventory() do
  121. if it.equipped then
  122. local name = it.name()
  123. if name:find("{") then
  124. if it.class(true) == "weapon" then
  125. name = name:gsub(".*,","")
  126. name = name:gsub("}.*","")
  127. else
  128. name = name:gsub(".*{","")
  129. name = name:gsub("[},].*","")
  130. end
  131. for prop in name:gmatch("%S+") do
  132. propname = prop:gsub("%A","")
  133. if attr[propname] ~= nil then
  134. if prop ~= "+MP" then
  135. local count = tonumber(prop:gsub("%D",""),10)
  136. if prop:find("%+") then
  137. attr[propname] = attr[propname] + count
  138. elseif prop:find("%-") then
  139. attr[propname] = attr[propname] - count
  140. end
  141. end
  142. elseif pluses[propname] ~= nil then
  143. local count = prop:gsub("%a","")
  144. if count:find("%+") then count = count:len()
  145. elseif count:find("%-") then count = count:len() *-1
  146. end
  147. pluses[propname] = pluses[propname] + count
  148. elseif actions[propname] ~= nil then
  149. actions[propname] = actions[propname] + 1
  150. elseif intr[propname] ~= nil then
  151. intr[propname] = intr[propname] + 1
  152. elseif ignore[propname] == nil then
  153. crawl.mpr(string.format("What is %s?",prop))
  154. end
  155. end
  156. end
  157. end
  158. end
  159. local arrs = { ["Attributes: "] = attr, ["Pluses: "] = pluses, ["Actions: "] = actions, ["Intrinsics: "] = intr }
  160. for name,arr in pairs(arrs) do
  161. local outstr = name
  162. for stat,val in pairs(arr) do
  163. outstr = outstr .. stat .. ": " .. tostring(val) .. ", "
  164. end
  165. crawl.mpr(string.format("%s",outstr:gsub(", $","")))
  166. end
  167. end
  168.  
  169.  
  170. --######################################
  171. --# Inventory Knowledge for Autothings #
  172. --######################################
  173.  
  174. have_knowledge = false
  175. autopickup_slots = {cloak=true, helmet=true, gloves=true, boots=true}
  176.  
  177. equipment_slots = {cloak="Cloak", helmet="Helmet", gloves="Gloves", boots="Boots", body="Armour", shield="Shield", weapon="Weapon"}
  178.  
  179. itemcount = 0
  180. have_chunks = false
  181. have_blood = false
  182. equipped_at = {cloak=nil, helmet=nil, gloves=nil, boots=nil, armour=nil, shield=nil, weapon=nil}
  183. missiles_have = {}
  184.  
  185. have_poison_resistance = false
  186.  
  187. you_race = you.race()
  188. you_like_chunks = you_race ~= "Mummy" and you_race ~= "Spriggan" and you_race ~= "Vampire"
  189. you_like_blood = you_race == "Vampire"
  190.  
  191. buffs = { ["lich"]=true, ["regenerating"]=true, ["deflect missiles"]=true, ["repel missiles"]=true, ["delayed fireball"]=true, ["bat-form"]=true }
  192. debuffs = { ["vulnerable"]=true, ["confused"]=true, ["corona"]=true, ["exhausted"]=true, ["petrifying"]=true, ["silence"]=true, ["marked"]=true, ["barbs"]=true, ["corroded"]=true, ["slowed"]=true, ["corroded equipment"]=true }
  193.  
  194. function UpdateKnowledge()
  195.  
  196.  
  197. hp,max_hp = you.hp()
  198. mp,max_mp = you.mp()
  199.  
  200. you_time = you.time()
  201. you_turns = you.turns()
  202. you_god = you.god()
  203.  
  204. you_hunger = you.hunger()
  205. you_starving = (you_hunger == 0 and you_race ~= "Vampire")
  206. you_gourmand = you_are_gourmand()
  207. you_poisoned = you.poisoned()
  208.  
  209. you_berserk = you.berserk()
  210. you_rot = you.rot()
  211.  
  212. have_poison_resistance = you.res_poison()
  213.  
  214. you_status = {}
  215. you_debuffs = {}
  216. you_buffs = {}
  217. you_debuffed = false
  218. you_buffed = false
  219. for status in string.gmatch(you.status(), "[^,]+") do
  220. you_status[status] = true
  221. if debuffs[status] then
  222. you_debuffs[status] = true
  223. you_debuffed = true
  224. elseif buffs[status] then
  225. you_buffs[status] = true
  226. you_buffed = true
  227. end
  228. end
  229.  
  230. you_safe = you_are_safe()
  231. you_can_cast = can_cast_spells()
  232.  
  233. you_spells = {}
  234. if you_can_cast then
  235. for spell,_ in pairs(known_spells) do you_spells[spell] = can_cast(spell) and spells.level(spell) or false end
  236. end
  237.  
  238. if you_like_chunks then have_chunks = have_edible_chunks()
  239. elseif you_like_blood then have_blood = have_blood_potions() end
  240.  
  241. local oldweapon = equipped_at["weapon"]
  242. for name,slot in pairs(equipment_slots) do
  243. equipped_at[name] = items.equipped_at(slot)
  244. end
  245. if equipped_at["weapon"] ~= oldweapon or weapon_target_skill == 0 then check_new_weapon() end
  246.  
  247. itemcount = 0
  248. missiles_have = {["bolt"]={},["arrow"]={},["sling bullet"]={},["needle"]={},["stone"]={},["large rock"]={},["throwing net"]={},["tomahawk"]={},["javelin"]={}}
  249. for it in inventory() do
  250. if it.class(true) == "missile" then
  251. missiles_have[it.subtype(true)][tostring(it.ego(true))] = true
  252. end
  253. itemcount = itemcount + 1
  254. end
  255.  
  256. you_should_rest = should_rest()
  257. have_knowledge = true
  258. end
  259.  
  260. --####################
  261. --# Custom Autpickup #
  262. --####################
  263.  
  264. local strfind = string.find
  265. add_autopickup_func(function(it, name)
  266. if not have_knowledge then return nil end
  267.  
  268. local class = it.class(true)
  269.  
  270. if class == "missile" then
  271. return missiles_have[it.subtype(true)][tostring(it.ego(true))] ~= nil
  272. end
  273.  
  274. if class == "food" then
  275.  
  276. if it.is_useless then return false end
  277.  
  278. if strfind(name,"chunk") then
  279. if itemcount < 52 or have_chunks then return true else return false end
  280. else
  281. return nil
  282. end
  283.  
  284. end
  285.  
  286. if class == "armour" then
  287.  
  288. if it.is_useless then return false end
  289.  
  290. local sub_type = it.subtype()
  291.  
  292. if autopickup_slots[sub_type] then
  293. if not equipped_at[sub_type] then
  294. return true
  295. else
  296. return (it.artefact or it.branded or it.ego)
  297. end
  298. end
  299. end
  300. end)
  301.  
  302. --###############
  303. --# Autobutcher #
  304. --###############
  305.  
  306. look_again = false
  307. last_butchered = nil
  308.  
  309. function Autobutcher()
  310. if not you_like_chunks and not you_like_blood then return false end
  311. local oec = over_edible_corpse()
  312. local oeh = over_edible_chunk()
  313. local cec = can_eat_chunks()
  314. local wnc = want_new_chunks_or_blood()
  315. if you_like_chunks and cec and ( oeh or have_chunks ) then
  316. sendkeys("e")
  317. look_again = true
  318. elseif you_like_blood and cec and have_blood then
  319. sendkeys("q1")
  320. look_again = true
  321. elseif oec and ( cec or ( itemcount < 52 and wnc ) ) then
  322. sendkeys("c")
  323. last_butchered = you_time
  324. look_again = true
  325. elseif look_again then
  326. local itemlist = ""
  327. for it in floor_items() do itemlist = itemlist .. it.name_coloured() .. ", " end
  328. if itemlist ~= "" then
  329. crawl.mpr(string.format("Items here: %s",itemlist:sub(1,-3)))
  330. end
  331. look_again = false
  332. end
  333. end
  334.  
  335. function want_new_chunks_or_blood()
  336. if you_like_chunks then
  337. return not have_chunks or last_butchered==nil or you_time >= last_butchered + 1000
  338. elseif you_like_blood then
  339. return not have_blood or last_butchered==nil or you_time >= last_butchered + 2000
  340. end
  341. end
  342.  
  343. function can_eat_chunks()
  344. if you_like_blood then
  345. return you_hunger < desired_thirst and not you_buffs["bat-form"]
  346. end
  347. if you_race=="Ghoul" then
  348. return you_hunger<4 or you_rot>0 or hp<max_hp
  349. end
  350. if you_gourmand then
  351. return you_hunger<7
  352. end
  353. return you_hunger<4
  354. end
  355.  
  356. function edible_corpse(item)
  357. if food.dangerous(item) or item.is_useless then return false end
  358. return item.name():find("corpse")
  359. end
  360.  
  361. function edible_chunk(item)
  362. if food.dangerous(item) or item.is_useless then return false end
  363. return food.ischunk(item)
  364. end
  365.  
  366. function over_edible_corpse()
  367. for item_under_you in floor_items() do
  368. if edible_corpse(item_under_you) then return true end
  369. end
  370. return false
  371. end
  372.  
  373. function over_edible_chunk()
  374. for item_under_you in floor_items() do
  375. if edible_chunk(item_under_you) then return true end
  376. end
  377. return false
  378. end
  379.  
  380. function have_blood_potions()
  381. for it in inventory() do
  382. if it.name():find("blood") then return true end
  383. end
  384. return false
  385. end
  386.  
  387. function have_edible_chunks()
  388. for it in inventory() do
  389. if edible_chunk(it) then return true end
  390. end
  391. return false
  392. end
  393.  
  394. desired_thirst = 4
  395. thirst_levels = {[0]="Bloodless",[1]="Near Bloodless",[2]="Very Thirsty",[3]="Thirsty",[4]="Satiated",[5]="Full",[6]="Alive"}
  396. function IncreaseDesiredThirst()
  397. if desired_thirst > 0 then desired_thirst = desired_thirst - 1 end
  398. crawl.mpr(string.format("Desired thirst level set to %s",thirst_levels[desired_thirst]))
  399. end
  400. function DecreaseDesiredThirst()
  401. if desired_thirst < 6 then desired_thirst = desired_thirst + 1 end
  402. crawl.mpr(string.format("Desired thirst level set to %s",thirst_levels[desired_thirst]))
  403. end
  404.  
  405. --#############################
  406. --# Autocast permanent spells #
  407. --#############################
  408.  
  409. function can_cast_spells()
  410. return you_safe and not you_berserk and not you_debuffs["silence"] and not you_debuffs["confused"] and not you_starving
  411. end
  412.  
  413. function can_cast(spell)
  414. if you_can_cast and known_spells[spell] and spells.fail_severity(spell) < 2 and mp >= spells.level(spell) and hp >= max_hp * 0.5 then return true else return false end
  415. end
  416.  
  417. function PermanentSpells()
  418. if you_can_cast then
  419. if not you_buffs["deflect missiles"] and you_spells["Deflect Missiles"] then
  420. cast("Deflect Missiles")
  421. return true
  422. elseif not you_buffs["deflect missiles"] and not you_buffs["repel missiles"] and you_spells["Repel Missiles"] then
  423. cast("Repel Missiles")
  424. return true
  425. end
  426.  
  427. if not you_buffs["delayed fireball"] and you_spells["Delayed Fireball"] then
  428. cast("Delayed Fireball")
  429. return true
  430. end
  431. end
  432.  
  433. return false
  434. end
  435.  
  436. --##############################
  437. --# Rest up before autoexplore #
  438. --##############################
  439.  
  440. function FinishRestingThenAutoexplore()
  441. waiting_to_autoexplore = true
  442. but_dont_autoexplore = false
  443. end
  444.  
  445. function TriggerFinishResting()
  446. waiting_to_autoexplore = true
  447. but_dont_autoexplore = true
  448. end
  449.  
  450. waiting_to_autoexplore = false
  451. but_dont_autoexplore = false
  452. time_start_wait = 0
  453. autoswitched_to_staff_of_energy = false
  454. tried_spells = {}
  455. autospent_mp = 0
  456.  
  457. function over_corpses()
  458. it = is_at(0,0,{"corpse"})
  459. if it ~= false and it.can_zombify then return true else return false end
  460. end
  461.  
  462. function see_remains()
  463. local x,y
  464. for x=-losrange,losrange do for y=-losrange,losrange do
  465. it = is_at(x,y,{"corpse","skeleton"})
  466. if it ~= false then if it.can_zombify or it.has_skeleton then return true end end
  467. end end
  468. return false
  469. end
  470.  
  471. function try_spell(what)
  472. cast(what)
  473. autospent_mp = autospent_mp + you_spells[what]
  474. tried_spells[what] = true
  475. return true
  476. end
  477.  
  478. function reset_resting()
  479. --p('reset resting')
  480. tried_spells = {}
  481. you_see_corpses = nil
  482. you_on_corpses = nil
  483. waiting_to_autoexplore = false
  484. time_start_wait = 0
  485. autospent_mp = 0
  486. end
  487.  
  488. function FinishResting()
  489.  
  490. if waiting_to_autoexplore and not PermanentSpells() then
  491.  
  492. if time_start_wait == 0 then time_start_wait = you_time end
  493.  
  494. if you_safe and not you_starving then
  495. crawl.enable_more(false)
  496.  
  497. if you_can_cast then
  498.  
  499. if you_spells["Simulacrum"] and not tried_spells["Simulacrum"] then
  500. if you_on_corpses == nil then you_on_corpses = over_corpses() end
  501. if you_on_corpses and try_spell("Simulacrum") then
  502. you_on_corpses = false
  503. you_see_corpses = see_remains()
  504. return true
  505. end
  506. end
  507.  
  508. if you_spells["Animate Dead"] or known_abils["Animate Dead"] then
  509. if you_see_corpses == nil then you_see_corpses = see_remains() end
  510. if you_see_corpses and not tried_spells["Animate Dead"] and known_abils["Animate Dead"] then
  511. abil("Animate Dead")
  512. tried_spells["Animate Dead"] = true
  513. you_see_corpses = false
  514. return true
  515. elseif you_see_corpses and not tried_spells["Animate Dead"] then
  516. if try_spell("Animate Dead") then
  517. you_see_corpses = false
  518. return true
  519. end
  520. end
  521. end
  522.  
  523. if not you_buffs["lich"] and you_spells["Sublimation of Blood"] and mp < max_mp and ((max_mp-mp)*3 <= 0.5*hp) then
  524. cast("Sublimation of Blood")
  525. return true
  526. elseif not you_buffs["lich"] and you_spells["Regeneration"] and hp < max_hp and not you_buffs["regenerating"] then
  527. cast("Regeneration")
  528. return true
  529. end
  530.  
  531. end
  532.  
  533. if is_equipped("weapon","staff of energy") and mp < max_mp and (have_chunks or not you_like_chunks) then
  534. sendkeys("v")
  535. elseif is_alternative_weapon("staff of energy") and mp < max_mp and (have_chunks or not you_like_chunks) then
  536. sendkeys("'")
  537. autoswitched_to_staff_of_energy = true
  538. elseif (you_should_rest and you_god ~= "Jiyva") or (you_should_rest and you_god == "Jiyva" and but_dont_autoexplore) then
  539. rest()
  540. else
  541. if you_time - time_start_wait > 10 then
  542. crawl.mpr(string.format("Total turns waited: %s",(you_time - time_start_wait)/10))
  543. elseif but_dont_autoexplore then
  544. crawl.mpr("No need to wait!")
  545. end
  546. reset_resting()
  547. if not is_equipped("weapon","staff of energy") then
  548. autoswitched_to_staff_of_energy = false
  549. end
  550. if autoswitched_to_staff_of_energy then
  551. sendkeys("'")
  552. autoswitched_to_staff_of_energy = false
  553. return true
  554. end
  555. if not but_dont_autoexplore then
  556. crawl.enable_more(true)
  557. autoexplore()
  558. else
  559. but_dont_autoexplore = false
  560. end
  561. end
  562. else
  563. if you_time - time_start_wait > 10 then
  564. crawl.mpr(string.format("Total turns waited: %s",(you_time - time_start_wait)/10))
  565. else
  566. reason = you_are_safe_reason()
  567. if reason == "unsafe" then
  568. crawl.mpr("There are dangers nearby!")
  569. elseif reason == "oos" then
  570. crawl.mpr("Monsters outside your LoS are attacking your minions!")
  571. elseif reason == "invis" then
  572. crawl.mpr("There are invisible monsters nearby!")
  573. elseif reason == "pois" then
  574. crawl.mpr("The poison in your blood would kill you!")
  575. elseif reason == "pillar" then
  576. crawl.mpr("You are pillardancing!")
  577. elseif you_starving then
  578. crawl.mpr("Starvation!")
  579. elseif you_berserk then
  580. crawl.mpr("You are berserking!")
  581. end
  582. end
  583. reset_resting()
  584. end
  585. end
  586. end
  587.  
  588.  
  589. --#################
  590. --# Pillardancing #
  591. --#################
  592.  
  593. losrange = 7
  594. fielddim = losrange*2
  595.  
  596. pillar_fov = {}
  597. pillar_fov_clear = {}
  598.  
  599. pillardancing = false
  600.  
  601. dance_direction = nil
  602. dance_direction_num = nil
  603. next_move = nil
  604. pillar_center = {nil,nil}
  605. walk_path = {[-1]={},[1]={}}
  606.  
  607. order_diag = { {-1,-1}, {0,-1}, {1,-1}, {1,0}, {1,1}, {0,1}, {-1,1}, {-1,0} }
  608. order_adja = { {-1,0}, {0,1}, {1,0}, {0,-1} }
  609. order_tendril = { {1,0}, {0,1}, {1,1}, {1,-1} }
  610. moves_diag = { "y", "h", "b", "j", "n", "l", "u", "k" }
  611.  
  612. pseudomonsters = { ["fungus"]=true, ["plant"]=true }
  613.  
  614. function rotate_forward(what) table.insert(what,#what,table.remove(what,1)) end
  615. function rotate_backward(what) table.insert(what,1,table.remove(what,#what)) end
  616. function contains(t,what)
  617. for _,f in pairs(t) do if f ~= nil and f == what then return true end end
  618. return false
  619. end
  620.  
  621. function pv(v) return type(v) == "table" and "("..tostring(v[1])..","..tostring(v[2])..")" or tostring(v) end
  622. function vector_out_of_bounds(v,range) return math.abs(v[1]) > range or math.abs(v[2]) > range end
  623. function tile_at_vector(v) return pillar_fov[v[1]][v[2]] end
  624. function set_tile_at_vector(v,t) pillar_fov[v[1]][v[2]] = t end
  625. function feature_at_vector(v) return view.feature_at(v[2],v[1]) end
  626. function monster_at_vector(v) return monster.get_monster_at(v[2],v[1]) end
  627. function exclude_at_vector(v) travel.set_exclude(v[2],v[1],0) end
  628. function unexclude_at_vector(v) travel.del_exclude(v[2],v[1]) end
  629.  
  630. function vector_field_iterator_from_table(t)
  631. return coroutine.wrap(function ()
  632. for _,v in pairs(t) do coroutine.yield(v) end
  633. end)
  634. end
  635. function vector_field_iterator_from_box(ybound,xbound)
  636. return coroutine.wrap(function ()
  637. for y=ybound[1],ybound[2] do for x=xbound[1],xbound[2] do coroutine.yield({y,x}) end end
  638. end)
  639. end
  640. function los_vectorfield() return vector_field_iterator_from_box({-losrange,losrange},{-losrange,losrange}) end
  641. function field_vectorfield() return vector_field_iterator_from_box({-fielddim,fielddim},{-fielddim,fielddim}) end
  642. function vector_field_offset(vector_field_iterator,offset)
  643. return coroutine.wrap(function ()
  644. for v in vector_field_iterator do coroutine.yield(vector_add(v,offset)) end
  645. end)
  646. end
  647. function vector_equal(v1,v2) return v1[1] == v2[1] and v1[2] == v2[2] end
  648. function vector_copy(v) return {v[1],v[2]} end
  649. function vector_field_copy(vf,size)
  650. vfn = {}
  651. for y=-size,size do for x=-size,size do
  652. if vfn[y] == nil then vfn[y] = {} end
  653. vfn[y][x] = vf[y][x]
  654. end end
  655. return vfn
  656. end
  657. function vector_neg(v) return {-v[1],-v[2]} end
  658. function vector_add(v1,v2) return {v1[1]+v2[1],v1[2]+v2[2]} end
  659. function vector_sub(v1,v2) return {v1[1]-v2[1],v1[2]-v2[2]} end
  660. function vector_redir(v,dir) return {v[1]*dir[1],v[2]*dir[2]} end
  661. function vector_cross(v1,v2) return v1[1] * v2[2] - v1[2] * v2[1] end
  662. function vector_abs(v) return math.sqrt(v[1]^2+v[2]^2) end
  663. function vector_coordabs(v) return {math.abs(v[1]),math.abs(v[2])} end
  664. function vector_angle(v1,v2) return math.atan(vector_cross(v1,v2) / (vector_abs(v1) * vector_abs(v2))) end
  665.  
  666. function all_fields_in(vector_field_iterator,checklist)
  667. return coroutine.wrap(function ()
  668. for v in vector_field_iterator do if checklist[tile_at_vector(v)] ~= nil then coroutine.yield(v) end end
  669. end)
  670. end
  671.  
  672. function not_fields_in(vector_field_iterator,checklist)
  673. return coroutine.wrap(function ()
  674. for v in vector_field_iterator do if checklist[tile_at_vector(v)] == nil then coroutine.yield(v) end end
  675. end)
  676. end
  677.  
  678. function get_dance_direction(move,pillar_offset)
  679. if pillar_offset == nil then pillar_offset = {0,0} end
  680. rawdir = vector_cross(vector_sub(pillar_center,pillar_offset),move)
  681. return rawdir ~= 0 and rawdir / math.abs(rawdir) or 0
  682. end
  683.  
  684. function init_fov()
  685. pillar_fov = {}
  686. for v in field_vectorfield() do
  687. if pillar_fov[v[1]] == nil then pillar_fov[v[1]] = {} end
  688. set_tile_at_vector(v,"0")
  689. if not vector_out_of_bounds(v,losrange) then
  690. f = feature_at_vector(v)
  691. mon = monster_at_vector(v)
  692. if f == nil or not travel.feature_traversable(f) or (mon and pseudomonsters[mon:name()] == true) then set_tile_at_vector(v,"1") end
  693. end
  694. end
  695. for v in vector_field_iterator_from_box({-losrange,-losrange},{-losrange,losrange}) do if tile_at_vector(v) == "1" then unfill(v) end end
  696. for v in vector_field_iterator_from_box({-losrange,losrange},{-losrange,-losrange}) do if tile_at_vector(v) == "1" then unfill(v) end end
  697. for v in vector_field_iterator_from_box({losrange,losrange},{-losrange,losrange}) do if tile_at_vector(v) == "1" then unfill(v) end end
  698. for v in vector_field_iterator_from_box({-losrange,losrange},{losrange,losrange}) do if tile_at_vector(v) == "1" then unfill(v) end end
  699. pillar_fov_clear = vector_field_copy(pillar_fov,fielddim)
  700. set_tile_at_vector({0,0},"x")
  701. end
  702.  
  703. function shift_fov(next_move)
  704. set_tile_at_vector({0,0},"p")
  705. new_fov = {}
  706. for v in field_vectorfield() do
  707. vn = vector_sub(v,next_move)
  708. if not vector_out_of_bounds(vn,fielddim) then
  709. if new_fov[vn[1]] == nil then new_fov[vn[1]] = {} end
  710. new_fov[vn[1]][vn[2]] = tile_at_vector(v)
  711. else
  712. vnn = {next_move[1]*fielddim,next_move[2]*fielddim}
  713. if new_fov[vnn[1]] == nil then new_fov[vnn[1]] = {} end
  714. new_fov[vnn[1]][vnn[2]] = tile_at_vector(v)
  715. end
  716. end
  717. pillar_fov = new_fov
  718. set_tile_at_vector({0,0},"x")
  719. end
  720.  
  721. function unfill(v)
  722. set_tile_at_vector(v,"2")
  723. for _,move in pairs(order_adja) do
  724. vn = vector_add(v,move)
  725. if not vector_out_of_bounds(vn,losrange) and tile_at_vector(vn) == "1" then unfill(vn) end
  726. end
  727. end
  728.  
  729. function floodfill(v)
  730. set_tile_at_vector(v,"P")
  731. for _,move in pairs(order_adja) do
  732. vn = vector_add(v,move)
  733. if tile_at_vector(vn) == "1" then floodfill(vn) end
  734. end
  735. return true
  736. end
  737.  
  738. function path_recursion(step,origin,path)
  739. neworigin = vector_add(origin,step)
  740. for vn in all_fields_in(vector_field_offset(vector_field_iterator_from_table(order_diag),neworigin),{["p"]=true,["x"]=true}) do
  741. vn = vector_sub(vn,neworigin)
  742. if not vector_equal(vn,vector_neg(step)) then
  743. continue = vector_copy(vn)
  744. dir = get_dance_direction(continue,neworigin)
  745. continue[3] = dir
  746. end
  747. end
  748. path[#path+1] = continue
  749. if tile_at_vector(vector_add(neworigin,continue)) == "x" then
  750. return path
  751. else
  752. return path_recursion(continue,neworigin,path)
  753. end
  754. end
  755.  
  756. function find_dir_of_path(step)
  757. walk_path = {[-1]={},[1]={}}
  758. path = path_recursion(step,{0,0},{step})
  759. dirsum = 0
  760. for _,step in pairs(path) do dirsum = dirsum + step[3] end
  761. return dirsum / math.abs(dirsum), path
  762. end
  763.  
  764. function draw_path()
  765. for v in all_fields_in(los_vectorfield(),{["P"]=true}) do
  766. for vn in not_fields_in(vector_field_offset(vector_field_iterator_from_table(order_adja),v),{["P"]=true}) do
  767. set_tile_at_vector(vn,"p")
  768. end
  769. end
  770. set_tile_at_vector({0,0},"x")
  771. end
  772.  
  773. function calculate_path()
  774. possible_moves = {}
  775. for v in all_fields_in(vector_field_iterator_from_table(order_diag),{["p"]=true}) do
  776. dir = get_dance_direction(v)
  777. possible_moves[#possible_moves+1] = {v[1],v[2],dir}
  778. end
  779. d1, p1 = find_dir_of_path(possible_moves[1])
  780. d2, p2 = find_dir_of_path(possible_moves[2])
  781. if d1 == d2 then
  782. crawl.mpr("Couldn't determine path directions, this shouldn't happen!")
  783. StopPillardancing()
  784. else
  785. for _,v in pairs(p1) do walk_path[d1][#walk_path[d1]+1] = {v[1],v[2],d1} end
  786. for _,v in pairs(p2) do walk_path[d2][#walk_path[d2]+1] = {v[1],v[2],d2} end
  787. end
  788. end
  789.  
  790. function fill_pillar()
  791. for v in all_fields_in(los_vectorfield(),{["p"]=true}) do
  792. surrounded = true
  793. for _ in not_fields_in(vector_field_offset(vector_field_iterator_from_table(order_adja),v),{["p"]=true,["P"]=true,["x"]=true,["!"]=true}) do surrounded = false break end
  794. if surrounded then set_tile_at_vector(v,"P") end
  795. end
  796. end
  797.  
  798. function tendril(v,dv)
  799. for d=1,losrange do
  800. vn = vector_add(v,vector_redir({d,d},dv))
  801. if vector_out_of_bounds(vn,losrange-1) then break end
  802. tile = tile_at_vector(vn)
  803. if (tile ~= "0" and tile ~= "p") or (tile == "p" and d == 1) then break end
  804. if tile == "p" then for dn=1,d do
  805. set_tile_at_vector(vector_add(v,vector_redir({dn,dn},dv)),"p")
  806. return true
  807. end end
  808. end
  809. end
  810.  
  811. function next_to_pillar()
  812. for v in all_fields_in(vector_field_iterator_from_table(order_diag),{["1"]=true}) do
  813. if floodfill(v) then return v end
  814. pillar_fov = vector_field_copy(pillar_fov_clear,fielddim)
  815. end
  816. return nil
  817. end
  818.  
  819. function monsters_at(move)
  820. ybound = {-losrange,losrange}
  821. xbound = {-losrange,losrange}
  822.  
  823. if move[1] < 0 then ybound[2] = -1
  824. elseif move[1] > 0 then ybound[1] = 1 end
  825. if move[2] < 0 then xbound[2] = -1
  826. elseif move[2] > 0 then xbound[1] = 1 end
  827. for v in all_fields_in(vector_field_iterator_from_box(ybound,xbound),{["0"]=true,["p"]=true}) do
  828. mon = monster_at_vector(v)
  829. --travel.set_exclude(x,y,0)
  830. if mon and not mon:is_safe() then
  831. return true
  832. end
  833. end
  834. return false
  835. end
  836.  
  837. function calculate_next_pillar_step()
  838. if dance_direction_num ~= nil then
  839. possible_moves = {walk_path[dance_direction_num][1],walk_path[dance_direction_num*-1][1]}
  840. else
  841. possible_moves = {walk_path[-1][1],walk_path[1][1]}
  842. end
  843. goodmove = nil
  844. for _,move in pairs(possible_moves) do
  845. goodmove = move
  846. if monsters_at(move) then
  847. if dance_direction_num ~= nil and move[3] == dance_direction_num then dance_direction_num = dance_direction_num*-1 end
  848. goodmove = nil
  849. else
  850. break
  851. end
  852. end
  853. if goodmove ~= nil then
  854. travel.del_exclude(goodmove[2], goodmove[1])
  855. return goodmove
  856. else
  857. crawl.mpr("No suitable move found!")
  858. StopPillardancing()
  859. return nil
  860. end
  861. end
  862.  
  863. function next_pillar_step()
  864. for i,c in pairs(order_diag) do if vector_equal(c,next_move) then
  865. crawl.sendkeys(moves_diag[i])
  866. break
  867. end end
  868. pillar_center = vector_sub(pillar_center,next_move)
  869. shift_fov(next_move)
  870. rotate_forward(walk_path[next_move[3]])
  871. rotate_backward(walk_path[next_move[3]*-1])
  872. next_move = nil
  873. end
  874.  
  875. function Pillardance()
  876. if not pillardancing then
  877. pillardancing = true
  878. init_fov()
  879. pillar_pos = next_to_pillar()
  880. if pillar_pos == nil then
  881. crawl.mpr("No pillar found!")
  882. pillardancing = false
  883. return false
  884. end
  885. draw_path()
  886. fill_pillar()
  887. for v in all_fields_in(los_vectorfield(),{["p"]=true,["x"]=true}) do
  888.  
  889. for _,dv in pairs(order_tendril) do tendril(v,dv) end
  890. end
  891. fill_pillar()
  892. for v in all_fields_in(los_vectorfield(),{["p"]=true,["x"]=true}) do exclude_at_vector(v) end
  893. pillar_center = {0, 0}
  894. vectorcount = 0
  895. --for y=-losrange,losrange do for x=-losrange,losrange do if pillar_fov[y][x] == "P" then
  896. -- pillar_center = {pillar_center[1] + y, pillar_center[2] + x}
  897. -- vectorcount = vectorcount + 1
  898. --end end end
  899. for v in all_fields_in(los_vectorfield(),{["P"]=true}) do
  900. pillar_center = {pillar_center[1] + v[1], pillar_center[2] + v[2]}
  901. vectorcount = vectorcount + 1
  902. end
  903. pillar_center = {pillar_center[1] / vectorcount, pillar_center[2] / vectorcount}
  904. calculate_path()
  905. next_move = calculate_next_pillar_step()
  906. if next_move == nil then return false end
  907. dance_direction_num = get_dance_direction(goodmove)
  908. dance_direction = dance_direction_num > 0 and "clockwise" or "counterclockwise"
  909. crawl.mpr("Dancing "..dance_direction.."!")
  910. else
  911. if next_move ~= nil then
  912. next_pillar_step()
  913. else
  914. next_move = calculate_next_pillar_step()
  915. exclude_at_vector({0,0})
  916. crawl.redraw_screen()
  917. end
  918. end
  919. --for y=-fielddim,fielddim do
  920. -- ls = ""
  921. -- for x=-fielddim,fielddim do
  922. -- ls = ls .. pillar_fov[y][x]
  923. -- end
  924. -- dmsg(pad(y,3), ls)
  925. --end
  926. end
  927.  
  928. function StopPillardancing()
  929. if pillardancing then
  930. for v in all_fields_in(field_vectorfield(),{["p"]=true,["x"]=true}) do unexclude_at_vector(v) end
  931. pillardancing = false
  932. dance_direction = nil
  933. dance_direction_num = nil
  934. next_move = nil
  935. pillar_center = {nil,nil}
  936. walk_path = {[-1]={},[1]={}}
  937. pillar_fov = {}
  938. pillar_fov_clear = {}
  939. end
  940. end
  941.  
  942.  
  943. --##################################
  944. --# Auxiliary Function Definitions #
  945. --##################################
  946.  
  947. function p(what) crawl.mpr(tostring(what)) end
  948.  
  949. function pad(str, len, char)
  950. if char == nil then char = ' ' end
  951. str = tostring(str)
  952. return str .. string.rep(char, len - #str)
  953. end
  954.  
  955. function dmsg(name, value)
  956. crawl.mpr(pad(string.format(" %s: %s",tostring(name),tostring(value)),50))
  957. end
  958.  
  959. function getvar(what)
  960. return what
  961. end
  962.  
  963. function debug(...)
  964. local name = arg[1]
  965. local value = arg[2]
  966. if arg['n'] == 1 then
  967. if name:find('%(') then
  968. dmsg(name, loadstring('return '..name)())
  969. else
  970. dmsg(name, loadstring('return getvar('..name..')')())
  971. end
  972. else
  973. dmsg(name, value)
  974. end
  975. end
  976.  
  977. function stringify_array(arr)
  978. if type(arr) ~= 'table' then return type(arr) end
  979.  
  980. local res = '{ '
  981. for index, value in ipairs(arr) do
  982. if type(value) == "table" then
  983. value = stringify_array(value)
  984. end
  985. if type(index) == "string" then
  986. res = res .. index .. ' = ' .. tostring(value) .. ', '
  987. else
  988. res = res .. tostring(value) .. ', '
  989. end
  990. end
  991. return res .. '}'
  992. end
  993.  
  994. function stringify_var(varname, var)
  995. return varname .. " = " .. tostring(var) .. "\n"
  996. end
  997.  
  998. function stringify_sorted_array(arr, order, aname)
  999. local res = aname .. " = { "
  1000. for _, index in pairs(order) do
  1001. res = res .. '["' .. string.format("%s",index) .. '"] = "' .. string.format("%s",arr[index]) .. '", '
  1002. end
  1003. res = res .. "}"
  1004. res = res .. aname .. "_order = { "
  1005. for _, index in pairs(order) do
  1006. res = res .. '"' .. string.format("%s",index) .. '", '
  1007. end
  1008. res = res .. "}"
  1009. return res
  1010. end
  1011.  
  1012.  
  1013. function you_are_safe()
  1014. return safe_from_invisible and you.feel_safe() and (you.poison_survival() > 0) and not pillardancing and not you.berserk()
  1015. end
  1016.  
  1017. autopickup_off_because = false
  1018. function check_safe_invisible(newmessages)
  1019. if newmessages:find("eactivating autopickup") then
  1020. autopickup_off_because = "monster"
  1021. elseif newmessages:find("utopickup is now off") then
  1022. autopickup_off_because = "user"
  1023. end
  1024.  
  1025. if not options.autopick_on and autopickup_off_because == "monster" then
  1026. safe_from_invisible = false
  1027. else
  1028. safe_from_invisible = true
  1029. end
  1030. end
  1031.  
  1032. function check_safe_oos(newmessages)
  1033. if newmessages:find("omething hits your") or newmessages:find("appears from outside your range of vision") then
  1034. safe_from_oos = false
  1035. else
  1036. safe_from_oos = true
  1037. end
  1038. end
  1039.  
  1040. function you_are_safe_reason()
  1041. if not safe_from_invisible then
  1042. return "invis"
  1043. elseif not safe_from_oos then
  1044. return "oos"
  1045. elseif not you.feel_safe() then
  1046. return "unsafe"
  1047. elseif not (you.poison_survival() > 0) then
  1048. return "pois"
  1049. else
  1050. return true
  1051. end
  1052. end
  1053.  
  1054. function sendkeys(command)
  1055. crawl.flush_input()
  1056. crawl.sendkeys(command)
  1057. crawl.flush_input()
  1058. --coroutine.yield(true)
  1059. end
  1060.  
  1061. function should_rest()
  1062. return
  1063. you_poisoned
  1064. or ( mp < (max_mp - autospent_mp) and you_god ~= "Pakellas" )
  1065. or ( hp < max_hp and you_race~="Deep Dwarf" and ( you_race~="Vampire" or you_hunger>0 ) )
  1066. or you_debuffed
  1067. end
  1068.  
  1069. function you_are_gourmand() return you.gourmand() or you_race=="Troll" or you_race=="Kobold" or you_race=="Ghoul" or you_race=="Felid" end
  1070.  
  1071. function autoexplore() sendkeys('o') end
  1072. function rest() sendkeys('5') end
  1073.  
  1074. function is_in_inventory(str)
  1075. for it in inventory() do
  1076. if string.find(it.name(), str) then
  1077. return true
  1078. end
  1079. end
  1080. return false
  1081. end
  1082.  
  1083. function is_at(x,y,what)
  1084. if not you.see_cell_no_trans(x,y) then return false end
  1085. local pile = items.get_items_at(x,y)
  1086. if pile ~= nil then
  1087. for _, it in ipairs(pile) do
  1088. for _, search in pairs(what) do
  1089. if it.name():find(search) then
  1090. return it
  1091. end
  1092. end
  1093. end
  1094. end
  1095. return false
  1096. end
  1097.  
  1098. function inventory()
  1099. return iter.invent_iterator:new(items.inventory())
  1100. end
  1101.  
  1102. function last_item()
  1103. local inv = items.inventory()
  1104. debug("ni",inv[#inv].name())
  1105. end
  1106.  
  1107.  
  1108. function floor_items()
  1109. return iter.invent_iterator:new(you.floor_items())
  1110. end
  1111.  
  1112. function is_equipped(where,str)
  1113. if equipped_at[where] then
  1114. return string.find(equipped_at[where].name(), str)
  1115. else
  1116. return false
  1117. end
  1118. end
  1119.  
  1120. weapon_target_skill = 0
  1121. weapon_skill = ""
  1122. weapon_type = ""
  1123. function check_new_weapon()
  1124. if equipped_at["weapon"] == nil or (equipped_at["weapon"].class(true) ~= "weapon" and equipped_at["weapon"].class(true) ~= "magical staff") then
  1125. weapon_target_skill = 28
  1126. return true
  1127. end
  1128. weapon_skill = equipped_at["weapon"].weap_skill
  1129. local maxdelay = equipped_at["weapon"].delay
  1130. local mindelay = math.floor(maxdelay / 2)
  1131. if weapon_skill == "Short Blades" and mindelay > 5 then mindelay = 5 end
  1132. if mindelay > 7 then mindelay = 7 end
  1133. if weapon_skill == "Crossbows" and mindelay < 10 then mindelay = 10 end
  1134. mindelay = math.max(mindelay,maxdelay - 14)
  1135. if mindelay < 3 then mindelay = 3 end
  1136. weapon_target_skill = (maxdelay - mindelay) * 2
  1137. weapon_type = equipped_at["weapon"].subtype()
  1138. end
  1139.  
  1140. function is_alternative_weapon(str)
  1141. local slot_a = items.inslot(items.letter_to_index("a"))
  1142. local slot_b = items.inslot(items.letter_to_index("b"))
  1143. local weapon = equipped_at["weapon"]
  1144.  
  1145. if slot_a and not slot_a.cursed then slot_a = slot_a.name() else return false end
  1146. if slot_b and not slot_b.cursed then slot_b = slot_b.name() else return false end
  1147. if weapon and not weapon.cursed then weapon = weapon.name() else return false end
  1148. if weapon ~= slot_a and weapon ~= slot_b then return false end
  1149.  
  1150. return (weapon == slot_a and string.find(slot_b,str)) or (weapon == slot_b and string.find(slot_a,str))
  1151. end
  1152.  
  1153. --Escapes the special characters in a string for pattern matching
  1154. function escape(str)
  1155. --Escapes parens and dash "()-"
  1156. local escaped = str:gsub('[%(%)%-]','\\%1')
  1157. --Removes any coloration parts of the string
  1158. return (escaped:gsub('<[^<]*>',''))
  1159. end
  1160.  
  1161. local need_skills_opened = true
  1162. function OpenSkills()
  1163. if you.turns() == 0 and need_skills_opened then
  1164. need_skills_opened = false
  1165. sendkeys("m")
  1166. end
  1167. end
  1168.  
  1169. function init_spells()
  1170. local spell_list = {}
  1171.  
  1172. for letter, spell_name in pairs(you.spell_table()) do
  1173. spell_list[spell_name] = letter
  1174. end
  1175.  
  1176. return spell_list
  1177. end
  1178.  
  1179. known_spells = init_spells()
  1180.  
  1181. function cast(what)
  1182. sendkeys("z" .. known_spells[what])
  1183. end
  1184.  
  1185. function init_abils()
  1186. local abil_list = {}
  1187.  
  1188. for letter, abil_name in pairs(you.ability_table()) do
  1189. abil_list[abil_name] = letter
  1190. end
  1191.  
  1192. return abil_list
  1193. end
  1194.  
  1195. function abil(what)
  1196. sendkeys("a" .. known_abils[what])
  1197. end
  1198.  
  1199. known_abils = init_abils()
  1200.  
  1201. }
  1202. bindkey += [~] CMD_LUA_CONSOLE
  1203. note_chat_messages = false
  1204. #############
  1205. # Autofight #
  1206. #############
  1207. # Do/don't throw stuff when autofighting
  1208. autofight_throw = true
  1209. autofight_throw_nomove = true
  1210. # If true. items are autofired stopping at the monsters feet (same as firing using .)
  1211. autofight_fire_stop = true
  1212. fire_order = launcher, return
  1213. fire_order += rock, javelin, tomahawk, stone
  1214. # Prevent me from tab-fighting to death by keeping this high
  1215. autofight_stop = 60
  1216. # Enables automagic attacks
  1217. automagic_enable = false
  1218. automagic_slot = a
  1219. # Percentage of MP to stop automagic at
  1220. automagic_stop = 50
  1221. # If set to true, resort to melee when automagic_stop is active
  1222. automagic_fight = true
  1223. ##############
  1224. # Autopickup #
  1225. ##############
  1226. # Used
  1227. # $ = gold
  1228. # ? = scroll
  1229. # ! = potion
  1230. # : = book
  1231. # " = jewellery
  1232. # / = wand
  1233. # % = food
  1234. # } = miscellaneous
  1235. # \ = rods
  1236. # | = staves
  1237. : if (you.god():find("Trog")) then
  1238. autopickup += $?!:"/%}\
  1239. : else
  1240. autopickup += $?!:"/%}\|
  1241. : end
  1242. # Unused
  1243. # ) = weapon
  1244. # ( = missiles
  1245. # [ = armour
  1246. # X = corpses
  1247. # Allows easily dropping multiple items
  1248. drop_mode += multi
  1249. # Always show the full list of items when you pick up a stack
  1250. pickup_mode += multi
  1251. # Allows followers to pick up ANYTHING (take care not to lose artefacts)
  1252. default_friendly_pickup += all
  1253. # Set Alias for Autopickup Exceptions
  1254. ae := autopickup_exceptions
  1255. ae += useless_item, dangerous_item, evil_item
  1256. # Don't pick up potion(s) of [coagulated] blood if you are not a vampire
  1257. : if you.race() ~= "Vampire" then
  1258. ae += potions? of.*blood
  1259. : end
  1260. # Autopickup artefacts
  1261. ae += <artefact
  1262.  
  1263. ################
  1264. # Auto Exclude #
  1265. ################
  1266.  
  1267. ## dangerous monsters ##
  1268. auto_exclude += ancient lich, death drake, hydra, ice statue, orb of fire
  1269. ## paralysing monsters and uniques ##
  1270. auto_exclude += [^c] wizard, ancient lich, Ereshkigal, Erolcha, eyeball, Grinder, Jory, lich
  1271. auto_exclude += Norris, ogre-mage, orb of eyes, orc sorcerer, Rupert, sphinx, vampire knight
  1272. ## other uniques and unique followers ##
  1273. auto_exclude += Agnes, Aizul, Arachne, Asterion, Blork, Boris, Crazy Yiuf, Donald, Dowan
  1274. auto_exclude += Duvessa, Edmund, Erica, Eustachio, Fannar, Frances, Frederick, Gastronok
  1275. auto_exclude += Grum, Harold, Ijyb, Jessica, Jorgrun, Joseph, Kirke, Louise, Mara, Maud
  1276. auto_exclude += Maurice, Menkaure, Mennas, Natasha, Nergalle, Nessos, Nikola, Pikel
  1277. auto_exclude += Polyphemus, Prince Ribbit, Psyche, Roxanne, Saint Roka, Sigmund, Snorg
  1278. auto_exclude += Sojobo, Sonja, Terence, Urug, Wiglaf, Xtahua, hog, slave
  1279.  
  1280. ###############
  1281. # Auto Travel #
  1282. ###############
  1283.  
  1284. # Set travel delay to -1 for instant-travel, set to 1 to see travel paths
  1285. travel_delay = -1
  1286. explore_stop = glowing_items,artefacts,greedy_pickup_smart
  1287. explore_stop += greedy_visited_item_stack,stairs,shops
  1288. explore_stop += altars,portals,branches,runed_doors,greedy_sacrificeable
  1289. # Adjusts how much autoexplore favours attempting to discover room perimeters and corners.
  1290. # At values higher than 0, autoexplore will more heavily favour visiting squares that are next to walls
  1291. # reasonable values range from 0 to 10 maybe?
  1292. explore_wall_bias = 3
  1293. # Make auto travel sacrifice corpses
  1294. sacrifice_before_explore = true
  1295. auto_sacrifice = true
  1296. # Disables key press from stopping autoexplore
  1297. travel_key_stop = false
  1298. runrest_ignore_poison = 3:30
  1299. runrest_ignore_monster += butterfly:1
  1300. trapwalk_safe_hp = dart:15,needle:25,arrow:25,bolt:30,spear:20,axe:40,blade:50
  1301. # Only stop resting when both HP/MP are full
  1302. rest_wait_both = true
  1303. # Set Alias'
  1304. stop := runrest_stop_message
  1305. ignore := runrest_ignore_message
  1306. ignore += You regained.*mp
  1307. # Annoyances -- Don't stop autotravel for these events
  1308. ignore += A.*toadstool withers and dies
  1309. ignore += disappears in a puff of smoke
  1310. ignore += engulfed in a cloud of smoke
  1311. ignore += engulfed in white fluffiness
  1312. ignore += grinding sound
  1313. ignore += in your inventory.*rotted away
  1314. ignore += safely over a trap
  1315. ignore += standing in the rain
  1316. ignore += toadstools? grow
  1317. ignore += You feel.*sick
  1318. ignore += You walk carefully through the
  1319. # Jiyva Messages
  1320. ignore += Jiyva appreciates your sacrifice
  1321. ignore += Jiyva gurgles merrily
  1322. ignore += Jiyva says: Divide and consume
  1323. ignore += You hear.*splatter
  1324. # Qazlal
  1325. ignore += The plant is engulfed
  1326. ignore += You destroy the (bush|fungus|plant)
  1327. ignore += You displace your
  1328. # Bad things -- Stop autotravel for these events (duplicates some of HDAForceMore)
  1329. stop += (blundered into a|invokes the power of) Zot
  1330. stop += (devoid of blood|starving)
  1331. stop += A huge blade swings out and slices into you[^r]
  1332. stop += An alarm trap emits a blaring wail
  1333. stop += flesh start
  1334. stop += found a zot trap
  1335. stop += hear a soft click
  1336. stop += lose consciousness
  1337. stop += sense of stasis
  1338. stop += Wait a moment
  1339. stop += wrath finds you
  1340. stop += You fall through a shaft
  1341. # Expiring spells effects -- Stop to allow recasts (duplicates some of HDAForceMore)
  1342. # Control Teleport
  1343. stop += you feel uncertain
  1344. # Death's Door
  1345. more += time is quickly running out
  1346. more += life is in your own
  1347. # Enslavement
  1348. more += is no longer charmed
  1349. # Flight
  1350. more += You are starting to lose your buoyancy
  1351. stop += You lose control over your flight
  1352. # Haste
  1353. more += You feel yourself slow down
  1354. # Phase Shift
  1355. more += You feel closer to the material plane
  1356. # Repel/Deflect
  1357. stop += missiles spell is about to expire
  1358. # Shroud of Golubria
  1359. stop += shroud begins to fray
  1360. stop += shroud unravels
  1361. more += Your shroud falls apart
  1362. # Swiftness
  1363. stop += start to feel a little slower
  1364. # Transmutations
  1365. more += Your transformation is almost over
  1366. more += You have a feeling this form
  1367. more += Your skin feels tender
  1368. more += You feel yourself come back to life
  1369. # Ghouls (Not part of HDAForceMore)
  1370. : if you.race() == "Ghoul" then
  1371. stop += smell.*(rott(ing|en)|decay)
  1372. stop += something tasty in your inventory
  1373. : end
  1374. # Good things - Bad things wearing off (Duplicates some of HDAForceMore)
  1375. stop += contamination has completely
  1376. stop += You are no longer firmly anchored in space
  1377. #Ally actions?
  1378. #ignore += pray:
  1379. #ignore += friend_spell:
  1380. #ignore += friend_enchant:
  1381. #ignore += friend_action:
  1382. #ignore += sound:
  1383. #############
  1384. # Interface #
  1385. #############
  1386. allow_self_target = prompt
  1387. sort_menus = true
  1388. #WARNING TO KEYPAD USERS: The number 7 is mapped to the letter 'y'
  1389. easy_confirm = all
  1390. confirm_butcher = never
  1391. easy_eat_chunks = true
  1392. auto_eat_chunks = true
  1393. auto_drop_chunks = yes
  1394. easy_eat_contaminated = true
  1395. equip_unequip = true
  1396. #hp_warning = 25 -- Damage Calc overrides these
  1397. #mp_warning = 25 -- Damage Calc overrides these
  1398. hp_colour = 100:green, 99:lightgrey, 75:yellow, 50:lightred, 25:red
  1399. mp_colour = 100:green, 99:lightgrey, 75:yellow, 50:lightred, 25:red
  1400. stat_colour = 3:red, 7:lightred
  1401. # Removes the more prompts when outputting more than one screen of messages
  1402. show_more = false
  1403. # Setting this to false changes the turn display to show player turns (used for scoring)
  1404. show_game_turns = true
  1405. msg_min_height=7
  1406. msg_max_height=10
  1407. default_manual_training = true
  1408. ####################
  1409. # Autoinscriptions #
  1410. ####################
  1411. # Set Alias
  1412. ai := autoinscribe
  1413. # Overwrite annoying inscriptions with your own
  1414. # Inscribe vampiric weapons if you are not a vampire
  1415. : if you.race() ~= "Vampire" and you.race() ~= "Mummy" then
  1416. ai += vampiric:!w
  1417. # Inscribe potions of blood if you are a vampire
  1418. : elseif you.race() == "Vampire" then
  1419. ai += potion.*blood:@q1
  1420. : end
  1421. # Inscribe distortion weapons if you are not worshipping Lugonu
  1422. : if you.god() ~= "Lugonu" then
  1423. ai += distortion:!w
  1424. ai += (Sonja|Psyche):!w
  1425. : end
  1426. # Misc
  1427. ai += rod of [^s][^t]:!a
  1428. ai += [Mm]anual of:!d
  1429. ai += dispersal:=f
  1430. ai += large rock:!d
  1431. ai += throwing net:=f, !d
  1432. ai += tome of destruction:!d
  1433. # Consumables
  1434. ai += (bad|dangerous)_item.*potion:!q
  1435. ai += potions? of berserk rage:!q
  1436. ai += potions? of cure mutation:!q
  1437. ai += (bad|dangerous)_item.*scroll:!r
  1438. ai += scrolls? of blinking:!r
  1439. ai += scrolls? of holy word:!r
  1440. ai += scrolls? of magic mapping:!r
  1441. ai += scrolls? of vulnerability:!r
  1442. # Body Armour
  1443. ai += fire dragon (armour|hide):rF++ rC-
  1444. ai += gold dragon (armour|hide):rC+ rF+ rPois
  1445. ai += ice dragon (armour|hide):rC++ rF-
  1446. ai += mottled dragon (armour|hide):rSticky
  1447. ai += pearl dragon (armour|hide):rN+
  1448. ai += quicksilver dragon armour:MR+
  1449. ai += shadow dragon (armour|hide):Stlth++++
  1450. ai += steam dragon (armour|hide):rSteam
  1451. ai += storm dragon (armour|hide):rElec
  1452. ai += swamp dragon (armour|hide):rPois
  1453. ai += troll (hide|leather armour):regen
  1454. # Body Armour Egos
  1455. ai += ([^l] leather armour|mail|plate armour|robe|skin) of cold resistance:rC+
  1456. ai += ([^l] leather armour|mail|plate armour|robe|skin) of fire resistance:rF+
  1457. ai += (leather armour|mail|plate armour|robe) of magic resistance:MR+
  1458. ai += (leather armour|mail|plate armour|robe) of positive energy:rN+
  1459. ai += (leather armour|mail|plate armour) of poison resistance:rPois
  1460. ai += plate armour of ponderousness:Speed-
  1461. ai += robe of resistance:rC+ rF+
  1462. ai += robe of the archmagi:Spellpower+
  1463. ai += troll leather armour of cold resistance: rC+
  1464. ai += troll leather armour of fire resistance: rF+
  1465. # Accessory Egos
  1466. ai += (barding|boots|buckler|cloak|gloves|hat|helmet|shield) of cold resistance:rC+
  1467. ai += (barding|boots|buckler|cloak|gloves|hat|helmet|shield) of fire resistance:rF+
  1468. ai += (barding|boots) of flight:+Fly
  1469. ai += (barding|boots) of stealth:Stlth+
  1470. ai += (barding|boots) of running:Speed+
  1471. ai += (barding|boots) of jumping:+Jump
  1472. ai += (buckler|cloak|shield) of poison resistance:rPois
  1473. ai += (buckler|shield) of positive energy:rN+
  1474. ai += (buckler|shield) of protection:AC+3
  1475. ai += (buckler|shield) of reflection:Reflect
  1476. ai += (buckler|shield) of resistance:rC+ rF+
  1477. ai += (cloak|hat|helmet) of magic resistance:MR+
  1478. ai += (hat|helmet) of intelligence:Int+3
  1479. ai += (hat|helmet) of see invisible:sInv
  1480. ai += cloak of darkness:+Inv
  1481. ai += gloves of strength:Str+3
  1482. ai += gloves of dexterity:Dex+3
  1483. ai += gloves of archery:RangedSlay+4
  1484. ai += hat of spirit shield:Spirit
  1485. # Amulets
  1486. ai += amulet of clarity:Clar
  1487. ai += amulet of faith:Faith, !P
  1488. ai += amulet of guardian spirit:Spirit
  1489. ai += amulet of rage:+Rage
  1490. ai += amulet of regeneration:+regen
  1491. ai += amulet of resist corrosion:rCorr
  1492. ai += amulet of resist mutation:rMut
  1493. ai += amulet of stasis:Stasis
  1494. ai += amulet of the gourmand:Gourm
  1495. ai += amulet of warding:Ward rN+
  1496. # Rings
  1497. ai += ring of fire:rF+ rC-
  1498. ai += ring of flight:+Fly
  1499. ai += ring of ice:rC+ rF-
  1500. ai += ring of invisibility:+Inv
  1501. ai += ring of loudness:Stlth-
  1502. ai += ring of magical power:MP+9
  1503. ai += ring of poison resistance:rPois
  1504. ai += ring of positive energy:rN+
  1505. ai += ring of protection from cold:rC+
  1506. ai += ring of protection from fire:rF+
  1507. ai += ring of protection from magic:MR+
  1508. ai += ring of see invisible:sInv
  1509. ai += ring of stealth:Stlth+
  1510. ai += ring of sustain abilities:SustAb
  1511. ai += ring of teleport control:cTele
  1512. ai += ring of teleportation:+/*tele
  1513. ai += ring of wizardry:Wiz+
  1514. # Obsolete in 0.16
  1515. ai += ring of regeneration:regen
  1516. # Staves
  1517. ai += staff of air:rElec
  1518. ai += staff of cold:rC+
  1519. ai += staff of conjuration:!a
  1520. ai += staff of death:rN+
  1521. ai += staff of energy:+MP, hungerless spells, !d!a
  1522. ai += staff of fire:rF+
  1523. ai += staff of poison:rPois
  1524. ai += staff of power:MP+17, !a
  1525. ai += staff of summoning:!a
  1526. ai += staff of wizardry:wiz+, !a
  1527. # Save fruit for abilities under Fedhas
  1528. : if you.god() == "Fedhas" then
  1529. ai += fruit:!e
  1530. : end
  1531. autoinscribe_cursed = false
  1532. show_god_gift = unident
  1533. ##################
  1534. # Character Dump #
  1535. ##################
  1536. dump_item_origins = all
  1537. dump_item_origin_price = 100
  1538. dump_message_count = 100
  1539. #dump_order = header,hiscore,stats,misc,mutations,skills,spells,overview,inventory
  1540. #dump_order += screenshot,monlist,messages,action_counts,vaults,notes,kills
  1541. dump_order += vaults, turns_by_place, kills_by_place
  1542. dump_book_spells = false
  1543. ood_interesting = 6
  1544. note_hp_percent = 25
  1545. note_all_skill_levels = true
  1546. note_xom_effects = true
  1547. note_items += of Zot,rod,acquirement
  1548. note_messages += Your scales start
  1549. note_messages += protects you from harm
  1550. note_messages += You fall through a shaft
  1551. note_messages += [bB]anish.*Abyss
  1552. note_monsters += orb of fire,silver star,pearl dragon,ancient lich
  1553.  
  1554. #################
  1555. # Magic options #
  1556. #################
  1557.  
  1558. allow_self_target = prompt
  1559.  
  1560. slot := spell_slot
  1561.  
  1562. # d fghi klm o rs vwxz
  1563.  
  1564. slot = animate dead:d
  1565. slot += flight:f
  1566. slot += regeneration:g
  1567. slot += haste:h
  1568. slot += deflect missiles:i
  1569. slot += animate skeleton:k
  1570. slot += delayed fireball:l
  1571. slot += simulacrum:m
  1572. slot += orb of destruction:o
  1573. slot += repel missiles:r
  1574. slot += stoneskin:s
  1575. slot += condensation shield:v
  1576. slot += swiftness:w
  1577. slot += sublimation of blood:x
  1578. slot += ozocubu.*armor:z
  1579.  
  1580. :if you.class()=="Conjurer" or you.class()=="Wizard" then
  1581.  
  1582. # abc e j mn p tu
  1583.  
  1584. slot += magic dart:a
  1585. slot += mystic blast:b
  1586. slot += conjure flame:c
  1587.  
  1588. slot += fireball:e
  1589.  
  1590. slot += iron shot:j
  1591.  
  1592. slot += mephitic cloud:q
  1593. slot += force lance:n
  1594.  
  1595. slot += poison cloud:p
  1596.  
  1597. slot += battlesphere:t
  1598. slot += freezing cloud:u
  1599. :elseif you.class()=="Transmuter" then
  1600.  
  1601. # ab i n p
  1602.  
  1603. slot += beastly appendage:A
  1604. slot += blade hands:b
  1605.  
  1606. slot += ice form:i
  1607.  
  1608. slot += spider form:p
  1609.  
  1610. slot += sticks to snakes:n
  1611. :elseif you.class()=="Fire Elementalist" then
  1612.  
  1613. # a c e
  1614.  
  1615. slot += flame tongue:a
  1616.  
  1617. slot += conjure flame:c
  1618.  
  1619. slot += fireball:e
  1620. :elseif you.class()=="Air Elementalist" then
  1621.  
  1622. # abc
  1623.  
  1624. slot += shock:a
  1625. slot += static discharge:b
  1626. slot += lightning bolt:c
  1627. :elseif you.class()=="Earth Elementalist" then
  1628.  
  1629. # ab
  1630.  
  1631. slot += sandblast:a
  1632. slot += stone arrow:b
  1633. :elseif you.class()=="Necromancer" then
  1634. slot += pain:a
  1635. :elseif you.class()=="Ice Elementalist" then
  1636. slot += freeze:a
  1637. slot += throw frost:b
  1638. :end
  1639.  
  1640. slot += .*:ABCDEFGHIJKLMNOPQRSTUVWXYZ
  1641.  
  1642. #############
  1643. # Autofight #
  1644. #############
  1645.  
  1646. auto_switch = false
  1647. autofight_stop = 20
  1648. autofight_throw = false
  1649. automagic_enable = true
  1650. automagic_stop = 0
  1651. automagic_fight = false
  1652.  
  1653. ##############
  1654. # Autopickup #
  1655. ##############
  1656.  
  1657. : if (you.god():find("Trog")) then
  1658. autopickup += $?!:"/}\
  1659. : else
  1660. autopickup += $?!:"/}\|
  1661. : end
  1662.  
  1663. ae -= dangerous_item
  1664. ae += >scroll of noise,>wand of random effects,>wand of flame
  1665. ae += >staff of,>wand of slow,>wand of conf,>wand of poly,>wand of dig
  1666. ae += >ring of fire,>ring of ice
  1667. ae += >pizza,>royal jelly>,>beef jerky
  1668.  
  1669. : if (you.race() ~= "Octopode") then
  1670. ae += >ring of protection from,>ring of stealth,>ring of wiz
  1671. : end
  1672. : if (you.race() ~= "Mummy") then
  1673. ae += >scroll of torment
  1674. : end
  1675.  
  1676. ###############
  1677. # Autoexplore #
  1678. ###############
  1679.  
  1680. explore_stop -= stairs
  1681. interrupt_travel -= hungry,sense_monster,mimic
  1682.  
  1683. #############
  1684. # Interface #
  1685. #############
  1686.  
  1687. view_delay = 0
  1688. skill_focus = toggle
  1689.  
  1690. menu_colour ^= blue:(corpse|chunk)
  1691. menu_colour ^= blue:bread ration
  1692. menu_colour ^= blue:meat ration
  1693. menu_colour ^= blue:jerk
  1694. menu_colour ^= blue:jell
  1695. menu_colour ^= blue:fruit
  1696. menu_colour ^= blue:pizza
  1697. menu_colour ^= darkgrey:inedible
  1698.  
  1699. ############
  1700. # Messages #
  1701. ############
  1702.  
  1703. msc := message_colour
  1704. msc ^= mute:Things that are here:
  1705. msc ^= mute:accepts your kill
  1706. msc ^= mute:There is an open door here
  1707. msc ^= mute:You open the door.
  1708. msc ^= mute:You feel (dopey|clumsy|weakened) for a moment
  1709. msc ^= mute:continue eating
  1710. msc ^= mute:Your.*(says|yells)
  1711. msc ^= mute:Your.*flickers and vanishes for a moment
  1712. msc ^= mute:Your.*mumbles some strange words
  1713. msc ^= mute:Your.*casts a spell
  1714. msc ^= mute:Your.*gestures wildly while chanting
  1715.  
  1716. more := force_more_message
  1717. more ^= skill increases.*0
  1718. more ^= skill increases.*5
  1719. more ^= Shields skill increases to level 4
  1720. more ^= have mastered
  1721. more ^= skill gains
  1722. more ^= strange energies course
  1723. more ^= a corruption grows
  1724. more ^= The.*begins to chant
  1725. more ^= drag you back to the ground
  1726. more ^= is wielding.*distortion
  1727. more ^= You are (blasted|electrocuted)!
  1728.  
  1729. more -= You.*teleport [^f]
  1730. more -= Your amulet of stasis
  1731. more -= You don't.* that spell
  1732. more -= You feel you are being watched by something
  1733. more -= The.*shudders
  1734. more -= You can now
  1735. more -= Your?.*can no longer
  1736.  
  1737. # Correct for minions
  1738.  
  1739. more -= The acid corrodes your
  1740. more -= A huge blade swings out and slices into you
  1741. more -= silver sears you
  1742. more -= dispelling energy hits you
  1743. more -= Space bends around you
  1744. more -= Space warps horribly around you
  1745. more -= Terrible wounds (open|spread) all over you
  1746. more -= The octopode crusher throws you
  1747. more -= swoops through the air toward you
  1748.  
  1749. more ^= dispelling energy hits you[^r]
  1750. more ^= silver sears you[^r]
  1751. more ^= Space bends around you[^r]
  1752. more ^= Space warps horribly around you[^r]
  1753. more ^= Terrible wounds (open|spread) all over you[^r]
  1754. more += The octopode crusher throws you[^r]
  1755. more += swoops through the air toward you[^r]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement