boolean hunt_bounty(int advs) {
if (count(bopts) == 1) {
if (!can_has_bounty(bopts[0],my_defstat())) {
print("Can't finish current bounty.","olive");
if (item_amount(bopts[0]) > 0)
abort("Somehow, you already have "+item_amount(bopts[0])+" "+bopts[0].to_plural()+". I (the script) am aborting in confusion.");
cancel_bounty();
}
} else if (!accept_best_bounty(dosmallest)) return false;
if (count(bopts) != 1) abort("Error selecting bounty.");
print("Adventuring in "+bounty[bopts[0]].where.to_string()+" for "+bounty[bopts[0]].amount+" " + bopts[0].to_plural()+".");
set_property("battleAction", "custom combat script");
int advcount = 0;
while((item_amount(bopts[0]) < bounty[bopts[0]].amount) && advcount < advs)
{
adventure(1, bounty[bopts[0]].where);
advcount = advcount + 1;
while ((item_amount($item[spooky putty monster]) > 0) &&
(item_amount(bopts[0]) < bounty[bopts[0]].amount) &&
(advcount < advs))
{
use(1,$item[spooky putty monster]);
run_combat();
restore_hp(0);
advcount = advcount + 1;
}
}
// Refresh page and collect lucre if any
rebountify("bhh.php");
print("You have "+available_amount($item[filthy lucre])+" filthy lucre.");
return (count(bopts) == 0);
}