New Content - Implemented Hidden City revamp

Patch applied in 12507. I added an effect on for one of the items. I thought about changing Once-Cursed for cursed punch since it actually "upgrades" the curse level, but I couldn't think of a better way to describe it.
 
Any of the curses do the same thing, right? 1 to 2, 2 to 3, 3 just keeps getting an extra 10 turns. Or are there some parts that behave differently?
 
Twice-Cursed is -20 to all stats, and Thrice-Cursed is -30 to all stats. It's minor enough that the comment is plenty descriptive enough.
 
My question was, is it something where different +curse modifiers (shaman/elevator/drink) all just do +curse in the same way, or are any of them different?
 
Hope it's good, mostly tested, but ran out of eligible characters

Patch adds spoilers to choice non-combats, removes stone spheres when you get stone triangles, removes 1, 2, 5, 6-balls when you get buffs.

Stuff that isn't handled yet, because I'm still learning :
Remove 4 stone triangles when you defeat Protector Spectre.
Remove McClusky File (complete) when you encounter 'boss' (First line is "You step into the boss's office and up to the giant mahogany desk"), rather than when you defeat him, and capture this fact and use it to create correct spoilers. Currently spoilers would be incorrect if you fight and lose (as the first is based on whether you have complete file, should be complete file or unlocked boss, second is based on if you have binder clip or complete file, should be binder clip, complete file or unlocked boss).
 
Last edited:
Ok, patch should now handle those, had to create a preference to handle the McClusky unlock, as it happens on fight start, and cannot be identified from inventory. They need testing, as I had it complete on all three of my characters from earlier stuff and initial spading.

I haven't removed them, but I suspect Hidden City mapping is now entirely irrelevant, so can be removed. Not sure how important sphere identification is any more.

This first proper patch has touched more files than I expected I'd need to when I started!
 

Attachments

There is a lot of code that we can REMOVE from KoLmafia because of this. Probably all of HiddenCityRequest, as well as everything to do with identifying stone spheres in combat, the settings to say which is which, AdventureResult.stoneSphereName, and so on.
 
From what I see so far, that patch mostly looks good, I just made a few whitespace changes, and I had to change "Hidden City" to "HiddenCity" in the ChoiceAdventure() constructor calls.

However, the result of that second parameter being
Code:
new String[] { "get 2 random items", "relocate pygmy janitors to Hidden Park", "", "", "", "skip adventure" }
is

HiddenCityChoices.png

I don't actually know what the solution for those empty lines is.
 
Hmm, interesting.

