Bug numeric_modifier for familiar

Grabuge

Member
I'm running r15454.

I was playing around and wasn't able to figure out why the leprechaun did not return any value for numeric_modifier "Leprechaun". So I tried some variations:

Code:
float PetGrouper = numeric_modifier( $familiar[Grouper Groupie], "Fairy", familiar_weight($familiar[Grouper Groupie]), $item[gill rings]);
print ("A Grouper Groupie is equal to a "+PetGrouper+"x weight Fairy.");

float PetDog = numeric_modifier( $familiar[Jumpsuited Hound Dog], "Fairy", familiar_weight($familiar[Jumpsuited Hound Dog]), $item[gill rings]);
print ("A Jumpsuited Hound Dog is equal to a "+PetDog+"x weight Fairy.");

float PetHobo = numeric_modifier( $familiar[Hobo Monkey], "Leprechaun", familiar_weight($familiar[Hobo Monkey]), $item[none]);
print ("A Hobo Monkey is equal to a "+Pethobo+"x weight Leprechaun.");

float PetLep = numeric_modifier( $familiar[Leprechaun], "Leprechaun", familiar_weight($familiar[Leprechaun]), $item[none]);
print ("A Leprechaun is equal to a "+PetLep+"x weight Leprechaun.");

float PetSom = numeric_modifier( $familiar[Hovering Sombrero], "Sombrero", familiar_weight($familiar[Hovering Sombrero]), $item[none]);
print ("A Hovering Sombrero is equal to a "+PetSom+"x weight Sombrero.");

float PetVol = numeric_modifier( $familiar[Blood-Faced Volleyball], "Volleyball", familiar_weight($familiar[Blood-Faced Volleyball]), $item[none]);
print ("A Blood-Faced Volleyball is equal to a "+PetSom+"x weight Volleyball.");

float PetLama = numeric_modifier( $familiar[Llama Lama], "Volleyball", 10, $item[none]);
print ("A Llama Lama is equal to a "+PetLama+"x weight Volleyball.");

returns :
A Grouper Groupie is equal to a 0.0x weight Fairy.
A Jumpsuited Hound Dog is equal to a 1.25x weight Fairy.
A Hobo Monkey is equal to a 1.25x weight Leprechaun.
A Leprechaun is equal to a 0.0x weight Leprechaun.
A Hovering Sombrero is equal to a 0.0x weight Sombrero.
A Blood-Faced Volleyball is equal to a 0.0x weight Volleyball.
A Llama Lama is equal to a 0.5x weight Volleyball.
 

Grabuge

Member
How would I check if my current familiar can act as a Fairy? I understand that I could check if "item drop" returns a value and make the int from there but in my mind, "Fairy" should return a value. In this case I understand that the Grouper Groupie returns 0, it isn't a Leprechaun.


Code:
float PetGrouper = numeric_modifier( $familiar[Grouper Groupie], "Leprechaun", familiar_weight($familiar[Grouper Groupie]), $item[gill rings]);
print ("A Grouper Groupie is equal to a "+PetGrouper+"x weight Leprechaun.");

A Grouper Groupie is equal to a 0.0x weight Leprechaun.
 

Veracity

Developer
Staff member
Internally, mafia knows that 0 means 1 because there's no need to specify it.
Because internally we have a familiar database and can look up the familiar there. FamiliarDatabase.java:

Code:
	public static final boolean isCombatType( final int familiarId )
	{
		return FamiliarDatabase.combatById.get( familiarId );
	}

	public static final boolean isVolleyType( final int familiarId )
	{
		return FamiliarDatabase.volleyById.get( familiarId );
	}

	public static final boolean isSombreroType( final int familiarId )
	{
		return FamiliarDatabase.sombreroById.get( familiarId );
	}

	public static final boolean isFairyType( final int familiarId )
	{
		return FamiliarDatabase.fairyById.get( familiarId );
	}

	public static final boolean isMeatDropType( final int familiarId )
	{
		return FamiliarDatabase.meatDropById.get( familiarId );
	}
We could manually add "Volleyball: 1.0" to all familiars that familiars.txt says are stat0 (and similarly for Fairy, Leprechaun, and Sombrero for item0, meat0, and stat1 familiars).

Alternatively (or additionally), we could add familiar proxy fields to access the above methods - just as we currently have .combat to return the result of isCombatType().
 
Top