Feature Items can have multiple Effects or Rollover Effects

Veracity

Developer
Staff member
Turns out we were parsing only Rollover Effect Duration - even though we had the pattern for Rollover Effect, too - because both modifiers came from the same blue "enchantment". Revision 17599 gets both modifiers.

Both rollover effects - and both rollover effect durations - are listed for Uncle Crimbo's hat. For good measure, I changed the marzipan skull to reflect that you actually get three enchantments from it, not just Sugar Rush.

Not that it does much good:

Code:
[color=green]> ash effect_modifier( "marzipan skull", "Effect" ).to_string()[/color]

Returned: Sugar Rush

[color=green]> ash string_modifier( "marzipan skull", "Modifiers" ).to_string()[/color]

Returned: Effect: "Sugar Rush", Effect Duration: 5, Effect: "Hardly Poisoned at All", Effect Duration: 5, Effect: "Hombre Muerto Caminando", Effect Duration: 5

[color=green]> ash effect_modifier( "Uncle Crimbo's Hat", "Rollover Effect" ).to_string()[/color]

Returned: The Spirit of Crimbo

[color=green]> ash string_modifier( "Uncle Crimbo's Hat", "Modifiers" ).to_string()[/color]

Returned: Adventures: +4, Rollover Effect: "The Spirit of Crimbo", Rollover Effect Duration: 100, Rollover Effect: "Crimbo Nostalgia", Rollover Effect Duration: 100
The data is available to you, but we only store a single effect name - the first listed - as the "Effect" or "Rollover Effect" modifier.

I wonder how many other items grant multiple Effects?
 

heeheehee

Developer
Staff member
I wonder how many other items grant multiple Effects?
Quite a few, it seems.

I did a search for items with at least one effect that had "You acquire an effect" show up multiple times on their corresponding wiki pages, then did a quick manual pass. There seem to be a few categories of items that grant multiple effects -- those that grant multiple effects all the time, those that randomly grant an effect from a fixed pool, and those that grant effects conditionally.

Code:
patchouli incense stick
[I]Yummy Tummy bean -- yields sugar rush and a random effect (from a pool)[/I]
Rock Pops
Senior Mints
Now and Earlier
Sugar Cog
sugar-coated pine cone
Angry Farmer's Wife Candy
seal eyeball
turtle soup
evil vihuela
evil potion of potency
evil libation of liveliness
evil tomato juice of powerful power
evil eyedrops of the ermine
evil ointment of the occult
evil serum of sarcasm
evil philter of phorce
Everlasting Deckswabber
dubious peppermint
children of the candy corn
Good 'n' Slimy
spooky sap
[I]elven suicide capsule -- yields one of three effects, randomly[/I]
Crimbo peppermint bark
Crimbo fudge
Crimbo candied pecan
queen cookie
myrrh-soaked, chocolate-covered bacon bath ball
Okee-Dokee soda
fish juice box
banana supersucker
pear supersucker
lime supersucker
kumquat supersucker
strawberry supersucker
beet-flavored Mr. Mediocrebar
sweet-corn-flavored Mr. Mediocrebar
cabbage-flavored Mr. Mediocrebar
[I]black tear - conditional on existing effects[/I]
[I]jagged tooth - conditional on existing effects[/I]
[I]grisly shell fragment - conditional on existing effects[/I]
Hot 'n' Scarys
eldritch elixir
 

Veracity

Developer
Staff member
I copied this to a new thread since its a new piece of work.

1) We should detect multiple Effect and Rollover Effect modifiers in item descriptions and retain that knowledge.
2) We should handle multiple Effect (and Rollover Effect)/Effect Duration pairs for items and retain that knowledge.
3) We should manually enter multiple (deterministic) effects, whether or not the item description lists them all, as researched by heeheehee.

I see the following code in ItemDatabase.registerItem()

Code:
		String effectName = Modifiers.getStringModifier( "Item", itemId, "Effect" );
		if ( !effectName.equals( "" ) && EffectDatabase.getEffectId( effectName, true ) == -1 )
		{
			String effectDescid = DebugDatabase.parseEffectDescid( rawText );
			String command =
				usage == KoLConstants.CONSUME_EAT ? "eat 1 " :
				usage == KoLConstants.CONSUME_DRINK ? "drink 1 " :
				usage == KoLConstants.CONSUME_SPLEEN ? "chew 1 " :
				"use 1 ";
			EffectDatabase.registerEffect( effectName, effectDescid, command + itemName );
		}

		// Equipment can have a Rollover Effect. Check for new effect.
		effectName = Modifiers.getStringModifier( "Item", itemId, "Rollover Effect" );
		if ( !effectName.equals( "" ) && EffectDatabase.getEffectId( effectName, true ) == -1 )
		{
			String effectDescid = DebugDatabase.parseEffectDescid( rawText );
			EffectDatabase.registerEffect( effectName, effectDescid, null );
		}
1) Note that it looks for only the single "Effect" and/or "Rollover Effect" that we store.
2) Note that DebugDatabase.parseEffectDescid( rawText ) assumes there will be a single descid - even though multiple effects can each have a link with a descid. That method could be augmented to also take the effect name and fetch the appropriate descid.

Would we be better off having a new type of Modifier - a "MultiString", say - or special handling for Effect and Rollover Effect? Probably the latter, since each such effect also has an associated Effect Duration.

I guess I see items as having two additional proxy fields:

effects - int [effect]
rollover_effects - int [effect]

With the "int" being the corresponding Effect Duration.
 
Top