Anonymous | Login | 2024-04-26 07:08 CEST |
Main | My View | View Issues | Change Log | Wiki | Tavern | News |
Viewing Issue Simple Details [ Jump to Notes ] [ Wiki ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||
0005240 | [DCSS] Patches | trivial | always | 2012-01-20 06:52 | 2012-01-20 15:51 | ||
Reporter | XuaXua | View Status | public | ||||
Assigned To | elliptic | ||||||
Priority | normal | Resolution | done | ||||
Status | closed | Product Branch | 0.10 ancient branch | ||||
Summary | 0005240: Cleaned up Autofight Lua | ||||||
Description |
Consolidated two long and nearly identical methods to a utility method and re-ordered the top three elseifs for logic (put no target in view at top.function hit_target(is_adjacent) local x, y, info = get_target() if info == nil then crawl.mpr("No target in view!") elseif you.confused() then crawl.mpr("You are too confused!") elseif hp_is_low() then crawl.mpr("You are too injured to fight blindly!") elseif info.can_hit == 3 then attack_fire(x,y) elseif info.can_hit == 2 then attack_melee(x,y) elseif info.can_hit == 1 then attack_reach(x,y) elseif is_adjacent then crawl.mpr("No target in range!") else move_towards(x,y) end end function hit_closest() hit_target(false) end function hit_adjacent() hit_target(true) end Not sure how to create a patch, so I just attached revised autofight.lua (tested, it works!). This is in anticipation of my next autofight patch which will hopefully allow for a non-intrusive pause when a new enemy comes into view. |
||||||
Additional Information | |||||||
Tags | No tags attached. | ||||||
Attached Files |
autofight.lua [^] (6,054 bytes) 2012-01-20 06:52 autofight_with_net.lua [^] (6,121 bytes) 2012-01-20 06:58 autofight_constrain.lua [^] (6,123 bytes) 2012-01-20 07:00 |
||||||
|
Mantis 1.1.8[^] Copyright © 2000 - 2009 Mantis Group |