As an Apple BASIC game, the source code is right on the disk image, and can be extracted with CiderPress.
Monster tablesThis was the first thing I looked for. Turns out the “table” looks like this:
Yeah, that’s it. No stats for HP, AC, damage, or any of the usual stuff I’d expect a monster table to have. This is not a very data-driven game. We’ll get into how those are generated later, but the rule is that the higher the row index, the tougher the monster.
This table is also used by Lord British to hand out quests. Your first quest is selected from this table, and after completing it, your next quest will always be the next monster on the list. In my playthrough, the first quest was a Carrion Crawler, followed by a Gremlin, Mimic, Daemon, and Balrog.
When entering a dungeon level, the game loops through the list of monsters. If (monster index – 2) is smaller than or equal to the dungeon level, then the monster has a 60% chance of spawning somewhere. So, on level 1, you might face skeletons, thieves, and giant rats. On level 8, you could hypothetically face all ten monsters, though in practice this will never happen thanks to the way the RNG works. The game will never spawn two monsters of the same type on the same level.
Player stats & combatYour difficulty affects the amount of HP the monsters get. That’s it.
A monster’s HP is (2 * monster index) + (2 * dungeon level * difficulty level).
Strength enhances your weapon damage. Each point adds 0.2 damage to the damage of a successful hit, and the sum is rounded down.
A note here – weapon damage is mislabeled. All weapons except amulets have a minimum of 0, not 1. That rapier that says it does 1-10 damage? The base damage range is actually 0-10, and it can indeed do 0 total damage if your strength bonus is low enough.
So let's say you have 23 strength and are wielding a rapier capable of 0-10 damage? With the +4.6 strength bonus, you'll inflict 4-14 damage on a successful hit.
You might wonder what the point of doing +4.6 bonus damage is, if damage is always rounded down. Base damage is always a floating point number. So your rapier with a range of 0-10 might do 5.5623 damage. With a bonus of 4.4, the sum would be 9.9623, and round down to 9. With a bonus of 4.6, it would be 10.1623, and round down to 10.
This strength bonus applies to thrown axes and bows too, but not amulets, which don’t care about strength.
You can attack with a shield too, for 0-1 damage, plus the strength bonus. Your fists do 0 base damage, plus strength bonus.
Dexterity decides your chance to hit an enemy. The formula is:
4% * (dexterity - monster index - dungeon level)
So let’s say you have 20 dexterity points, and are fighting a thief (index 2) on level 5. That’s a 52% chance of hitting.
Ranged weapons follow this code path too, including the amulet’s kill spell. Ranged weapons follow some additional logic that I don’t fully understand, but it does seem like they hit less often.
This also suggests that if your stamina isn’t high enough, beating the game may be impossible. You have to kill a balrog to win, they have a monster index of 10, and they don’t start appearing until dungeon level 9. What if your dexterity is 19 or less? You have no chance at all of hitting them.
Stamina decides your chance to avoid getting hit by an enemy. The formula is:
4% * (stamina - monster index - dungeon level)
This does not affect the chances of being pickpocketed by thieves and gremlins.
Wisdom is interesting. It determines your starting quest from Lord British. When you first visit, take your wisdom, divide by 3, and round down. That’s the monster index of your first quest. After that point, wisdom does nothing. When I had wisdom of 20, this evaluated to a monster index of 6, so I got sent to kill a carrion crawler.
This actually makes it beneficial to have LOW wisdom. With high wisdom, you’ll just be skipping the early easy quests, and won’t get the stat boost reward for completing them.
Also, if your wisdom is 33 or higher, then you’ll crash the game when getting your first quest, because the monster index of 11 (or higher) doesn’t exist. So, don’t transform into a lizard man until AFTER getting your first quest!
Amulet stuffWhen using an amulet as a mage, there’s a 25% chance the amulet gets destroyed.
As a fighter, one of the four spells is chosen randomly, with an equal chance for each spell. But the amulet will never be destroyed.
The Kill spell’s damage is always (10 + dungeon level). Whether it hits or not is determined by dexterity in the same manner as weapons.
The Bad? spell invokes one of three effects chosen randomly. Toad sets all of your stats to 3. Backfire halves your hitpoints. Lizard Man multiplies all of your stats by 2.5, rounded down.
More monster stuffThe gold reward for killing a monster is equal to its monster index plus the dungeon level.
The HP reward is stored in a variable called “LK.” Whenever you kill a monster, LK increases by this:
(monster index * dungeon level)/2
On exiting the dungeon, your HP increases by LK.
Monsters normally pursue you, but will flee instead if their HP drops below (dungeon level * difficulty level). A monster in flight status will attack if they cannot retreat.
Fleeing monsters’ HP will regenerate by (dungeon level + difficulty) on turns when they do not attack. When it rises above (dungeon level * difficulty) they will pursue again.
Mimics do not pursue when they are within 3 spaces of you.
ThieveryWhen gremlins and thieves attack, there is a 50% chance that they will steal instead. Stealing is always successful.
Thieves will randomly select one of six item types to steal (food, rapier, axe, shield, bow, amulet). If you have at least one, then you lose one. If you don’t, then the thief will try again until he picks something you do have. If you have no items and less than one food (a very probable occurrence early on), this can actually make the game lock up, as the thief endlessly rummages in your pockets looking for loot that you don’t have!
Gremlin theft cuts your food supply in half, which really sucks, and is the main reason why I believe this game to be impossible to beat without cheesing.