New Content - Implemented Tracking for Distention pill, Dog Hair pill

heeheehee

Developer
Staff member
Actually I just noticed this on the wiki:

* Your next consumption includes the message:

"You feel your stomach shrink back to normal size. "

We should check for that. Actually, that could completely obviate the need for a _distentionPillActive user preference.

But what if you have 10/15 full, use a pill, then try to eat a hell ramen? Will KoL let you do that?
 

heeheehee

Developer
Staff member
All right. Wasn't sure that was the case. Don't see any other reasons that we might need this preference, then.
 

roippi

Developer
KoL will NOT allow you to do that. It only lowers the fullness of the next item.

Won't it? I thought that it worked like:

Have 14 fullness and use pill, eat 2 fullness food = OK

Have 15 fullness and Use pill, eat 1 fullness food = NOT OK

There's so little spading on it that I'm just patching bits of hearsay together.
 

slyz

Developer
My understanding was that 1 fullness was restored after the food was eaten, so:
Have 14 fullness and use pill, eat 2 fullness food = NOT OK
 

roippi

Developer
This version gets rid of the _distentionPillActive user variable in favor of just parsing the "stomach shrink" message. More robust that way.

Code:
use 1 distention pill

use 1 munchies pill

eat 2 bat wing chow mein
You gain 27 Adventures
You gain 74 Mysteriousness
You lose some of an effect: Got Milk
You gain 27 Adventures
You gain 71 Magicalness
You lose some of an effect: Got Milk
Incrementing fullness by 9 instead of 10 because your stomach was distended.

Code:
Index: src/net/sourceforge/kolmafia/persistence/ConcoctionDatabase.java
===================================================================
--- src/net/sourceforge/kolmafia/persistence/ConcoctionDatabase.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/persistence/ConcoctionDatabase.java	(working copy)
@@ -621,7 +621,7 @@
 		int consumpt = ItemDatabase.getConsumptionType( id );
 
 		if ( c.getFullness() > 0 || consumpt == KoLConstants.CONSUME_FOOD_HELPER ||
-			id == ItemPool.MUNCHIES_PILL )
+			id == ItemPool.MUNCHIES_PILL || id == ItemPool.DISTENTION_PILL )
 		{
 			queuedChanges = ConcoctionDatabase.queuedFoodChanges;
 			queuedIngredients = ConcoctionDatabase.queuedFoodIngredients;
Index: src/net/sourceforge/kolmafia/swingui/widget/ListCellRendererFactory.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/widget/ListCellRendererFactory.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/swingui/widget/ListCellRendererFactory.java	(working copy)
@@ -243,6 +243,10 @@
 			
 			switch ( item.getItemId() )
 			{
+			case ItemPool.DISTENTION_PILL:
+				stringForm.append( "-1 full from next food eaten" );
+				break;
+
 			case ItemPool.MUNCHIES_PILL:
 				stringForm.append( "+1-3 adv from next food eaten" );
 				break;
Index: src/net/sourceforge/kolmafia/swingui/panel/UseItemDequeuePanel.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/panel/UseItemDequeuePanel.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/swingui/panel/UseItemDequeuePanel.java	(working copy)
@@ -251,8 +251,15 @@
 					return true;
 				}
 				break;
+				
+			case KoLConstants.CONSUME_USE:
+				if ( UseItemDequeuePanel.this.food &&
+					creation.getItemId() == ItemPool.DISTENTION_PILL )
+				{
+					return true;
+				}
+				break;	
 			}
-
 			return false;
 		}
 	}
Index: src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java	(working copy)
@@ -459,6 +459,17 @@
 					return super.isVisible( element );
 				}
 				
+			case KoLConstants.CONSUME_USE:
+				if ( !UseItemEnqueuePanel.this.food || 
+					creation.getItemId() != ItemPool.DISTENTION_PILL )
+				{
+					return false;
+				}
+				else
+				{
+					return super.isVisible( element );
+				}
+				
 			default:
 				return false;
 			}
Index: src/net/sourceforge/kolmafia/swingui/panel/ItemManagePanel.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/panel/ItemManagePanel.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/swingui/panel/ItemManagePanel.java	(working copy)
@@ -961,7 +961,8 @@
 					// are marked as expected.
 
 					isVisibleWithFilter = FilterItemField.this.other;
-					if ( name.equalsIgnoreCase( "milk of magnesium" ) || name.equalsIgnoreCase( "munchies pills" ) )
+					if ( name.equalsIgnoreCase( "milk of magnesium" ) || name.equalsIgnoreCase( "munchies pills" ) 
+								|| name.equalsIgnoreCase( "distention pill" ) );
 					{
 						isVisibleWithFilter |= FilterItemField.this.food;
 					}
Index: src/net/sourceforge/kolmafia/objectpool/ItemPool.java
===================================================================
--- src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(working copy)
@@ -1260,6 +1260,7 @@
 	public static final int HONEYPOT = 5145;
 	public static final int SPOOKY_LITTLE_GIRL = 5165;
 	public static final int SYNTHETIC_DOG_HAIR_PILL = 5167;
