// cast a disco combo if possible (checks for profitability are included for nirvana/concentration)
string disco_combo(skill[int] seq, effect grants, int damage, string page) {
if (my_class() != $class[disco bandit]) return page;
int combocost;
foreach key,val in seq combocost = combocost + mp_cost(val);
if (my_mp() < combocost || have_effect(grants) > 0 || monster_hp() <= damage + to_int(have_equipped($item[disco banjo]))*3 +
to_int(have_equipped($item[shagadelic disco banjo]))*7 + to_int(have_equipped($item[makeshift castanets]))*10 +
to_int(have_equipped($item[Chester's moustache]))*20 + to_int(string_modifier("Outfit") == "Tawdry Tramp Togs")*20 +
to_int(my_familiar() == $familiar[frumious bandersnatch])*count(seq)*0.75*(familiar_weight(my_familiar())+numeric_modifier("Familiar Weight")) ||
round > 30 - count(seq)) return page;
float compen = 0;
if (intheclear() && inmp > mpforstasis) compen = max((28.0 - round)*inmp,0);
float dcprofit, base, adjusted;
switch (grants) {
case $effect[rave concentration]:
foreach it,chance in item_drops() {
base = minmax((100.0+numeric_modifier("Item Drop"))/100.0*chance,0,100);
if (base == 100) continue;
adjusted = minmax((130.0+numeric_modifier("Item Drop"))/100.0*chance,0,100);
if (base == adjusted) continue;
if (is_goal(it)) { dcprofit = 9999999; break; }
dcprofit = dcprofit + (adjusted - base)*autosell_price(it);
}
if (dcprofit < meatpermp*(to_float(combocost) - compen)) return page;
break;
case $effect[disco concentration]:
foreach it,chance in item_drops() {
base = minmax((100.0+numeric_modifier("Item Drop"))/100.0*chance,0,100);
if (base == 100) continue;
adjusted = minmax((120.0+numeric_modifier("Item Drop"))/100.0*chance,0,100);
if (base == adjusted) continue;
if (is_goal(it)) { dcprofit = 9999999; break; }
dcprofit = dcprofit + (adjusted - base)*autosell_price(it);
}
if (dcprofit < meatpermp*(to_float(combocost) - compen)) return page;
break;
case $effect[rave nirvana]: if (nowfightingonstageone != $monster[dirty thieving brigand] &&
0.5*to_float(meat_drop()) < meatpermp*(to_float(combocost) - compen)) return page;
case $effect[disco nirvana]: if (nowfightingonstageone != $monster[dirty thieving brigand] &&
0.3*to_float(meat_drop()) < meatpermp*(to_float(combocost) - compen)) return page;
}
foreach key,val in seq page = act(try_skill(page,val));
return page;
}
string try_combos(string page) {
skill[int] dcomb;
boolean can_rave = have_skill($skill[Break It On Down]) && have_skill($skill[Pop and Lock It])
&& have_skill($skill[Run Like the Wind]);
int rave_cost = mp_cost($skill[Break It On Down]) + mp_cost($skill[Pop and Lock It]) + mp_cost($skill[Run Like the Wind]);
boolean can_rave_concentrate = (my_class() == $class[disco bandit] && count(item_drops()) > 0 && can_rave && monster_hp() > 25 &&
my_mp() >= rave_cost);
boolean can_rave_nirvana = (my_class() == $class[disco bandit] && meat_drop() > 0 && can_rave && monster_hp() > 17 &&
my_mp() >= rave_cost);
if (can_rave_concentrate) {
matcher combo = create_matcher("(.+),(.+),(.+)", get_property("raveCombo1"));
if(combo.find()) {
for i from 1 to 3
dcomb[i] = combo.group(i).to_skill();
page = disco_combo(dcomb,$effect[rave concentration],25,page);
}
}
if (can_rave_nirvana) {
matcher combo = create_matcher("(.+),(.+),(.+)", get_property("raveCombo2"));
if(combo.find()) {
for i from 0 to 2
dcomb[i] = combo.group(i).to_skill();
page = disco_combo(dcomb,$effect[rave nirvana],25,page);
}
}
if (can_nirvana) {
dcomb[0] = $skill[disco dance of doom];
dcomb[1] = $skill[disco dance ii: electric boogaloo];
page = disco_combo(dcomb,$effect[disco nirvana],17,page);
}
if (can_concentrate) {
dcomb[0] = $skill[disco eye-poke];
dcomb[1] = $skill[disco dance of doom];
dcomb[2] = $skill[disco dance ii: electric boogaloo];
return disco_combo(dcomb,$effect[disco concentration],19,page);
}
return page;
}