Skip to content

Commit

Permalink
fix: do cast using bat wings if Mafia won't (#1536)
Browse files Browse the repository at this point in the history
* fix: do cast using bat wings if Mafia won't

* fix: metadata.name is lowercase

* feat: equip the previous back item
  • Loading branch information
midgleyc authored Jan 9, 2025
1 parent 3d72ba5 commit 54510b8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions RELEASE/scripts/autoscend/auto_restore.ash
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,20 @@ boolean __restore(string resource_type, int goal, int meat_reserve, boolean useF

if(!success)
{
// did we have exactly one option and fail to cast rest upside down because we have a back item with +HP/MP?
if (count(options) == 1 && options[0].metadata.name == "rest upside down") {
item current_back = equipped_item($slot[back]);
// do we have less than max minus what the back item provides
if (current_resource() < max_resource() - numeric_modifier(current_back, "Maximum " + resource_type))
{
auto_log_info("Manually equipping the bat wings");
equip($item[bat wings]);
recover_discount_pants();
success = use_skill(1, $skill[rest upside down]);
equip(current_back);
return success;
}
}
auto_log_warning("Target "+resource_type+" => " + goal + " - Uh oh. All restore options tried ("+count(options)+") failed. Sorry.", "red");
recover_discount_pants();
return false;
Expand Down

0 comments on commit 54510b8

Please sign in to comment.