Little discovery here.
I was trying to fix the little (sort of) oddity in TfW whereby the entire stock of Job Cards would be wiped out when using one.
Well, this was happening because I was using the "remove item from inventory" instruction, which removes all of one inventory instance of an item (so if you have 2 x 99 of item XX, you will lose 99 of them). The thing is, I was using that because I thought I
had to, because otherwise the item wouldn't go away at all.
But here's the catch - in TfW, the Job Card replaces the Troia Pass. Turns out, there's a special case exception in the "Open Item Window Searching for XX" event instruction routine that skips over the part of the routine that reduces the inventory by one. You therefore get to keep your Troia pass for repeated use. It's also entirely possible to change which item has the special case exception, so maybe you want to keep the Legend sword instead, or (yay, cheating!) keep your Pink Tail. All you have to change is one byte.
In ROM without header:
00/6B3E C9 EC CMP #$EC; compare A to EC (Pass)
Just change that EC to the item # of whichever Item you want to keep upon use.
But wait - there's more!
Turns out we never really needed that single special case instruction for item EC at all, because a few opcodes later, we have this:
00/6B46 C9 ED CMP #$ED; Compare A to ED (the next item after the Pass, whatever it is)
00/6B48 B0 18 BCS $18; If it is that or higher, skip the -1 portion if the routine
So all we have to do is change that ED to EC, and then that part of the routine includes the Pass, and we can comfortably change the routine to make an exception for a different item without losing the Pass.
Or, in my case, I can wedge in a subroutine jump where that Pass exception was!
