Slime Squisher
Posts: 342
Joined: Friday, 2nd May 2014, 15:02
Auto exit on low hp.
[09:23] <Sequell> kroki is a greaterplayer!
[03:57] <Sequell> kroki is a polytheist!
[21:53] <Sequell> kroki is a greatberserker!
Ask fellow adventurers how to stay alive in the deep, dark, dangerous dungeon below, or share your own accumulated wisdom.
Slime Squisher
Posts: 342
Joined: Friday, 2nd May 2014, 15:02
Ziggurat Zagger
Posts: 11111
Joined: Friday, 8th February 2013, 12:00
<
function ready()
DmgTrack()
end
>
: local dmg_old_hp = 0
: function DmgTrack()
: local bot_hp, bot_mhp = you.hp()
: local dmg_inturn = 0
: local huge_int = 0
: local percent_hp = 0
: local percent_old_hp = 0
: local percent_hp_txt = "--%"
: if dmg_old_hp > 0 then
: if bot_hp < dmg_old_hp then
: dmg_inturn = dmg_old_hp - bot_hp
: percent_old_hp = math.ceil((dmg_old_hp*100)/bot_mhp)
: percent_hp = math.ceil((bot_hp*100)/bot_mhp)
: percent_hp_txt = percent_hp .. "%"
: if percent_hp < 30 then
: percent_hp_txt = "<red>" .. percent_hp_txt .. "</red>"
: elseif percent_hp < 55 then
: percent_hp_txt = "<lightred>" .. percent_hp_txt .. "</lightred>"
: elseif percent_hp < 75 then
: percent_hp_txt = "<yellow>" .. percent_hp_txt .. "</yellow>"
: end
: percent_hp_txt = percent_hp_txt .. "<darkgray>(" .. bot_hp .. "hp)</darkgray>"
: if dmg_inturn > (bot_hp*0.25) then
: if dmg_inturn > (bot_hp*0.45) and dmg_inturn > 2 then
: crawl.mpr("<green>Mandatory exit. Think how to survive! </green>")
: crawl.mpr("<white>Huge Dmg:</white> <red>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</red> hp: " .. percent_hp_txt)
: crawl.flush_prev_message()
: crawl.more()
: autoexit_note(dmg_inturn, bot_hp)
: crawl.sendkeys("S")
: crawl.sendkeys("y")
: else
: crawl.mpr("<white>Huge Dmg:</white> <red>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</red> hp: " .. percent_hp_txt)
: dmg_old_hp = bot_hp
: crawl.flush_prev_message()
: crawl.more()
: crawl.more_autoclear()
: end
: else
: if dmg_inturn > (bot_hp*0.15) then
: crawl.mpr("<white>Damage</white>: <yellow>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</yellow> hp: " .. percent_hp_txt)
: else
: crawl.mpr("<white>Damage</white>: -" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. " hp: " .. percent_hp_txt)
: end
: end
: crawl.flush_prev_message()
: end
: end
: dmg_old_hp = bot_hp
: end
: function autoexit_note(l, r)
: crawl.take_note("=================== Autoexit: lost:" .. l .. " current:" .. r)
: end
Snake Sneak
Posts: 95
Joined: Sunday, 24th July 2011, 19:17
Slime Squisher
Posts: 342
Joined: Friday, 2nd May 2014, 15:02
Ziggurat Zagger
Posts: 11111
Joined: Friday, 8th February 2013, 12:00
Ziggurat Zagger
Posts: 11111
Joined: Friday, 8th February 2013, 12:00
Midpoint wrote:It even tells you "Think how to survive!" Awesome.
Slime Squisher
Posts: 342
Joined: Friday, 2nd May 2014, 15:02
Ziggurat Zagger
Posts: 11111
Joined: Friday, 8th February 2013, 12:00
kroki wrote:It auto-exits after berserk rage expires (you lose 50% max hp at the time - makes sense). any way to fix that?
Other than setting the variable to 51%
Tomb Titivator
Posts: 832
Joined: Wednesday, 17th April 2013, 13:28
Ziggurat Zagger
Posts: 11111
Joined: Friday, 8th February 2013, 12:00
DracheReborn wrote:As a fellow user of the auto exit function, I'd suggest against checking for Exh and Slow. I thought about that too, then realized there are corner cases that could bite you. Example: berserk wears off, you're hurt and there are still enemies on the screen. IMO that still warrants auto exit. So I think I'd rather the function be too conservative, rather than have it miss a potential life threatening situation.
Though I still think being tormented is more annoying
Ziggurat Zagger
Posts: 11111
Joined: Friday, 8th February 2013, 12:00
: local dmg_old_hp = 0
: local old_berserk = you.berserk()
: function DmgTrack()
: local bot_hp, bot_mhp = you.hp()
: local berserk = you.berserk();
: local dmg_inturn = 0
: local huge_int = 0
: local percent_hp = 0
: local percent_old_hp = 0
: local percent_hp_txt = "--%"
: if dmg_old_hp > 0 then
: if bot_hp < dmg_old_hp then
: dmg_inturn = dmg_old_hp - bot_hp
: percent_old_hp = math.ceil((dmg_old_hp*100)/bot_mhp)
: percent_hp = math.ceil((bot_hp*100)/bot_mhp)
: percent_hp_txt = percent_hp .. "%"
: if percent_hp < 30 then
: percent_hp_txt = "<red>" .. percent_hp_txt .. "</red>"
: elseif percent_hp < 55 then
: percent_hp_txt = "<lightred>" .. percent_hp_txt .. "</lightred>"
: elseif percent_hp < 75 then
: percent_hp_txt = "<yellow>" .. percent_hp_txt .. "</yellow>"
: end
: percent_hp_txt = percent_hp_txt .. "<darkgray>(" .. bot_hp .. "hp)</darkgray>"
: if dmg_inturn > (bot_hp*0.25) then
: if dmg_inturn > (bot_hp*0.45) and dmg_inturn > 2 and berserk == old_berserk then
: crawl.mpr("<green>Mandatory exit. Think how to survive! </green>")
: crawl.mpr("<white>Huge Dmg:</white> <red>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</red> hp: " .. percent_hp_txt)
: crawl.flush_prev_message()
: crawl.more()
: autoexit_note(dmg_inturn, bot_hp)
: crawl.sendkeys("S")
: crawl.sendkeys("y")
: else
: crawl.mpr("<white>Huge Dmg:</white> <red>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</red> hp: " .. percent_hp_txt)
: dmg_old_hp = bot_hp
: crawl.flush_prev_message()
: crawl.more()
: crawl.more_autoclear()
: end
: else
: if dmg_inturn > (bot_hp*0.15) then
: crawl.mpr("<white>Damage</white>: <yellow>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</yellow> hp: " .. percent_hp_txt)
: else
: crawl.mpr("<white>Damage</white>: -" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. " hp: " .. percent_hp_txt)
: end
: end
: crawl.flush_prev_message()
: end
: end
: dmg_old_hp = bot_hp
: old_berserk = berserk
: end
: function autoexit_note(l, r)
: crawl.take_note("=================== Autoexit: lost:" .. l .. " current:" .. r)
: end
Return to Dungeon Crawling Advice
Users browsing this forum: No registered users and 69 guests