diff --git a/RELEASE/scripts/autoscend/auto_consume.ash b/RELEASE/scripts/autoscend/auto_consume.ash index 8930f983b..af4e1e411 100644 --- a/RELEASE/scripts/autoscend/auto_consume.ash +++ b/RELEASE/scripts/autoscend/auto_consume.ash @@ -127,21 +127,38 @@ boolean autoDrink(int howMany, item toDrink, boolean silent) int expectedInebriety = toDrink.inebriety * howMany; - if(canOde(toDrink) && possessEquipment($item[Wrist-Boy]) && (my_meat() > 6500)) + if(expectedInebriety == 1 && howMany == 1 && item_amount($item[mime army shotglass]) > 0 && !get_property("_mimeArmyShotglassUsed").to_boolean() && !get_property("_auto_mimeArmyShotglassUsed").to_boolean() && my_mp() < 200) { - if((have_effect($effect[Drunk and Avuncular]) < expectedInebriety) && (item_amount($item[Drunk Uncles Holo-Record]) == 0)) + set_property("_auto_mimeArmyShotglassUsed","true"); //in case the shotglass text didn't get tracked by mafia don't keep skipping ode + auto_log_debug("Not considering Ode to Booze effects for mime army shotglass drink"); + } + else if(canOde(toDrink)) + { + if(possessEquipment($item[Wrist-Boy]) && (my_meat() > 6500)) { - auto_buyUpTo(1, $item[Drunk Uncles Holo-Record]); + if((have_effect($effect[Drunk and Avuncular]) < expectedInebriety) && (item_amount($item[Drunk Uncles Holo-Record]) == 0)) + { + auto_buyUpTo(1, $item[Drunk Uncles Holo-Record]); + } + buffMaintain($effect[Drunk and Avuncular], 0, 1, expectedInebriety); } - buffMaintain($effect[Drunk and Avuncular], 0, 1, expectedInebriety); - } - if(canOde(toDrink) && auto_have_skill($skill[The Ode to Booze])) - { - shrugAT($effect[Ode to Booze]); - // get enough turns of ode - while(acquireMP(mp_cost($skill[The Ode to Booze]), 0) && buffMaintain($effect[Ode to Booze], mp_cost($skill[The Ode to Booze]), 1, expectedInebriety)) - /*do nothing, the loop condition is doing the work*/; + if(auto_have_skill($skill[The Ode to Booze]) && have_effect($effect[Ode to Booze]) < expectedInebriety) + { + if(my_maxmp() < mp_cost($skill[The Ode to Booze])) + { + provideMaxMP(mp_cost($skill[The Ode to Booze])); + } + shrugAT($effect[Ode to Booze]); + // get enough turns of ode + while(acquireMP(mp_cost($skill[The Ode to Booze]), 0) && buffMaintain($effect[Ode to Booze], mp_cost($skill[The Ode to Booze]), 1, expectedInebriety)) + { ///*do nothing, the loop condition is doing the work*/; + if(have_effect($effect[Ode to Booze]) >= expectedInebriety) + { + break; //but stop before the loop does an extra acquireMP + } + } + } } equipStatgainIncreasersFor(toDrink); diff --git a/RELEASE/scripts/autoscend/auto_providers.ash b/RELEASE/scripts/autoscend/auto_providers.ash index 821fd9ca5..509448ba7 100644 --- a/RELEASE/scripts/autoscend/auto_providers.ash +++ b/RELEASE/scripts/autoscend/auto_providers.ash @@ -1192,3 +1192,167 @@ boolean provideMoxie(int amt, boolean doEquips) return provideMoxie(amt, my_location(), doEquips); } +boolean provideMaxMP(int amt, location loc, boolean notForCombat, boolean doEquips, boolean speculative) +{ + if(notForCombat && my_maxmp() >= amt) + { + return true; + } + + auto_log_info((speculative ? "Checking if we can" : "Trying to") + " provide " + amt + " max MP " + + (notForCombat ? "out of combat" : "for the next adventure") + ", " + (doEquips ? "with" : "without") + " equipment", "blue"); + + + boolean pass() + { + int achievableMaxMP = simValue("Buffed MP Maximum"); + int costModifierCurrent = notForCombat ? mana_cost_modifier() : combat_mana_cost_modifier(); + //combat_mana_cost_modifier() includes mana_cost_modifier(), but simValue("Combat Mana Cost") does not include simValue("Mana Cost") + int costModifierSimulated = simValue("Mana Cost") + simValue("Stackable Mana Cost") + (notForCombat ? 0 : simValue("Combat Mana Cost")); + int costModifierDiff = costModifierSimulated - costModifierCurrent; + int neededMaxMP = amt + costModifierDiff; //requested amt should be a mp_cost(), so included the current cost modifier. only apply changes to cost modifier + auto_log_debug("We can achieve " + achievableMaxMP + " max MP" + (costModifierDiff == 0 ? "" : (" and " + costModifierDiff + " cost modifier")), "blue"); + return (achievableMaxMP >= neededMaxMP); + } + + string speculateString; + string max; + location locCache; + + if(doEquips) + { + //any maximizer parameters added by a quest script before calling this provider will be there but pre adv may add more for the zone later + //so the weight given to MP when trying to enable a skill for next adventure should be high enough to not get beaten by other weights added by pre adv + //note "max" argument doesn't make optimal combinations with other maximizer modifiers because most slots are scored without considering choices maximizer will make in other slots + //with high mp weight a single maximize operation can equip several pieces of mp equipment over "max" needed mp. but being able to use desired combat spell is probably more important + + //not capping value for notForCombat because restores that go over could be wasted?, cost modifiers are negative so for those maximum cap arguments are effectively not usable + //and not valuing mana cost modifiers when maximizing for next combat because values combined together with mp can't be given a common cap + + max = "999mp" + (notForCombat ? ",-999Mana Cost,-999Stackable Mana Cost" : ( " " + amt + "max")); + + if (notForCombat) + { + //when maximizing just to raise MP to cast something, don't use any recorded maximize parameters meant for the next adventure + maximize(max, true); + } + else + { + simMaximizeWith(loc,max); + } + + if(pass()) + { + if(!speculative) + { + if(notForCombat) //equip now for immediate use + { + auto_log_info("Using gear to raise maximum MP above " + amt, "blue"); + equipMaximizedGear(); + } + else //add to maximize + { + addToMaximize(max); + } + } + return true; + } + + //equipment is not enough, try with buffs + //list the equipment picked by maximizer into speculateString, need this to make mafia speculate max MP from all relevant modifiers with equipment + buffs + item[slot] MPequip; + if (notForCombat) + { + //don't use recorded maximize parameters meant for the next adventure + MPequip = speculatedMaximizerEquipment(max); + } + else + { + //set location and parameters like simMaximizeWith() but this is to use speculatedMaximizerEquipment instead of simMaximize + if (my_location() != loc) + { + //set the simulated location before speculating + locCache = my_location(); + set_location(loc); + } + //use recorded maximize parameters meant for the next adventure + MPequip = speculatedMaximizerEquipment(get_property("auto_maximize_current") + (get_property("auto_maximize_current") != "" ? "," : "") + max); + } + + foreach sl in MPequip + { + speculateString += " equip " + sl.to_string() + " " + MPequip[sl].to_string() + ";"; + } + } + else //if(!doEquips) + { //equipment is not being locked and may be changed in pre adv after the provider returns success + //under assumption that the worst case is for all of current gear to be removed, speculate removing it all + //but this speculation would give the wrong results if something that reduces MP or limits mysticality is and stays equipped + foreach sl in $slots[hat,weapon,off-hand,back,shirt,pants,acc1,acc2,acc3,familiar] + { + //simulate removing all gear regardless of individual modifiers, to account for everything including any outfit bonus + if(equipped_item(sl) != $item[none]) speculateString += "unequip " + sl + "; "; + } + //it is not necessary to speculate yet: the provider is going to speculate for effects and will include the unequips + } + + + //effects + boolean [effect] effectsThatIncreaseMaxMP = $effects[The Magical Mojomuscular Melody,Feeling Excited,Glittering Eyelashes,Big,Triple-Sized]; + foreach eff in effectsThatIncreaseMaxMP + { + if (buffMaintain(eff, 0, 1, 1, true)) //speculative + { + speculateString += " up " + eff + ";"; + } + } + if (my_location() != loc) + { + //set the simulated location before speculating + locCache = my_location(); + set_location(loc); + } + cli_execute("speculate quiet; " + speculateString); + if(pass()) + { + if(!speculative) + { + if(doEquips) + { + if(notForCombat) //equip now for immediate use + { + auto_log_info("Using gear and buffs to raise maximum MP above " + amt, "blue"); + equipMaximizedGear(); + } + else //add to maximize + { + addToMaximize(max); + } + } + else + { + auto_log_info("Buffing maximum MP above " + amt, "blue"); + } + foreach eff in effectsThatIncreaseMaxMP + { + if(my_maxmp() < (amt + (notForCombat ? mana_cost_modifier() : combat_mana_cost_modifier()))) + { + buffMaintain(eff, 0, 1, 1, false); + } + } + } + return true; + } + + if (locCache != $location[none]) + { + set_location(locCache); + } + return false; +} + +boolean provideMaxMP(int amt) +{ + //immediate equip attempt for casting a non combat spell + return provideMaxMP(amt, my_location(), true, true, false); +} diff --git a/RELEASE/scripts/autoscend/autoscend_header.ash b/RELEASE/scripts/autoscend/autoscend_header.ash index 42fb7d90a..1406d67aa 100644 --- a/RELEASE/scripts/autoscend/autoscend_header.ash +++ b/RELEASE/scripts/autoscend/autoscend_header.ash @@ -1536,6 +1536,8 @@ float provideMoxie(int amt, location loc, boolean doEquips, boolean speculative) float provideMoxie(int amt, boolean doEquips, boolean speculative); boolean provideMoxie(int amt, location loc, boolean doEquips); boolean provideMoxie(int amt, boolean doEquips); +boolean provideMaxMP(int amt, location loc, boolean notForCombat, boolean doEquips, boolean speculative); +boolean provideMaxMP(int amt); ######################################################################################################## //Defined in autoscend/auto_restore.ash diff --git a/RELEASE/scripts/autoscend/quests/level_13.ash b/RELEASE/scripts/autoscend/quests/level_13.ash index b8246c2fb..5afa27233 100644 --- a/RELEASE/scripts/autoscend/quests/level_13.ash +++ b/RELEASE/scripts/autoscend/quests/level_13.ash @@ -1502,6 +1502,11 @@ boolean L13_towerNSTower() } //if we reached this spot we decided that we do not need a boning knife and intend to try to towerkill the wall of bones. + + //raise to the max MP that will be trying to acquire + //maximizer parameters are not able to avoid overvaluing MP for all gear, so just try provider without gear + provideMaxMP(216, $location[Noob Cave], false, false, false); + uneffect($effect[Scarysauce]); uneffect($effect[Jalapeño Saucesphere]); uneffect($effect[Spiky Shell]);