I guess we'll be seeing lots more of them now Jick plans to always have the leave option be option 6, so we'll have to handle them (unless it's just me doing something wrong. There is something similar in the Dreadsylvania ones too, but they display ok in the Choice Adventure panel.
 
Last edited:
There is no solution to those empty lines, if you go the simple way route of simply putting ChoiceAdventure objects in ChoiceManager.CHOICE_DATA. I ran into that myself when I wanted to put in the nine Dreadsylvania non-combats with values of 0 (for Show in Browser), 5 (use a ghost pencil), and 6 (skip). The issue is that for choices constructed from CHOICE_DATA, we have a very simple mapping between (0-based index in the dropdown) <-> value of choiceAdventureXXX.

Perhaps there is a way to construct a dropdown with objects other than Strings. Objects for which toString() would return the displayed string in the dropdown and some other method would get the associated value.

Actually, I suspect that would just work; the constructor we use for those dropdowns is this:

JComboBox(Object[] items)
Creates a JComboBox that contains the elements in the specified array.

We'd have to make the "options" field of ChoiceManager.ChoiceAdventure and ChoiceManager.ChoiceSpoiler be an array of Object, not an array of String and change all that that implies.

tl;dr: in order to avoid the empty lines, you either need to have custom handling of the dropdowns (as I did with the Dreadsylvania noncombats) or enhance the code in ChoiceManager to allow the array of options to be something other than an array of strings.
 
Tell you what. I'll see what I can whip up in the way of a refactoring to allow this. Stay tuned.
 
Sounds like a plan, as Jick looks like he's planning to make this the default style in future.

Will probably look at some special handling tomorrow for some choices I guess anyway. Like for Apartment Building pick Boss if Thrice-Cursed, else get Curse. For Office Building pick Boss if not got Full Binder, else get Binder clip. For altars Unlock or put Sphere.
 
Tell you what. I'll see what I can whip up in the way of a refactoring to allow this. Stay tuned.

Cool. I never really understood the ChoiceManager code, I mostly copied the format for existing items, so I don't actually understand how changing options from Strings to Objects helps.
 
Well... perhaps it is time for you to learn, since I will have to renege on my offer, since I have no time. Consider this class:

Code:
	public static class Option
	{
		private final String name;
		private final int option;

		public Option( final String name, final int option )
		{
			this.name = name;
			this.option = option;
		}

		public String getName()
		{
			return this.name;
		}

		public int getOption()
		{
			return this.option;
		}

		public String toString()
		{
			return this.name;
		}
	}

You could define a choice like this:

Code:
		// Choice 725 is Tallest Tree in the Forest
		new ChoiceAdventure(
			"Dreadsylvania", "choiceAdventure725", "Tallest Tree",
			new String[] { "", "", "", "", "learn shortcut", "skip adventure" } ),
or like this:

Code:
		// Choice 725 is Tallest Tree in the Forest
		new ChoiceSpoiler(
			"Dreadsylvania", "choiceAdventure725", "Tallest Tree",
			new Option[] { new Option( "learn shortcut", 5 ), new Option( "skip adventure", 6) } ),
In both cases, you could pass the array to the constructor for JComboBox. In the first case, it would have 6 strings - the first 4 of which are empty - and then the two real options, at index 4 and 5 of the array. This is the "lots of blank lines" case. In the second case, it would have exactly two elements in the string - and they would be Option objects, not strings.

ChoiceOptionPanel takes the selectedItemIndex in the combox box and adds 1 to get the KoL choice decision. In the case of an array of Options, it would get the selectedItem - an Option object - and call getOption() on it to get KoL's choice decision.

Unfortunately, there is code in RequestEditorKit, ChoiceOptionsPanel, and ChoiceManager itself which assume that the "options" array is a non-sparse array of Strings, whereas the array of Option objects is, essentially, a sparse array of things which have a String - the spoiler - and an int - KoL's choice decision that it applies to.

I started looking at the various places that would be affected by this and it is just more time than I have right now to get them all to work correctly. Probably the correct set of helper functions in ChoiceManager to manipulate either a non-sparse array of Strings or a sparse array of Option objects would simplify it all, but that'd be at least an afternoon's project for me - and I don't have the time.

I will be happy to advise farther if you (or anyone) wants to tackle it. :)
 
Last edited:
I decided to create special non-combat options for this anyway, as automatically created ones could easily create loops in those non-combats which always appear, and several benefited from options that were do X if conditions Z, else Y sort of options.

The quest related ones aren't much tested, due to lack of characters at the right point of quests.

It needed some new preferences for tracking to make it work like this.
 

Attachments

Revision 12513 does the proposed refactoring of ChoiceAdventure objects. The "options" array can have either String or Option objects in it. The latter can specify a particular decision value or an item associated with taking that decision. If there is an associated item, the Relay Browser will give you the magnifying glass link to look at the description of the item and will tell you how many of the item you have in inventory.)

There might be bugs. If so, I expect the screams of anguish will come soon enough...
 
Fog Murderer showing as buyable without Hidden Tavern access

r12515

I am actively adventuring in the hidden city, but have not unlocked the hidden tavern. In the booze tab of the item manager, Fog Murderer is listed as a buyable drink for 500 meat. Attempting to use it got me the following gCLI:
Code:
Purchasing Fog Murderer (1 @ 500)...
Desired purchase quantity not reached (wanted 1, got 0)
You need 1 more Fog Murderer to continue.
 
Back
Top