U2 Hotel Clerk Fix

Another quality-of-life fix coming in the next Ultima 2 Upgrade is a change to the Hotel California clerk. Players eventually learn they should go to the clerk and offer gold. In exchange the clerk will raise a random stat by 4 points per 100 gold offered. However, players may notice that the clerk will sometimes not raise their stats but take your money anyway. The common workaround is to begrudgingly reload the game so as to not lose hard-earned gold. Players will then simply retry-and-reload as needed until a stat is raised. In v2.0 I’ve ensured the clerk will always simply raise a random stat and never just pocket your gold.

This is the assembly code in Ultima 2 that determines whether you get a stat boost or not:

call 5217     ; gets random number in al
and al,07     ; constrain to value 0-7
cmp al,06     ; compare al to 6
jb 3d8a       ; if al < 6, jump to stat boost logic
jmp 3cb6      ; otherwise (values 6 or 7), you get robbed

What’s happening here is that the game is using a random number between the values of 0-7 to determine the stat id. Since there are six stats, only values 0-5 are needed. But if you get a value of 6 or 7 you are out of luck and the clerk says the dreaded “Thank you very much!”.  So you essentially have a 75% chance of a stat upgrade. It does seem a bit unfortunate that the only reason for the 25% failure rate is because of the choice of logic used here.

I’ve changed this so that the random number is always generated using modulo. So, stat = rand % 6, which is essentially the remainder of a division operation.

call 5217     ; gets random number in al
mov ah,00     ; widen value to 16 bits
mov cl,06     ; divisor = 6
div cl        ; al = rand/6, ah = remainder
mov al,ah     ; use remainder for stat id

This fix ensures the clerk will never just pocket your gold and a stat will always be raised.

Ultimately, a better solve to this problem would be to allow the player to pick which stat they want raised for their money, which is something that’s done in nearly every Ultima game since. But that has a much greater complexity and will have to wait for now.

Leave a Reply

Your email address will not be published. Required fields are marked *