int max_castable(skill sk) { // returns how many times you can possibly cast a given skill (NOT based on current MP)
switch (sk) {
case $skill[Advanced Cocktailcrafting]: return 3 + 2*to_int(have_skill($skill[superhuman cocktailcrafting])) - to_int(get_property("cocktailSummons"));
case $skill[Pastamastery]: return 3 + 2*to_int(have_skill($skill[transcendental noodlecraft])) - to_int(get_property("noodleSummons"));
case $skill[Advanced Saucecrafting]: return 3 + 2*to_int(have_skill($skill[the way of sauce])) - to_int(get_property("reagentSummons"));
case $skill[Rainbow Gravitation]: return 3 - to_int(get_property("prismaticSummons"));
case $skill[Summon Hilarious Objects]: return to_int(get_property("grimoire1Summons") == "0");
case $skill[Summon Tasteful Items]: return to_int(get_property("grimoire2Summons") == "0");
case $skill[Summon Snowcones]:
case $skill[Summon Stickers]:
case $skill[Summon Sugar Sheets]: return 3 - to_int(get_property("tomeSummons"));
// candyHeartSummons
}
return floor(my_maxmp() / mp_cost(sk));
}
// build list of castable skills
record tskill {
skill nome;
int type;
int irr; int ele; int vent;
};
tskill[int] skills;
file_to_map("classskills.txt",skills);
print("Your castable skills:","blue");
foreach i,s in skills {
if (!have_skill(s.nome) || (s.type > 4 || s.type < 1 || s.type == 2) || // only types 1,3,4 that you have
max_castable(s.nome) == 0 || i == 45 || // casting limits, skip vent rage gland
(s.type > 2 && to_effect(s.nome) != $effect[none] && have_effect(to_effect(s.nome)) > 2000)) { // skip buffs you have too much of
remove skills[i]; continue;
}
print(i+": "+s.nome + " ("+mp_cost(s.nome)+" MP) -- "+to_effect(s.nome));
}
boolean burn_to(int target) { // only returns true if burning occurred!
target = minmax(target,0,my_maxmp());
if (target == my_maxmp()) return false;
if (my_mp() <= target) return false;
print("Burning down to "+target+" MP...");
int init = my_mp();
cli_execute("burn extra -"+target);
if (my_mp() <= target) return true;
int mpflag;
repeat {
mpflag = my_mp();
foreach i,s in skills {
if (i > 6000 && i < 6028 && (have_effect(to_effect(s.nome)) == 0 || // skip AT buffs you don't have or have too much of
have_effect(to_effect(s.nome)) > 2000)) continue;
if (max_castable(s.nome) > 0 && my_mp() >= mp_cost(s.nome)) use_skill(1,s.nome);
if (my_mp() <= target) return true;
}
} until (mpflag == my_mp());
return (my_mp() != init);
}