Equipment Attributes

me259259

Member
Is there a function that tells you the effects of a piece of equipment that you're wearing? Effects like +moxie or +hot_damage?

I'm in the middle of writting a number of scripts for myself. The two that are giving me trouble (today) are my "Dress for Success" script, and my Combat Script. I'm writing logic to handle the myst classes. Now, what I want to do is to just use the maximizer function to maximize spell damage. While that works for the DfS script, this won't work for my CS script. In the CS, I want to use as little mp as possible, which means I'll have to figure out how much damage spells can be expected to do to pick the combination that requires the least MP and still kill the monster.

I was just about to make a complicated map of every item that you might run across in a HC or Badmoon ascension, something like:

PHP:
item [int, int, int, int, int, int, float, slot] bonusSpellDamage

where int, int, int, int, int, int, float represent +hot, +spooky, +cold, +sleaze, +stench, +untyped, +spellDamage%increasers respectively. But that's going to take awhile and be somewhat tedious. So before I do all of that, I want to make sure that mafia doesn't have a feature that does something like this.

So... Is there a function that tells you the effects of a piece of equipment that you're wearing?
 

Alhifar

Member
numeric_modifier(item,string) does exactly what you want. For example,
Code:
ash numeric_modifier( $item[flaming crutch] , "Hot Damage" );
in the CLI returns 3.0
 

Bale

Minion
I was just about to make a complicated map of every item that you might run across in a HC or Badmoon ascension, something like:

PHP:
item [int, int, int, int, int, int, float, slot] bonusSpellDamage

where int, int, int, int, int, int, float represent +hot, +spooky, +cold, +sleaze, +stench, +untyped, +spellDamage%increasers respectively.

Obviously now you don't have to do that, but if you ever consider something like that again, I'd like to recommend a different datatype. You should really use a map of records. All the goodness with greater ease of access.
 

me259259

Member
Ah, thank you! Two quick question though. How would you ask it for %-based bonus spell damage? And if I just say "spell damage", will it know only to look for untyped spell bonus damage, or will it look for all kinds of bonus spell damage?

As for records... I don't quite get records. It's above my coding competence right now. I understand that a record allows you to create a new datatype. But I don't understand how to use them, or how they're useful. I looked at the data structures wiki page, but I'm still kind of in the dark. I'm still temped to make my giant complicated map to determine when or if to craft bonus-spell-damage equipment. If you would give a small example of how to use records in this situation, I would greatly appreciate it.
 

Alhifar

Member
Use "Spell Damage Percent"

modref gives you a complete list of modifiers that can be used with the x_modifier() functions
 

slyz

Developer
I'm not really sure how you wanted to use your
PHP:
item [int, int, int, int, int, int, float, slot] bonusSpellDamage
map, but a record could look like this:
PHP:
record bonusSpellDamageEntry
{
	int hot;
	int spooky;
	int cold;
	int sleaze;
	int stench;
	int untyped;
	int spellDamagePercent;
};

bonusSpellDamageEntry get_info( item it )
{
	bonusSpellDamageEntry res;
	res.hot = numeric_modifier( it, "Hot Spell Damage" );
	res.spooky = numeric_modifier( it, "Spooky Spell Damage" );
	res.cold = numeric_modifier( it, "Cold Spell Damage" );
	res.sleaze = numeric_modifier( it, "Sleaze Spell Damage" );
	res.stench = numeric_modifier( it, "Stench Spell Damage" );
	res.untyped = numeric_modifier( it, "Spell Damage" );
	res.spellDamagePercent = numeric_modifier( it, "Spell Damage Percent" );
	return res;
}

bonusSpellDamageEntry [ item ] bonusSpellDamage;
bonusSpellDamage[ $item[ imp unity ring ] ] = get_info( $item[ imp unity ring ] );

print( bonusSpellDamage[ $item[ imp unity ring ] ].hot );
 
Top