Bug [PATCH] Track dieting pill and apply fullness calculations to food

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
This tracks dieting pills and temporarily updates the fullness of consumables to double when appropriate. It's quite a complicated bit of code to touch, but I've tested everything I wrote and it seems to work well.
 

Attachments

  • dieting.patch
    6.5 KB · Views: 27

lostcalpolydude

Developer
Staff member
I think this will incorrectly double adventures from variable items like astral hot dogs (and s'mores, for an easier to test option)? That seems complicated to avoid.

It also looks like it would decrement dietingPillsUsed to negative values if you multi-eat 4 of something but have only used 2 dieting pills (an easy fix).
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
I think this will incorrectly double adventures from variable items like astral hot dogs (and s'mores, for an easier to test option)? That seems complicated to avoid.

Good point, this occurred to me as well today. I'll look into it.


It also looks like it would decrement dietingPillsUsed to negative values if you multi-eat 4 of something but have only used 2 dieting pills (an easy fix).

Ah I thought that decrement without specifying a minimum defaults to 0. I'll fix that!
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Yeah as far as I can see, decrement with only the pref name will not go lower than 0

Code:
	public static final int decrement( final String name )
	{
		return Preferences.decrement( name, 1 );
	}

	public static final int decrement( final String name, final int delta )
	{
		return Preferences.decrement( name, delta, 0 );
	}

	public static final int decrement( final String name, final int delta, final int min )
	{
		int current = Preferences.getInteger( name );
		if ( delta != 0 )
		{
			current -= delta;

			if ( current < min )
			{
				current = min;
			}

			Preferences.setInteger( name, current );
		}
		return current;
	}

I wrote an "isVariable" function for handling the rest, although when trying to populate it I realised I don't know what happens if you eat a steel lasagne with dieting pill active.
 

Attachments

  • dieting.patch
    7.2 KB · Views: 27

Veracity

Developer
Staff member
Bumping a thread with a supplied patch.
I have no idea what a dieting pill is, so can't really review it welll...
 

fronobulax

Developer
Staff member
I wrote an "isVariable" function for handling the rest, although when trying to populate it I realised I don't know what happens if you eat a steel lasagne with dieting pill active.

Patch failed for me. Probably need to regenerate it. Also is the concern about steel lasagna important enough to defer until it is understood?
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Sadly I just haven't got the time to make this work right now :(
 

taltamir

Member
Thank you for that patch @gausie

Speaking of, you can stack multiple uses of dieting pills, and this can screw you over if you end up with fullness of 1 less than your max. Because if you have 14/15 fullness and an active dieting pill? you simple can't eat anything to fill that last slot. Because any size 1 food is doubled to being size 2.

I think the best way to handle this is a pair of changes:
1. don't allow stacking more than 1 active dieting pill. If someone tries to chew a dieting pill while one is already active, fail with a message saying to use their current one first.
2. don't allow chewing a dieting pill if your current stomach is 1 less than your max stomach.

Bumping a thread with a supplied patch.
I have no idea what a dieting pill is, so can't really review it welll...
dieting pill is a 3 spleen chewable that causes the next food item you eat to cost double size, and double its base adventures and stat gains (things that enhance its gains are not doubled... mostly I think).

It is exceptionally useful in Vampyre runs. Where you get 5+2 blood bags normally (normally being with no IOTMs).
You craft 3 blood sponge cakes and 4 vampagne.
Then you use 2 dieting pills a day to double two of your blood sponge cakes, so that the 3 together give you 5/5 stomach. And it gives you +46 adv a day.
Then you drink your 4 ampagnes to get 4/4 liver. If you are in softcore you can pull a 5th one for nightcap.
 
Last edited:
Top