That looks... way more complicated than it needs to be.
First, you are using 'else if', so it will stop after the first check that evaluates true. So if you have a time shifting weirdness, and not a hand+time sword, it will stop there.
Second, Mafia can maximize with familiars too, if you tell it to.
Try this:
PHP Code:
print ("Maxamizing turn count... This might take a moment, we have a lot to check...", "Blue");
if($item[li'l unicorn costume].available_amount()==0 && have_familiar($familiar[Trick-or-Treating Tot])) {
buy(1,$item[li'l unicorn costume]);
}
maximize("adv, +switch Disembodied Hand, +switch Trick-or-Treating Tot", false);
print("Finished checking for rollover adventures.", "green");
edit: triple ninja'ed!