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

add provideMaxMP and raise MP for ode to booze #1087

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4f7f8a7
increase max MP for ode to booze
quarklikeadork Mar 13, 2022
1a11c9a
Merge branch 'master' into odeMP
quarklikeadork Mar 26, 2022
494d572
Merge branch 'master' into odeMP
quarklikeadork Apr 2, 2022
dbe330a
fix equipment speculate
quarklikeadork Apr 4, 2022
e82257e
Merge branch 'Loathing-Associates-Scripting-Society:master' into odeMP
quarklikeadork Apr 9, 2022
dcf35c6
use speculatedMaximizerEquipment() from PR #1112
quarklikeadork Apr 9, 2022
4b58fd4
Merge branch 'master' into odeMP
quarklikeadork Apr 30, 2022
5792615
Merge branch 'master' into odeMP
quarklikeadork May 7, 2022
c4c8622
Merge branch 'master' into odeMP
quarklikeadork May 14, 2022
d8b45a8
Merge branch 'Loathing-Associates-Scripting-Society:master' into odeMP
quarklikeadork May 21, 2022
35b6378
Merge branch 'Loathing-Associates-Scripting-Society:master' into odeMP
quarklikeadork Jun 5, 2022
3e479bb
Merge branch 'Loathing-Associates-Scripting-Society:master' into odeMP
quarklikeadork Jun 11, 2022
78aadbe
add a maxMP provider
quarklikeadork Jun 11, 2022
343d4fc
Update autoscend_header.ash
quarklikeadork Jun 11, 2022
db3cd26
use provider for ode MP
quarklikeadork Jun 11, 2022
e5947b5
max MP that L13 will be trying to acquire
quarklikeadork Jun 11, 2022
73aa497
Merge branch 'Loathing-Associates-Scripting-Society:master' into odeMP
quarklikeadork Jun 26, 2022
7e40b75
Merge branch 'Loathing-Associates-Scripting-Society:master' into odeMP
quarklikeadork Jul 16, 2022
ae89a27
Merge branch 'Loathing-Associates-Scripting-Society:main' into odeMP
quarklikeadork Aug 6, 2022
d14ae7e
maximizer comments
quarklikeadork Aug 21, 2022
5329345
maximizer comments
quarklikeadork Aug 21, 2022
e896dd0
Merge branch 'Loathing-Associates-Scripting-Society:main' into odeMP
quarklikeadork Sep 15, 2022
881c104
Merge branch 'main' into odeMP
quarklikeadork Oct 8, 2022
2658570
Merge branch 'main' into odeMP
quarklikeadork Oct 29, 2022
fbc75dd
Merge branch 'Loathing-Associates-Scripting-Society:main' into odeMP
quarklikeadork Nov 6, 2022
336da77
Merge branch 'Loathing-Associates-Scripting-Society:main' into odeMP
quarklikeadork Nov 19, 2022
6bf6290
Merge branch 'Loathing-Associates-Scripting-Society:main' into odeMP
quarklikeadork Nov 26, 2022
e49f605
Merge branch 'main' into odeMP
quarklikeadork Jan 9, 2023
4d56f0b
Merge branch 'main' into odeMP
quarklikeadork Jan 11, 2023
01cb786
Merge branch 'main' into odeMP
quarklikeadork Feb 18, 2023
22ad112
Merge branch 'main' into odeMP
quarklikeadork May 13, 2023
035ab00
Merge branch 'main' into odeMP
quarklikeadork May 21, 2023
536c254
Merge branch 'main' into odeMP
quarklikeadork Jul 15, 2023
07f4473
Update level_13.ash
quarklikeadork Jul 15, 2023
cbe2300
Merge branch 'main' into odeMP
quarklikeadork Oct 21, 2023
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
39 changes: 28 additions & 11 deletions RELEASE/scripts/autoscend/auto_consume.ash
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
164 changes: 164 additions & 0 deletions RELEASE/scripts/autoscend/auto_providers.ash
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 2 additions & 0 deletions RELEASE/scripts/autoscend/autoscend_header.ash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions RELEASE/scripts/autoscend/quests/level_13.ash
Original file line number Diff line number Diff line change
Expand Up @@ -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&ntilde;o Saucesphere]);
uneffect($effect[Spiky Shell]);
Expand Down
Loading