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

Modifier after x turns #1084

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4fbe125
Update auto_util.ash
quarklikeadork Mar 12, 2022
90f88d1
Update autoscend_header.ash
quarklikeadork Mar 12, 2022
8200314
waste less soul food
quarklikeadork Mar 12, 2022
27de5ea
burn MP
quarklikeadork Mar 12, 2022
afc748d
Merge branch 'Loathing-Associates-Scripting-Society:master' into modi…
quarklikeadork Mar 12, 2022
ac492ed
restore lost edit
quarklikeadork Mar 13, 2022
ed79845
Update auto_post_adv.ash
quarklikeadork Mar 14, 2022
8a53b1f
fix more mp waste
quarklikeadork Mar 16, 2022
20d43c6
Merge branch 'master' into modifierAfterXTurns
quarklikeadork Mar 16, 2022
1467ce0
Update auto_post_adv.ash
quarklikeadork Mar 26, 2022
24dd5bd
Merge branch 'master' into modifierAfterXTurns
quarklikeadork Apr 2, 2022
be4a357
Merge branch 'Loathing-Associates-Scripting-Society:master' into modi…
quarklikeadork Apr 9, 2022
e3d844f
Merge branch 'master' into modifierAfterXTurns
quarklikeadork May 7, 2022
560c4e3
Merge branch 'master' into modifierAfterXTurns
quarklikeadork May 14, 2022
2f02ef6
Merge branch 'Loathing-Associates-Scripting-Society:master' into modi…
quarklikeadork May 21, 2022
d24b802
Merge branch 'Loathing-Associates-Scripting-Society:master' into modi…
quarklikeadork Jun 5, 2022
6c1883e
Merge branch 'Loathing-Associates-Scripting-Society:master' into modi…
quarklikeadork Jun 11, 2022
ca6955d
Merge branch 'Loathing-Associates-Scripting-Society:master' into modi…
quarklikeadork Jun 26, 2022
c4e682f
Merge branch 'master' into modifierAfterXTurns
quarklikeadork Jul 16, 2022
54181ac
Merge branch 'Loathing-Associates-Scripting-Society:main' into modifi…
quarklikeadork Aug 6, 2022
7c03438
also limit mp burn
quarklikeadork Aug 6, 2022
aa5881d
Merge branch 'main' into modifierAfterXTurns
quarklikeadork Aug 29, 2022
467d3b4
Merge branch 'main' into modifierAfterXTurns
quarklikeadork Aug 30, 2022
37e817a
Merge branch 'main' into modifierAfterXTurns
quarklikeadork Sep 4, 2022
82ca854
Update auto_pre_adv.ash
quarklikeadork Sep 4, 2022
e222f24
Merge branch 'Loathing-Associates-Scripting-Society:main' into modifi…
quarklikeadork Sep 11, 2022
ea56c10
Merge branch 'Loathing-Associates-Scripting-Society:main' into modifi…
quarklikeadork Sep 11, 2022
e5e15ca
Merge branch 'Loathing-Associates-Scripting-Society:main' into modifi…
quarklikeadork Sep 15, 2022
ffffee5
Merge branch 'main' into modifierAfterXTurns
quarklikeadork Oct 8, 2022
ca6d1d6
Merge branch 'main' into modifierAfterXTurns
quarklikeadork Oct 29, 2022
d4c4dad
Merge branch 'Loathing-Associates-Scripting-Society:main' into modifi…
quarklikeadork Nov 6, 2022
70a0b50
Merge branch 'Loathing-Associates-Scripting-Society:main' into modifi…
quarklikeadork Nov 19, 2022
e12932d
Merge branch 'Loathing-Associates-Scripting-Society:main' into modifi…
quarklikeadork Nov 26, 2022
2f7192b
Merge branch 'main' into modifierAfterXTurns
quarklikeadork Jan 9, 2023
2e6550e
Merge branch 'main' into modifierAfterXTurns
quarklikeadork Feb 18, 2023
bded142
Merge branch 'main' into modifierAfterXTurns
quarklikeadork May 13, 2023
ee95dd1
Merge branch 'main' into modifierAfterXTurns
quarklikeadork May 21, 2023
a7df4fa
Merge branch 'main' into modifierAfterXTurns
Alium58 Jul 7, 2023
ce47c49
Merge branch 'main' into modifierAfterXTurns
quarklikeadork Jul 15, 2023
64bc858
Merge branch 'main' into modifierAfterXTurns
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
26 changes: 24 additions & 2 deletions RELEASE/scripts/autoscend/auto_post_adv.ash
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,26 @@ boolean auto_post_adventure()
{
use_skill(1, $skill[Soul Rotation]);
}
int missing = (my_maxmp() - my_mp()) / 15; //soul food restores 15 MP per cast.

