Skip to content

Commit

Permalink
Add dieting pill for high adv/full foods
Browse files Browse the repository at this point in the history
  • Loading branch information
dsimich committed Nov 1, 2024
1 parent b3e9f09 commit 1041068
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions RELEASE/scripts/autoscend.ash
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ void initializeSettings() {
remove_property("auto_saveSausage");
remove_property("auto_saveVintage");
set_property("auto_dontUseCookBookBat", false);
set_property("auto_dietpills", 0);
beehiveConsider();

eudora_initializeSettings();
Expand Down
41 changes: 40 additions & 1 deletion RELEASE/scripts/autoscend/auto_consume.ash
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ boolean autoEat(int howMany, item toEat, boolean silent)
int expectedFullness = toEat.fullness * howMany;
acquireMilkOfMagnesiumIfUnused(true);
consumeMilkOfMagnesiumIfUnused();
wantDietPill(toEat);

if(possessEquipment($item[Wrist-Boy]) && (my_meat() > 6500))
{
Expand Down Expand Up @@ -397,11 +398,21 @@ boolean autoEat(int howMany, item toEat, boolean silent)
}
if(retval)
{
string detail;
if(wasReadyToEat && have_effect($effect[Ready to Eat]) <= 0)
{
handleTracker(toEat,"Red Rocketed!", "auto_eaten");
detail = (detail != "" ? detail + ", Red Rocketed!" : "Red Rocketed!");
wasReadyToEat = false;
}
if(get_property("auto_dietpills").to_int() > 0)
{
detail = (detail != "" ? detail + ", Dieting Pilled!" : "Dieting Pilled!");
set_property("auto_dietpills", get_property("auto_dietpills").to_int() - 1);
}
if(detail != "")
{
handleTracker(toEat, detail, "auto_eaten");
}
else
{
handleTracker(toEat, "auto_eaten");
Expand Down Expand Up @@ -468,6 +479,34 @@ boolean consumeMilkOfMagnesiumIfUnused()
return use(1, $item[Milk of Magnesium]);
}
boolean wantDietPill(item toEat)
{
item pill = $item[Dieting Pill];
if(!auto_is_valid(pill) || !auto_is_valid(toEat))
{
return false;
}
int minAdv = substring(toEat.adventures, 0, index_of(toEat.adventures, "-")).to_int();

This comment has been minimized.

Copy link
@crowkol

crowkol Nov 3, 2024

Not all items.adventures have a "-" in them. This will result in an error indexing on -1 when the don'.t

This comment has been minimized.

Copy link
@dsimich

dsimich Nov 4, 2024

Author Member

Yeah, I fixed that on the next commit that I will be making tonight

int size = toEat.fullness;
//Use a dieting pill on only high adv/full foods
if(minAdv/size > 8.5)
{
//Only want a dieting pill if we can use it successfully
if(fullness_left() > 2 * size && spleen_left() >= 3)
{
pullXWhenHaveY(pill, 1, 0);
if(item_amount(pill) > 0)
{
handleTracker(pill, "auto_chewed");
set_property("auto_dietpills", get_property("auto_dietpills").to_int() + 1); //Track how many dieting pills we have consumed this ascension
return chew(1, pill);
}
}
return false;
}
return false;
}
boolean canDrink(item toDrink, boolean checkValidity)
{
if(!can_drink())
Expand Down
1 change: 1 addition & 0 deletions RELEASE/scripts/autoscend/autoscend_header.ash
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,7 @@ boolean autoEat(int howMany, item toEat);
boolean autoEat(int howMany, item toEat, boolean silent);
boolean acquireMilkOfMagnesiumIfUnused(boolean useAdv);
boolean consumeMilkOfMagnesiumIfUnused();
boolean wantDietPill(item toEat);
boolean canDrink(item toDrink);
boolean canEat(item toEat);
boolean canChew(item toChew);
Expand Down

0 comments on commit 1041068

Please sign in to comment.