New Content - Implemented unpowered Robortender

Veracity

Developer
Staff member
For amusement and/or education, here is some code I wrote to make use of lost's good work: the "_roboDrinks" setting and the "robo" command.

Code:
import <vprops.ash>;
Because, duh.

Code:
// *** Robortender********

// You can feed your Robortender up to five drinks per day.  They are
// selected from the list of drinks made with ingedients the Robortender
// harvests itself when you fight various kids of creatures. Each
// ingredient can make a basic drink with a weak effect and a more
// powerful drink with a stronger effect of the same sort. The effects
// do not stack; if given both a weak and a strong drink of the same
// sort, only the strong effect counts.
//
// The following are the allowed drinks, the monster phylum that drops
// the raw ingredient, and the effect when fed to the Robortender
//
// literal grasshopper		(Bugs) +3 Muscle stats per combat
// eighth plague		(Bugs) +5 Muscle stats per combat
// double entendre		(Constellations) +0.5 Fairy
// single entendre		(Constellations) +1.0 Fairy
// Phlegethon		        (Demons) Hot Damage during combat
// reverse Tantalus		(Demons) Hot Damage during combat
// Siberian sunrise		(Elementals) Cold Damage during combat
// elemental caipiroska		(Elementals) Cold Damage during combat
// mentholated wine		(Elves) Grant random candy sometimes
// Feliz Navidad		(Elves) Grant random candy more often
// low tide martini		(Fish) Familiar can breathe underwater
// Bloody Nora		        (Fish) Familiar can breathe underwater w/ +10 Familiar Weight
// shroomtini		        (Goblins) +3 Moxie stats per combat
// moreltini		        (Goblins) +5 Moxe stats per combat
// morning dew                  (Hippies) MP Restore
// hell in a bucket		(Hippies) MP Restore
// whiskey squeeze		(Hobos) Grant item from Refusal sometimes
// Newark		        (Hobos) Grant item from Refusal more often
// great old fashioned		(Horrors) Spooky Damage during combat
// R'lyeh		        (Horrors) Spooky Damage during combat
// Gnomish sagngria		(Humanoids) Physical Damage during combat
// Gnollish sangria		(Humanoids) Physical Damage during combat
// vodka stinger		(Mer-kin) Stench Damage during combat
// vodka barracuda		(Mer-kin) Stench Damage during combat
// extremely slippery nipple	(Orcs) HP Restore
// Mysterious Island iced tea	(Orcs) HP Restore
// piscatini		        (Penguins) +0.5 Leprechaun
// drive-by shooting		(Penguins) +1.0 Leprechaun
// Churchill		        (Pirates) Sleaze Damage during combat
// gunner's daughter		(Pirates) Sleaze Damage during combat
// soilzerac		        (Plants) +3 Mysticality stats per combat
// dirt julep		        (Plants) +5 Mysticality stats per combat
// London frog		        (Slimes) Blocks like a potato
// Simepore slime		(Slimes) Blocks like a potato
// nothingtini		        (Weird) Delevel by weight/2 sometimes
// Phil Collins		        (Weird) Delevel by weight/2 always
//
// If the Robortender is your configured farm_familiar, you can specify
// up to five drinks from the above list, separated by "|", to feed it.
// (no duplicates, no more than one per phylum)

boolean [item] robortender_drinks = define_property( "VMF.RoboDrinks", "item", "", "set" ).to_set_of_item();
Configure with a property. Hopefully, thoroughly documented.

Code:
// *** Robortender

record robodrink
{
    phylum source;		// Phylum of the monster that drops ingredient
    boolean strong;		// weak vs. strong effect
    string desc;		// description of effect
};