int maxMPNextTurn;
int MPtoRestore = my_maxmp() - my_mp();
if(MPtoRestore >= 15 && my_maxmp() > 150) //todo how much MP wanted for buffing before next turn?
{
maxMPNextTurn = modifierAfterXTurns("Buffed MP Maximum",1);
if(maxMPNextTurn > 100) //todo how much MP wanted for combat?
{
//don't restore MP that will expire with effects
MPtoRestore = max(0,maxMPNextTurn - my_mp());
}
}
int casts = MPtoRestore / 15; //soul food restores 15 MP per cast.
int availableSauce = my_soulsauce();
int minMPexpected = my_mp() + (availableSauce - 5) * 15; //mp expected after soul food if last 5 soulsauce is saved
if(availableSauce >= 5 && minMPexpected > 100 && minMPexpected > 0.8*my_maxmp())
{
availableSauce -= 5; //keep 5 soulsauce for soul bubble if not missing much MP
}
int casts = min(missing, availableSauce / 5); //soul food costs 5 soulsauce per cast.
casts = min(casts, availableSauce / 5); //soul food costs 5 soulsauce per cast.
if(casts > 0)
{
use_skill(casts, $skill[Soul Food]);
Expand Down Expand Up @@ -675,6 +687,16 @@ boolean auto_post_adventure()
buffMaintain($effect[Intimidating Mien], 50, 1, 5);
}

if(my_maxmp() < 120 && have_effect($effect[The Magical Mojomuscular Melody]) > 0)
Alium58 marked this conversation as resolved.
Show resolved Hide resolved
{
// The Magical Mojomuscular Melody gives at least 30 max MP and is maintained when under 80 max MP
// when the effect itself is raising max MP over 80, if not maintained longer here it would expire, waste any MP above max, then get cast again
if(my_maxmp() - my_mp() < 35)
Alium58 marked this conversation as resolved.
Show resolved Hide resolved
{
buffMaintain($effect[The Magical Mojomuscular Melody], 3, 1, 5);
}
}

buffMaintain($effect[Polka of Plenty], 110, 1, 5);
}
else
Expand Down
12 changes: 12 additions & 0 deletions RELEASE/scripts/autoscend/auto_pre_adv.ash
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,19 @@ boolean auto_pre_adventure()
//my_mp is broken in Dark Gyffte
if (!in_darkGyffte())
{
//TODO don't do this when next turn is free since that gives no effect from mp_regen(). PR #1199 adds "auto_nextEncounter"
int wasted_mp = my_mp() + mp_regen() - my_maxmp();
if(my_maxmp() > 400) //todo how much MP wanted for combat? but for now there is no MP burning after this without 400 MP anyway so check 400
{
int maxMPNextTurn = modifierAfterXTurns("Buffed MP Maximum",1);
if(maxMPNextTurn != my_maxmp())
{
//count MP that will expire with effects next turn
maxMPNextTurn = max(100,maxMPNextTurn); //todo how much MP wanted for combat?
wasted_mp = my_mp() + mp_regen() - maxMPNextTurn;
}
}
wasted_mp = min(my_mp() - 100,wasted_mp); //todo how much MP wanted for combat? in case regen is higher than MP, like with blue rocket, at least keep 100
if(wasted_mp > 0 && my_mp() > 400)
{
auto_log_info("Burning " + wasted_mp + " MP...");
Expand Down
58 changes: 58 additions & 0 deletions RELEASE/scripts/autoscend/auto_util.ash
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,64 @@ void debugMaximize(string req, int meat) //This function will be removed.

}

float modifierAfterXTurns(string mod, int turns, boolean forceMaintainable)
{
//returns predicted value of modifier after X turns of effects have expired assuming no equipment change
//used for the special derivative modifiers "Buffed MP Maximum"
//any modifier works but some may need additions (item drop with broken champagne bottle, quantum terrarium familiar change,...)

string speculateString;
int [effect] currentEffects = my_effects();
foreach buff in currentEffects
{
if(have_effect(buff) <= turns)
{
//effect would expire after specified amount of turns
boolean substractEffect = true;
if(turns > 1)
{
//effects that can be maintained will not necessarily be maintained
if(forceMaintainable)
{
//force the assumption that maintainable effects will be maintained
if(buffMaintain(buff, 0, 1, (turns+1), true)) //speculative
{
substractEffect = false;
}
}
else
{
//if not expiring next turn assume that at least buffs from casting known skills will be maintained
//routine buff maintenance in post adv doesn't wait for buffs to be at 1 turn to maintain them if it can
skill effectSkill = to_skill(buff);
if (auto_have_skill(effectSkill))
{
substractEffect = false;
}
//are there other indefinitely maintained effects to count here?
}
}
if(substractEffect)
{
//not worth filtering effects here before speculating uneffect on them?
//for modifier "buffed hp maximum" effects can be any of numeric_modifier(buff,"maximum hp"), "maximum hp percent", "muscle", "muscle percent"
speculateString += " uneffect " + buff.to_string() + ";";
}
}
}

if(speculateString != "")
{
cli_execute("speculate quiet; " + speculateString);
}
return numeric_modifier("Generated:_spec", mod);
}

float modifierAfterXTurns(string mod, int turns)
{
return modifierAfterXTurns(mod, turns, false);
}

string trim(string input)
{
matcher whitespace = create_matcher("(\\A\\s+)|(\\s+\\z)", input);
Expand Down
2 changes: 2 additions & 0 deletions RELEASE/scripts/autoscend/autoscend_header.ash
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,8 @@ boolean autoMaximize(string req, boolean simulate);
boolean autoMaximize(string req, int maxPrice, int priceLevel, boolean simulate);
aggregate autoMaximize(string req, int maxPrice, int priceLevel, boolean simulate, boolean includeEquip);
void debugMaximize(string req, int meat);
float modifierAfterXTurns(string mod, int turns, boolean forceMaintainable);
float modifierAfterXTurns(string mod, int turns);
string trim(string input);
string safeString(string input);
string safeString(skill input);
Expand Down