From 1041068a7f27681d41f6c816582e413a68d9f8d2 Mon Sep 17 00:00:00 2001 From: Daniel Simich <21962115+dsimich@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:38:59 -0400 Subject: [PATCH] Add dieting pill for high adv/full foods --- RELEASE/scripts/autoscend.ash | 1 + RELEASE/scripts/autoscend/auto_consume.ash | 41 ++++++++++++++++++- .../scripts/autoscend/autoscend_header.ash | 1 + 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/RELEASE/scripts/autoscend.ash b/RELEASE/scripts/autoscend.ash index 953fab38f..4b80c77d0 100644 --- a/RELEASE/scripts/autoscend.ash +++ b/RELEASE/scripts/autoscend.ash @@ -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(); diff --git a/RELEASE/scripts/autoscend/auto_consume.ash b/RELEASE/scripts/autoscend/auto_consume.ash index 678484542..1508a9a88 100644 --- a/RELEASE/scripts/autoscend/auto_consume.ash +++ b/RELEASE/scripts/autoscend/auto_consume.ash @@ -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)) { @@ -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"); @@ -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(); + 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()) diff --git a/RELEASE/scripts/autoscend/autoscend_header.ash b/RELEASE/scripts/autoscend/autoscend_header.ash index f91648f68..ac6df5f44 100644 --- a/RELEASE/scripts/autoscend/autoscend_header.ash +++ b/RELEASE/scripts/autoscend/autoscend_header.ash @@ -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);