Bug - Fixed Unknown monster do not have unknown monster stats!

Bale

Minion
When we have not spaded the stats for a monster they are listed in mafia's data as 0. This is right and proper.

When mafia encounters and unknown monster, it creates stats for that monster so that consult scripts can handle it. Unfortunately those stats are listed as 1. This means that the consult script cannot tell if the stats are unknown since they differ from unknown stats.

In case you're thinking that the consult script could consider stats of 1 as unknown if should be pointed out that there are monsters with stats of 1, particularly if you equip Space Trip safety headphones.

Also, this 1 is modified by ML bonus, unlike the 0 for unknown monster stats. Troublesome.
 

Veracity

Developer
Staff member
When mafia encounters and unknown monster, it creates stats for that monster so that consult scripts can handle it. Unfortunately those stats are listed as 1.
How odd. From MonsterTracker.java:

Code:
		if ( MonsterStatusTracker.monsterData == null )
		{
			// Temporarily register the unknown monster so that
			// consult scripts can see it as such	
			MonsterStatusTracker.monsterData = MonsterDatabase.registerMonster( monsterName );
		}
From MonsterDatabase.java:

Code:
	// Register an unknown monster
	public static final MonsterData registerMonster( final String name )
	{
		MonsterData monster = MonsterDatabase.registerMonster( name, "" );
		MonsterDatabase.MONSTER_DATA.put( name, monster );
		return monster;
	}
That "" String is what would normally have "HP: x Atk:y" and so on in it. In the new MonsterData it created with the null string, HP, Attack, and so on should end up being null - which make getHP, getAttack, and so on return 0, without regards to ML.

I tried a test.

I commented out the Knob Goblin Elite Guard, the Off-Duty Knob Goblin Elite Guard, and the Swarm of Knob Lice - all three monsters from the barracks.
I stuck in a print message from MonsterStatusTracker.
I built a .jar file.
I adventured in the Barracks.

[303816] Cobb's Knob Barracks
Encounter: Knob Goblin Elite Guard
New monster: knob goblin elite guard HP = 0 Atk = 0 Def = 0
...
[303817] Cobb's Knob Barracks
Encounter: off-duty Knob Goblin Elite Guard
New monster: off-duty knob goblin elite guard HP = 0 Atk = 0 Def = 0
...
[303819] Cobb's Knob Barracks
Encounter: swarm of Knob lice
New monster: swarm of knob lice HP = 0 Atk = 0 Def = 0
I don't see a bug.
 

Veracity

Developer
Staff member
Ah ha! The bug is actually in the monster_attack() function and its friends.

Code:
	public static final int getMonsterAttack()
	{
		if ( MonsterStatusTracker.monsterData == null )
		{
			return 0;
		}

		return Math.max( MonsterStatusTracker.monsterData.getAttack() +
			MonsterStatusTracker.attackModifier, 1 );
	}
Looks like that Math.max (and the attack modifier) should only be applied in the base attack is non-zero.
 

Bale

Minion
Thank you for continuing to look into this after finding your first answer. I love you right now!
 
Top