Bug - Fixed Some missing restore information

zarqon

Well-known member
I've been working on and off on a restore script, and in the process have found some places where my data (which is compiled from mafia, UR, and the Wiki) and mafia's don't match:

> 1up test

156 healing options loaded.
HP mismatch for aspirin: 1up says 101 and mafia says 0
HP mismatch for personal massager: 1up says 9 and mafia says 0
HP mismatch for plump juicy grub: 1up says 95 and mafia says 0
MP mismatch for delicious shimmering moth: 1up says 35 and mafia says 0
HP mismatch for whimpering willow bark: 1up says 31 and mafia says 539
HP mismatch for Texas tea: 1up says 30 and mafia says 0
MP mismatch for Texas tea: 1up says 30 and mafia says 0
MP mismatch for holy spring water: 1up says 50 and mafia says 45

Looks like some of them are just missing. The willow bark should be the lesser of 25% of your maxhp (the value shown above) and 50% of your currently possible healing. The holy spring water is a simple discrepancy between the Wiki's and mafia's data.

I've also found that the pixel orb does not seem to be tracked as a 1/day item. Evidently Darzil added tracking for it in r13738, but I checked several characters and none of them have a _pixelOrbUsed property in their preferences files, and the dailyusesleft proxy field shows -1 rather than 1. Was tracking for this moved somewhere else perhaps?

That's it, thanks!
 

fronobulax

Developer
Staff member
_pixelOrbUsed does not seem to occur in any of the source files. Looking at the current code, _corruptedStardustUsed is set if either the orb or stardust is used. Between r13738 and now it seems that the preference was changed from a count to a boolean. Given that a trivial update made the orb and stardust one a day items, that makes sense. I will investigate but my hunch is that two separate preferences are needed and something got stepped on in the past six years :)
 

Veracity

Developer
Staff member
Bumping since frono fixed the tracking of the two items, but didn't say he'd added/fixed the missing restores.
 

fronobulax

Developer
Staff member
r19849 sort of. Untested.

I added a couple of items and changed values.

Unresolved are:
plump juicy grub item [90*effect(form of...bird!)] [100*effect(form of...bird!)] 0
delicious shimmering moth item 0 0 [30*effect(form of...bird!)] [40*effect(form of...bird!)] 0
whimpering willow bark item [floor(HP/4)] [floor(HP/4)] 0 0 0

The first two, if I understand the syntax, are going to return 0 unless KoLmafia thinks the character is in bird form when the restoration bounds are requested. So mafia may be correct unless 1up can simulate being in bird form.

I can't figure out whether the evaluation can distinguish between current and maximum HP. The expression could be
min(.25*maxHP, ,5(maxHP-curHP)) but I don't know the syntax.

I did not add the personal massager because it only heals if the character is beaten up. I suppose something like
8*effect(Beaten up) 10*effect(Beaten up) might work but again, I'd rather make a second edit with better knowledge of the syntax.
 

Veracity

Developer
Staff member
Looking at RestoreExpression:

Code:
		if ( this.optional( "HP" ) )
		{
			return "\u0085";
		}
		if ( this.optional( "MP" ) )
		{
			return "\u0091";
		}
Looking at Expression:

Code:
			case '\u0085':
				v = KoLCharacter.getMaximumHP();
				break;
			// Valid with RestoreExpression:
			case '\u0091':
				v = KoLCharacter.getMaximumMP();
				break;
If you wanted CURHP (or CURMP) you could add Unicode characters for those in Expression and function names for them in RestoreExpression
 

Veracity

Developer
Staff member
Revision 19876 adds CURHP function to RestoreExpression and fixes the expressions for whimpering willow bark.

I agree with your other comments, so this completes the work for this issue.

The expression you are looking for is:

[min(floor((HP-CURHP)/2),floor(HP/4))]
 

zarqon

Well-known member
I made the grub, moth, and massager healing (was this last one added -- or already present?) contingent on the relevant effect in my data file, and now the only discrepancy is the aspirin, which is not likely to ever be a big deal.

Thanks!
 
Last edited:

Veracity

Developer
Staff member
Ha. restores.txt has Aspirin listed but not aspirin. Case matters.
I'll include that in another submit, by and by.
 

Veracity

Developer
Staff member
Code:
plump juicy grub	item	[90*effect(form of...bird!)]	[100*effect(form of...bird!)]	0
delicious shimmering moth	item	0	0	[30*effect(form of...bird!)]	[40*effect(form of...bird!)]	0

The first two, if I understand the syntax, are going to return 0 unless KoLmafia thinks the character is in bird form when the restoration bounds are requested. So mafia may be correct unless 1up can simulate being in bird form.
According to modifiers.txt:

Code:
# Effect function: effect(text)
#	This returns the number of turns remaining of the effect uniquely matching text.
#	text can be the effect name or id
So those expressions are not correct; we need something which is 1 or 0 if you have or don't have the effect.

We don't have personal massager - which would also need a "have effect Beaten Up".

I'm going to reopen this.
 

zarqon

Well-known member
Yes, I used

Code:
item	3279	personal massager	9*min(1,effect(7))	0	cures Beaten Up
item	3356	plump juicy grub	95*min(1,effect(511))	0	
item	3357	delicious shimmering moth	0	35*min(1,effect(511))

in my data file.
 
Top