+	public static final int DISTENTION_PILL = 5168;
 	public static final int TRANSPORTER_TRANSPONDER = 5170;
 	public static final int RONALD_SHELTER_MAP = 5171;
 	public static final int GRIMACE_SHELTER_MAP = 5172;
Index: src/net/sourceforge/kolmafia/request/UseItemRequest.java
===================================================================
--- src/net/sourceforge/kolmafia/request/UseItemRequest.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/request/UseItemRequest.java	(working copy)
@@ -439,6 +439,19 @@
 			}
 			UseItemRequest.limiter = "daily limit";
 			return Preferences.getBoolean( "_syntheticDogHairPillUsed" ) ? 0 : 1;
+			
+		case ItemPool.DISTENTION_PILL:
+			boolean stomachAvailable = ( KoLCharacter.getFullnessLimit() - KoLCharacter.getFullness() ) > 0;
+			
+			//The distention pill is not usable when you're full.
+			//Even if you plan on eating a 1-full food.
+			if ( !stomachAvailable )
+			{
+				UseItemRequest.limiter = "remaining fullness";
+				return 0;
+			}
+			UseItemRequest.limiter = "daily limit";
+			return Preferences.getBoolean( "_distentionPillUsed" ) ? 0 : 1;
 
 		case ItemPool.BURROWGRUB_HIVE:
 			UseItemRequest.limiter = "daily limit";
@@ -1767,6 +1780,26 @@
 			return;
 		}
 
+		// If we ate a distention pill, the next thing we eat should
+		// detect the extra message and decrement fullness by 1.
+		if ( responseText.indexOf( "feel your stomach shrink" ) != -1 )
+		{
+			int fullness = ItemDatabase
+					.getFullness( item.getName() );
+			int count = item.getCount();
+
+			// If we got this message, we definitely used a pill
+			// today.
+			Preferences.setBoolean( "_distentionPillUsed", true );
+			Preferences.increment( "currentFullness", -1 );
+			String message = "Incrementing fullness by " + ( fullness * count - 1 )
+					+ " instead of " + ( fullness * count )
+					+ " because your stomach was distended.";
+			RequestLogger.updateSessionLog( message );
+			RequestLogger.printLine( message );
+			KoLCharacter.updateStatus();
+		}
+
 		// Check to make sure that it wasn't a food or drink
 		// that was consumed that resulted in nothing. Eating
 		// too much is flagged as a continuable state.
@@ -3206,6 +3239,22 @@
 				ConcoctionDatabase.getUsables().sort();
 			}
 			return;
+			
+		case ItemPool.DISTENTION_PILL:
+			
+			//Your stomach feels rather stretched out
+			if ( responseText.indexOf( "stomach feels rather stretched" ) != -1 )
+			{
+				Preferences.setBoolean( "_distentionPillUsed", true );
+				ConcoctionDatabase.getUsables().sort();
+			}
+			else if ( responseText.indexOf( "stomach can't take any more abuse" ) != -1 )
+			{
+				Preferences.setBoolean( "_distentionPillUsed", true );
+				KoLCharacter.updateStatus();
+				ConcoctionDatabase.getUsables().sort();
+			}
+			return;
 
 		case ItemPool.MILK_OF_MAGNESIUM:
 
Index: src/data/defaults.txt
===================================================================
--- src/data/defaults.txt	(revision 9485)
+++ src/data/defaults.txt	(working copy)
@@ -661,6 +661,7 @@
 user	_chipBags	0
 user	_crimboTree	false
 user	_deluxeKlawSummons	0
+user	_distentionPillUsed	false
 user	_fingertrapArrows	0
 user	_gapBuffs	0
 user	_gibbererAdv	0

While helpers could use refactoring, I feel okay with this for now.
 

roippi

Developer
More testing, looks to be working fine. Even when I screw up and don't have enough HP to use a fork.

Code:
Using cached search results for bat wing chow mein...
Purchasing bat wing chow mein (2 @ 4,850)...
You acquire bat wing chow mein (2)
Purchases complete.
Using 1 distention pill...
Finished using 1 distention pill.
Helper queued for next 1 food eaten.
Casting Cannelloni Cocoon 1 times...
You gain 28 hit points
Cannelloni Cocoon was successfully cast.
Unable to gain enough HP to survive the use of this helper.

> outfit scaling

Putting on outfit: scaling
Equipment changed.

> recover hp

Casting Cannelloni Cocoon 1 times...
You gain 825 hit points
Cannelloni Cocoon was successfully cast.
Helper queued for next 1 food eaten.
Eating bat wing chow mein (1 of 3)...
You lose 1,000 hit points
You gain 34 Adventures
You gain 92 Mysteriousness
You lose some of an effect: Got Milk
Incrementing fullness by 4 instead of 5 because your stomach was distended.
Eating bat wing chow mein (2 of 3)...
You gain 30 Adventures
You gain 71 Enchantedness
You lose some of an effect: Got Milk
 
Top