string[item] concoctions ; // stolen from PriceAdvisor.ash
boolean[item] currently_considering; // prevent infinite recursion
if ( !file_to_map("concoctions.txt", concoctions) )
abort("Failed to load concoctions.txt");
// Add funny concoctions that don't load properly
concoctions[$item[bottle of gin]] = "MIX";
concoctions[$item[bottle of rum]] = "MIX";
concoctions[$item[bottle of sake]] = "MIX";
concoctions[$item[bottle of tequila]] = "MIX";
concoctions[$item[bottle of whiskey]] = "MIX";
concoctions[$item[bottle of vodka]] = "MIX";
concoctions[$item[boxed wine]] = "MIX";
// strip extra conditions used by Mafia --
// taken into account by get_ingredients(), so I don't need 'em
foreach itm, c_type in concoctions {
c_type = replace_string(c_type, "TORSO", "");
c_type = replace_string(c_type, "FEMALE", "");
c_type = replace_string(c_type, "MALE", "");
c_type = replace_string(c_type, "HAMMER", "");
c_type = replace_string(c_type, "WEAPON", "");
c_type = replace_string(c_type, "SSPD", "");
c_type = replace_string(c_type, "GRIMACITE", "");
c_type = replace_string(c_type, "SX3", "");
// remove any remaining trailing ", "
while (last_index_of(c_type, ", ") == length(c_type) - 2)
{ c_type = substring(c_type, 0, length(c_type) - 2); }
concoctions[itm] = c_type ;
}
boolean uses_advs( item itm ) {
boolean uses_adv = false ;
if ( is_npc_item(itm) ) return false ;
if ( count(get_ingredients(itm)) == 0 ) return false ;
switch ( concoctions[itm] ) {
// always uses an adventure to make
case "WSMITH":
case "ASMITH":
case "MALUS":
case "WOK":
case "MSTILL": // make sure the still won't be used
case "BSTILL": //
case "JEWEL":
case "EJEWEL":
case "EXPENSIVE":
return true ;
// never uses an adventure to make
case "PIXEL":
case "STAR":
case "ROLL":
case "SUSE":
case "MIX":
case "COOK":
return false ;
// sometimes uses an adventure to make
case "SMITH":
uses_adv = !in_muscle_sign() ;
break ;
case "MIX_FANCY":
case "ACOCK":
case "SCOCK":
case "SACOCK":
uses_adv = !( get_campground() contains $item[bartender-in-the-box] || get_campground() contains $item[clockwork bartender-in-the-box] ) ;
break ;
case "COOK_FANCY":
case "PASTA":
case "SAUCE":
case "SSAUCE":
case "DSAUCE":
case "TEMPURA":
uses_adv = !( get_campground() contains $item[chef-in-the-box] || get_campground() contains $item[clockwork chef-in-the-box] ) ;
break ;
}
currently_considering[itm] = true ;
if ( uses_adv == false )
foreach ingred in get_ingredients(itm) {
if ( !currently_considering[ingred] && uses_advs(ingred) )
return true ;
}
remove currently_considering[itm] ;
return uses_adv ;
}