static robodrink [item] robodrinks = {
    $item[ literal grasshopper ] : new robodrink( $phylum[ bug ], false, "+3 Muscle stats per combat" ),
    $item[ eighth plague ] : new robodrink( $phylum[ bug ], true, "+5 Muscle stats per combat" ),
    $item[ double entendre ] : new robodrink( $phylum[ constellation ], false, "+0.5 Fairy" ),
    $item[ single entendre ] : new robodrink( $phylum[ constellation ], true, "+1.0 Fairy" ),
    $item[ Phlegethon ] : new robodrink( $phylum[ demon ], false, "Hot Damage during combat" ),
    $item[ reverse Tantalus ] : new robodrink( $phylum[ demon ], true, "Hot Damage during combat" ),
    $item[ Siberian sunrise ] : new robodrink( $phylum[ elemental ], false, "Cold Damage during combat" ),
    $item[ elemental caipiroska ] : new robodrink( $phylum[ elemental ], true, "Cold Damage during combat" ),
    $item[ mentholated wine ] : new robodrink( $phylum[ elf ], false, "Grant random candy sometimes" ),
    $item[ Feliz Navidad ] : new robodrink( $phylum[ elf ], true, "Grant random candy more often" ),
    $item[ low tide martini ] : new robodrink( $phylum[ fish ], false, "Familiar can breathe underwater" ),
    $item[ Bloody Nora ] : new robodrink( $phylum[ fish ], true, "Familiar can breathe underwater w/ +10 Familiar Weight" ),
    $item[ shroomtini ] : new robodrink( $phylum[ goblin ], false, "+3 Moxie stats per combat" ),
    $item[ moreltini ] : new robodrink( $phylum[ goblin ], true, "+5 Moxe stats per combat" ),
    $item[ morning dew ] : new robodrink( $phylum[ hippy ], false, "MP Restore" ),
    $item[ hell in a bucket ] : new robodrink( $phylum[ hippy ], true, "MP Restore" ),
    $item[ whiskey squeeze ] : new robodrink( $phylum[ hobo ], false, "Grant item from Refusal sometimes" ),
    $item[ Newark ] : new robodrink( $phylum[ hobo ], true, "Grant item from Refusal more often" ),
    $item[ great old fashioned ] : new robodrink( $phylum[ horror ], false, "Spooky Damage during combat" ),
    $item[ R'lyeh ] : new robodrink( $phylum[ horror ], true, "Spooky Damage during combat" ),
    $item[ Gnomish sagngria ] : new robodrink( $phylum[ humanoid ], false, "Physical Damage during combat" ),
    $item[ Gnollish sangria ] : new robodrink( $phylum[ humanoid ], true, "Physical Damage during combat" ),
    $item[ vodka stinger ] : new robodrink( $phylum[ mer-kin ], false, "Stench Damage during combat" ),
    $item[ vodka barracuda ] : new robodrink( $phylum[ mer-kin ], true, "Stench Damage during combat" ),
    $item[ extremely slippery nipple ] : new robodrink( $phylum[ orc ], false, "HP Restore" ),
    $item[ Mysterious Island iced tea ] : new robodrink( $phylum[ orc ], true, "HP Restore" ),
    $item[ piscatini ] : new robodrink( $phylum[ penguin ], false, "+0.5 Leprechaun" ),
    $item[ drive-by shooting ] : new robodrink( $phylum[ penguin ], true, "+1.0 Leprechaun" ),
    $item[ Churchill ] : new robodrink( $phylum[ pirate ], false, "Sleaze Damage during combat" ),
    $item[ gunner's daughter ] : new robodrink( $phylum[ pirate ], true, "Sleaze Damage during combat" ),
    $item[ soilzerac ] : new robodrink( $phylum[ plant ], false, "+3 Mysticality stats per combat" ),
    $item[ dirt julep ] : new robodrink( $phylum[ plant ], true, "+5 Mysticality stats per combat" ),
    $item[ London frog ] : new robodrink( $phylum[ slime ], false, "Blocks like a potato" ),
    $item[ Simepore slime ] : new robodrink( $phylum[ slime ], true, "Blocks like a potato" ),
    $item[ nothingtini ] : new robodrink( $phylum[ weird ], false, "Delevel by weight/2 sometimes" ),
    $item[ Phil Collins ] : new robodrink( $phylum[ weird ], true, "Delevel by weight/2 always" )
};

static item [phylum] strong_robodrinks;

static
{
    foreach it, data in robodrinks {
	if ( data.strong ) {
	    strong_robodrinks[ data.source ] = it;
	}
    }
}
The "database" of information about the drinks.

Code:
    if ( farm_familiar == ROBORTENDER ) {
	if ( default_famequip != NO_ITEM ) {
	    print( "VMF.FamiliarEquipment: '" + default_famequip + "' may not be the best item for your Robortender; ignoring." );
	    default_famequip = NO_ITEM;
	}

	boolean [ item ] drinks;
	item [ phylum ] phyla;
	boolean changed = false;

	// Validate that all drinks are in robodrinks (error if not)
	// Keep only strongest drink of each phylum (warning if both given)
	foreach drink in robortender_drinks {
	    if ( !( robodrinks contains drink ) ) {
		print( "VMF.RoboDrinks: '" + drink + "' cannot be fed to a Robortender; ignoring." );
		changed = true;
	    } else {
		// Create list of drinks, keeping only the strongest from a given phylum
		robodrink data = robodrinks[ drink ];
		phylum source = data.source;
		item old = phyla[ source ];
		if ( old == NO_ITEM ) {
		    phyla[ source ] = drink;
		    drinks[ drink ] = true ;
		} else if ( data.strong ) {
		    print( "VMF.RoboDrinks: '" + drink + "' is better than '" + old + "; keeping better drink." );
		    phyla[ source ] = drink;
		    remove drinks[ old ];
		    drinks[ drink ] = true;
		    changed = true;
		} else {
		    print( "VMF.RoboDrinks: '" + old + "' is better than '" + drink + "; keeping better drink." );
		    changed = true;
		}
	    }
	}

	if ( changed ) {
	    set_property( "VMF.RoboDrinks", drinks.to_string() );
	    robortender_drinks = drinks;
	}
    }
Since users can set properties to any old garbage, validate the property we need.

Code:
void lubricate_robortender()
{
    if ( farm_familiar != ROBORTENDER ) {
	return;
    }

    boolean [item] used = get_property( "_roboDrinks" ).to_set_of_item( "," );
    int available = 5 - count( used );

    // Can only use five drinks per day
    if ( available <= 0 ) {
	return;
    }

    boolean [item] use;

    // For each configured drink, if not already used, add to set of
    // drinks to use. Ignore if already have a stronger effect from the
    // same phylum.

    foreach drink in robortender_drinks {
	// If we already have used this drink, skip it.
	if ( used contains drink ) {
	    continue;
	}

	robodrink data = robodrinks[ drink ];

	// If this is a strong drink, it overrides the effect of a weak drink
	if ( data.strong ) {
	    use[ drink ] = true;
	    continue;
	}

	// This is a weak drink. If we have used the corresponding
	// strong drink already, skip this one.
	if ( !( used contains strong_robodrinks[ data.source ] ) ) {
	    use[ drink ] = true;
	}
    }

    // Acquire and feed drinks to the Robortender
    use_familiar( ROBORTENDER );

    foreach drink in use {
	if ( !retrieve_item( 1, drink ) ) {
	    print( "Unable to acquire and use drink '" + drink + "' to feed Robortender; skipping." );
	    continue;
	}

	robodrink data = robodrinks[ drink ];

	print( "Lubricating Robortender with '" + drink + "' to gain effect: " + data.desc );
	
	if ( cli_execute( "robo " + drink.name ) && --available == 0 ) {
	    break;
	}
    }
}
And the code that makes it so. Today, I got this:

Code:
Validating configuration.
VMF.FamiliarEquipment: 'ittah bittah hookah' may not be the best item for your Robortender; ignoring.
All is well!
Lubricating Robortender with 'single entendre' to gain effect: +1.0 Fairy
use 1 single entendre
Lubricating Robortender with 'drive-by shooting' to gain effect: +1.0 Leprechaun
use 1 drive-by shooting
Note that we logged it in the session log as simply "use", but it was actually fed to the Robortender.
I suppose that is unambiguous, in that they are booze and we otherwise would "drink" them.

Anyway, this was easy enough to put into an automation script. Seems like it's calling out for a Relay Script. :)
 

iaruk

New member
In case it is unclear from reading this, the command to have the Robortender drink is actually "robo", not "robodrink".
 

Darzil

Developer
Strangest thing about this familiar is definitely the two extra status effects per phylum that we know nothing about and don't appear to be implemented. Half of status effects 2198 to 2269 are unknown.

I wonder what had been intended but not implemented.
 
Top