Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use mouthwash wish unless we really need stats #1544

Merged
merged 5 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions RELEASE/scripts/autoscend/auto_util.ash
Original file line number Diff line number Diff line change
Expand Up @@ -4555,6 +4555,15 @@ int meatReserve()
return reserve_gnasir + reserve_diary + reserve_zeppelin + reserve_palindome + reserve_island + reserve_extra;
}

boolean auto_wishForEffectIfNeeded(effect wish)
{
if (have_effect(wish)>0)
{
return true;
}
return auto_wishForEffect(wish);
}

boolean auto_wishForEffect(effect wish)
{
// First try to use the monkey paw
Expand Down Expand Up @@ -4646,3 +4655,48 @@ int remainingNCForcesToday()

return forces;
}

float substat_to_level()
{
return substat_to_level(my_basestat(stat_to_substat(my_primestat())));
}

float substat_to_level(int n)
{
if(n <= 16)
{
return 1; // All substats less than 16 are level 1, before the formula takes effect
}
return square_root( square_root(n) - 4 ) + 1;
}

stat stat_to_substat(stat s)
{
switch(s)
{
case $stat[muscle]:
return $stat[submuscle];
case $stat[mysticality]:
return $stat[submysticality];
case $stat[moxie]:
return $stat[submoxie];
}
return s;
}

float stat_exp_percent(stat s)
{
switch(s)
{
case $stat[muscle]:
case $stat[submuscle]:
return numeric_modifier($modifier[muscle experience percent]);
case $stat[mysticality]:
case $stat[submysticality]:
return numeric_modifier($modifier[mysticality experience percent]);
case $stat[moxie]:
case $stat[submoxie]:
return numeric_modifier($modifier[moxie experience percent]);
}
return 0;
}
10 changes: 10 additions & 0 deletions RELEASE/scripts/autoscend/autoscend_header.ash
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,11 @@ boolean auto_canLeapBridge();
boolean auto_haveSeptEmberCenser();
int remainingEmbers();
void auto_buyFromSeptEmberStore();
float expected_mouthwash_main_substat();
float expected_mouthwash_main_substat(float cold_res);
float expected_level_after_mouthwash();
float expected_level_after_mouthwash(int n_mouthwash);
float expected_level_after_mouthwash(int n_mouthwash, float cold_res);
boolean auto_haveTearawayPants();
boolean auto_haveTakerSpace();
void auto_checkTakerSpace();
Expand Down Expand Up @@ -1899,10 +1904,15 @@ int poolSkillPracticeGains();
boolean hasUsefulShirt();
int meatReserve();
boolean auto_wishForEffect(effect wish);
boolean auto_wishForEffectIfNeeded(effect wish);
int auto_totalEffectWishesAvailable();
item wrap_item(item it);
boolean auto_burnMP(int mpToBurn);
boolean can_read_skillbook(item it);
boolean have_campground();
boolean have_workshed();
int remainingNCForcesToday();
float substat_to_level();
float substat_to_level(int n);
stat stat_to_substat(stat s);
float stat_exp_percent(stat s);
36 changes: 35 additions & 1 deletion RELEASE/scripts/autoscend/iotms/mr2024.ash
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,12 @@ void auto_buyFromSeptEmberStore()
int [element] resGoal;
resGoal[$element[cold]] = 100;
// get cold res. Use noob cave as generic place holder
auto_wishForEffect($effect[Fever From the Flavor]);
provideResistances(resGoal, $location[noob cave], true);
equipMaximizedGear();
if (expected_level_after_mouthwash()<13) // use a wish if really need it
{
auto_wishForEffectIfNeeded($effect[Fever From the Flavor]);
}
// buy mouthwash and use it
buy($coinmaster[Sept-Ember Censer], 1, itemConsidering);
auto_log_debug(`Using mouthwash with {numeric_modifier("cold Resistance")} cold resistance`);
Expand All @@ -451,6 +454,37 @@ void auto_buyFromSeptEmberStore()
// consider throwin' ember for banish or summoning charm for pickpocket in future PR
}

float expected_mouthwash_main_substat()
{
return expected_mouthwash_main_substat(numeric_modifier($modifier[cold resistance]));
}

float expected_mouthwash_main_substat(float cold_res)
{
float boost_factor = 1+stat_exp_percent(my_primestat())/100;
return boost_factor * 14 * (cold_res**1.7) / 2;
}

float expected_level_after_mouthwash()
{
return expected_level_after_mouthwash(1, numeric_modifier($modifier[cold resistance]));
}

float expected_level_after_mouthwash(int n_mouthwash)
{
return expected_level_after_mouthwash(n_mouthwash,numeric_modifier($modifier[cold resistance]));
}

float expected_level_after_mouthwash(int n_mouthwash, float cold_res)
{
float gained_main_substats = n_mouthwash * expected_mouthwash_main_substat(cold_res);
int old_main_substats = my_basestat(stat_to_substat(my_primestat()));
float new_main_substats = old_main_substats + gained_main_substats;
float level = substat_to_level(new_main_substats);
return level;
}


boolean auto_haveTearawayPants()
{
if(auto_is_valid($item[Tearaway Pants]) && available_amount($item[Tearaway Pants]) > 0 )
Expand Down
Loading