From 78d8b7cd5dbb18aa8fe17268a6de0a544a8da2bb Mon Sep 17 00:00:00 2001 From: HippoKingKoL Date: Tue, 14 Jan 2025 05:55:47 +0000 Subject: [PATCH 1/4] add utilities for calculating effect on level from mouthwash --- RELEASE/scripts/autoscend/auto_util.ash | 45 +++++++++++++++++++ .../scripts/autoscend/autoscend_header.ash | 9 ++++ RELEASE/scripts/autoscend/iotms/mr2024.ash | 31 +++++++++++++ 3 files changed, 85 insertions(+) diff --git a/RELEASE/scripts/autoscend/auto_util.ash b/RELEASE/scripts/autoscend/auto_util.ash index de40e9769..41c144bd9 100644 --- a/RELEASE/scripts/autoscend/auto_util.ash +++ b/RELEASE/scripts/autoscend/auto_util.ash @@ -4646,3 +4646,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; +} diff --git a/RELEASE/scripts/autoscend/autoscend_header.ash b/RELEASE/scripts/autoscend/autoscend_header.ash index 44e88a6e5..3641f40c9 100644 --- a/RELEASE/scripts/autoscend/autoscend_header.ash +++ b/RELEASE/scripts/autoscend/autoscend_header.ash @@ -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(); @@ -1906,3 +1911,7 @@ 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); diff --git a/RELEASE/scripts/autoscend/iotms/mr2024.ash b/RELEASE/scripts/autoscend/iotms/mr2024.ash index 3d484fd30..af88fe593 100644 --- a/RELEASE/scripts/autoscend/iotms/mr2024.ash +++ b/RELEASE/scripts/autoscend/iotms/mr2024.ash @@ -451,6 +451,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 ) From 479f3374a2e1d280847ae0223b1e0b338ef84d53 Mon Sep 17 00:00:00 2001 From: HippoKingKoL Date: Tue, 14 Jan 2025 06:01:50 +0000 Subject: [PATCH 2/4] add function to only wish for an effect if we don't already have it --- RELEASE/scripts/autoscend/auto_util.ash | 9 +++++++++ RELEASE/scripts/autoscend/autoscend_header.ash | 1 + 2 files changed, 10 insertions(+) diff --git a/RELEASE/scripts/autoscend/auto_util.ash b/RELEASE/scripts/autoscend/auto_util.ash index 41c144bd9..66e2b2d5b 100644 --- a/RELEASE/scripts/autoscend/auto_util.ash +++ b/RELEASE/scripts/autoscend/auto_util.ash @@ -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) + { + return true; + } + return auto_wishForEffect(wish); +} + boolean auto_wishForEffect(effect wish) { // First try to use the monkey paw diff --git a/RELEASE/scripts/autoscend/autoscend_header.ash b/RELEASE/scripts/autoscend/autoscend_header.ash index 3641f40c9..09d4a2840 100644 --- a/RELEASE/scripts/autoscend/autoscend_header.ash +++ b/RELEASE/scripts/autoscend/autoscend_header.ash @@ -1904,6 +1904,7 @@ 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); From 5eb812c0e66d42692a5bd402b047622af211608a Mon Sep 17 00:00:00 2001 From: HippoKingKoL Date: Tue, 14 Jan 2025 06:02:39 +0000 Subject: [PATCH 3/4] check if we need stats before cold wish for mouthwash --- RELEASE/scripts/autoscend/iotms/mr2024.ash | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RELEASE/scripts/autoscend/iotms/mr2024.ash b/RELEASE/scripts/autoscend/iotms/mr2024.ash index af88fe593..d00fe041f 100644 --- a/RELEASE/scripts/autoscend/iotms/mr2024.ash +++ b/RELEASE/scripts/autoscend/iotms/mr2024.ash @@ -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`); From 3663c483b6976535b36569dd707f9c823c02c231 Mon Sep 17 00:00:00 2001 From: HippoKingKoL Date: Tue, 14 Jan 2025 06:14:13 +0000 Subject: [PATCH 4/4] fix conditional syntax in WishIfNeeded --- RELEASE/scripts/autoscend/auto_util.ash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE/scripts/autoscend/auto_util.ash b/RELEASE/scripts/autoscend/auto_util.ash index 66e2b2d5b..ad69f6ed2 100644 --- a/RELEASE/scripts/autoscend/auto_util.ash +++ b/RELEASE/scripts/autoscend/auto_util.ash @@ -4557,7 +4557,7 @@ int meatReserve() boolean auto_wishForEffectIfNeeded(effect wish) { - if have_effect(wish) + if (have_effect(wish)>0) { return true; }