record fspecials {
familiar fam; // which familiar causes the event
int count; // how many times it happens daily
};
fspecials[int] init_familiar_events() {
int nextchoice;
fspecials[int] listing;
foreach fam in $familiars[green pixie, li'l xenomorph, baby sandworm, astral badger, llama lama, mini-hipster, bloovian groose, blavious kloop, pair of stomping boots, rogue program]
{
if (!have_familiar(fam)) continue;
nextchoice = count(listing);
switch(fam)
{
case $familiar[green pixie]:
if (have_effect($effect[absinthe-minded]) > 0) continue;
listing[nextchoice].count = to_int(get_property("_absintheDrops"));
break;
case $familiar[li'l xenomorph]:
listing[nextchoice].count = to_int(get_property("_transponderDrops"));
break;
case $familiar[baby sandworm]:
listing[nextchoice].count = to_int(get_property("_aguaDrops"));
break;
case $familiar[astral badger]:
listing[nextchoice].count = to_int(get_property("_astralDrops"));
break;
case $familiar[llama lama]:
listing[nextchoice].count = to_int(get_property("_gongDrops"));
break;
case $familiar[mini-hipster]:
listing[nextchoice].count = to_int(get_property("_hipsterAdv")) - 2;
break;
case $familiar[bloovian groose]:
listing[nextchoice].count = to_int(get_property("_grooseDrops"));
break;
case $familiar[blavious kloop]:
listing[nextchoice].count = to_int(get_property("_kloopDrops"));
break;
case $familiar[pair of stomping boots]:
listing[nextchoice].count = to_int(get_property("_pasteDrops"));
break;
case $familiar[rogue program]:
listing[nextchoice].count = to_int(get_property("_tokenDrops"));
break;
default:
break;
}
listing[nextchoice].fam = fam;
}
return listing;
}
boolean fam_check() {
// first, enforce 100% runs
if (to_familiar(vars["is_100_run"]) != $familiar[none]) {
if (my_familiar() != to_familiar(vars["is_100_run"])) return use_fam(to_familiar(vars["is_100_run"]));
return vprint("Not swapping familiar; is_100_run setting is set to "+my_familiar(),9);
}
// farm familiar items if set (and not auto-taming)
if (!to_boolean(vars["bbb_famitems"]) || to_familiar(excise(get_property("taming"),"|","")) != $familiar[none]) return true;
fspecials[int] dfams = init_familiar_events();
foreach f,d in dfams if (my_familiar() == d.fam && d.count < 5) return use_fam(d.fam);
foreach f,d in dfams if (d.count < 5) return use_fam(d.fam);
return true;
}