This post investigates puzzles. Since there are a bunch of puzzles and each one has variations, I've grouped them into spoiler tags.
[SPOILER="Boss Rush Puzzle"]This puzzle is the only room in a Boss Trial dungeon.
It just creates a room with a chest in the center, then adds the boss key to that chest. Simple.
[/SPOILER]
[SPOILER="Dead End Chest"]Whooo boy. Here we go already!
This puzzle is added once per floor. However, unlike other puzzles, it spreads itself throughout the entire dungeon. It's "set up" once the rest of the puzzles are in place. Here's what it does:
For each dead end in the dungeon, it attempts to create a chest. If it can't, it goes on to the next one. If it succeeds, it enters the weirdest reward setup I have ever seen. It uses no less than four levels of nesting randomization calls to decide what reward you get. I'm going to multiply all the probabilities out (to make it into a flat table) and then use Osay's new table support to map it out:
[tbl][th]Chance[/th][th]Rewards[/th][tr][td]4.9%[/td][td]- Ten stacks of gold, each one 100~300g
- One HP 50 Potion[/td][/tr][tr][td]6.3%[/td][td]- Two HP 50 Potions[/td][/tr][tr][td]9%[/td][td]- One HP 50 Potion[/td][/tr][tr][td]9.8%[/td][td]- Ten stacks of gold, each one 100~300g[/td][/tr][tr][td]21%[/td][td]- One stack of gold, 0~500g[/td][/tr][tr][td]24.5%[/td][td]- Five stacks of gold, each one 100~300g[/td][/tr][tr][td]24.5%[/td][td]- Five stacks of gold, each one 100~300g
- One HP 50 Potion[/td][/tr][/tbl]
Interestingly, chests used to have a 50% chance to give you nothing, but that was commented out.
Nothing in this puzzle decreases the reward value of end chests, so we can stop that silly rumor right now.
Chests used to be guarded by a skeleton, presumably adding to the creep factor of the dungeon. Sadly, this code is commented out.
[/SPOILER]
[SPOILER="Switch"]There are a LOT of variations on this one. Fortunately, they all seem to do the same basic things:
When the puzzle is created, it adds the four switches to the corners of the room, each one set to off. Finally, it selects a random switch and marks it as the one that opens the door.
When an orb is hit, it checks if the switch selected switch is the opener. If it is, the door is opened and the rest of the switches are deactivated. Otherwise, a mob is spawned. Finally, the orb is turned on.
Other notes:
Single mob puzzles spawn the same mob for all switches.
Multiple mob puzzles randomly assign the three mobs to different switches.
Iria switches have three states: "off", "on", and "none".
Iria's single transparent pillar in the center of the room is a switch that simply randomizes the three spawns and chooses one to stay. It'll always be one. There's a further sub-version of this that shows the "Hit the orb again!" message.
There was apparently a Taiwan event where the number of switches you hit was important.
The correct orb does not rotate. Ever. PERIOD. There is no way to predict the correct orb or what monsters will spawn where. So we can stop this rumor about "clockwise every 10 seconds" as well![/SPOILER]
[SPOILER="Collection"]Not a lot to say about these. They just spawn the appropriate collection props.
Herb selection is huge, involving at least 570 lines of code. This'll be a topic of its own.
There's a "test collection" script that spawns prop 41377 if it's currently the 4th anniversary in KR and 22000 otherwise. (Both have invisible models)
I had to laugh... Gold is called "steel" in its collection script.
[/SPOILER]
[SPOILER="NPC"]This puzzle supports any NPC being spawned. If none is given, it defaults to DungeonNPC_1, who is better known as Tiro.
Yes, good ol' Tiro is a puzzle. Have fun with the connotations of that one.
[/SPOILER]
[SPOILER="Empty"]Because we totally had to have a script for empty rooms...? It's only used in the Nekojima dungeon, which has a totally different layout system anyway.[/SPOILER]
[SPOILER="Chests"]Once again, a lot of variations.
The common: Each chest room has the possibility to be a single spawn or three-chain. It's a 50/50 split. "Single" spawns use mob3, aka "arg3" in dungeondb.
Chests have a 99% chance to drop two stacks of 10~50 gold. The other 1% is the mother lode of 5 stacks of 100~200 each.
Chests have a fall-back of random-dropping a key if their spawns fail to allocate.
The rest, you probably know. When the chest is opened, the monsters spawn and... why am I spelling this out? I'm sure we all know how dungeons work... Why are you still reading? There's nothing here! This is irrelevant! STOP IT.
Variations:
One chest apparently only appears at the entrance to a floor. It contains 0 gold and sets a keyword relating to Ranald when you open it while on a quest. Despite appearing alby-beginner-specific, it's used in almost every dungeon.
Another variation replaces the two small stacks of gold with one of the following:
[tbl][th]Item[/th][th]Quantity[/th][tr][td]Firewood[/td][td]1~5[/td][/tr][tr][td]Bandage[/td][td]1~5[/td][/tr][tr][td]HP 10 Potion[/td][td]1~2[/td][/tr][tr][td]Small Gem[/td][td]1~3[/td][/tr][tr][td]Egg[/td][td]1~3[/td][/tr][/tbl]
A variation called "skeleton" replaces the monsters normally specified with mini skeletons.
Another, called "skeleton2", replaces the last spawn with giant skeletons.
[/SPOILER]
[SPOILER="Fountains"]Fountains have largely been discussed in this thread, but I'll just mention here that blue fountains appear 66% of the time, with reds appearing 33% of the time.[/SPOILER]
[SPOILER="Mimics"]There is only one puzzle type that deals with mimics. It handles mimic pits as well as rooms with a mix of mimics and other monsters.
It acts similar to a regular chest room, except it spawns its chest in one corner, and its 3rd argument in the other corners. It then randomly spawns its other two arguments.
This is why only three mimics are ever in possible chest locations. In full-on mimic pits, the remaining 6 mimics are specified in arg1 and arg2, and are thus positioned randomly.
The legit chest gives 10~30 gold.
[/SPOILER]
[SPOILER="Treasure rooms"]There's one for each dungeon, with a random reward algorithm. This will be a separate post.[/SPOILER]
[SPOILER="Recovery"]Oh Iria...
These rooms act pretty much like chest rooms. The main notable thing is the recovery. Monsters in here have an "alive" time, which is when they're running around eating you, a "ghost" time where they mock your attempts to hit them, and a "recovery" percentage.
The number of monster-groups that recover may be 1 or 2. The recovering monster-groups are chosen at random.
Sometimes arg3 specifies the recovery in the form of "alive/ghost/recovery". Other times, they default to the following:
[tbl][th]Number of recovering monsters[/th][th]Alive Time[/th][th]Ghost Time[/th][th]Recovery %[/th][tr][td]1[/td][td]12 seconds[/td][td]8 seconds[/td][td]60%[/td][/tr][tr][td]2[/td][td]16 seconds[/td][td]8 seconds[/td][td]30%[/td][/tr][/tbl]
[/SPOILER]
[SPOILER="Mobbing"]This is actually a variation on the recovery rooms, except monsters are set to not re-enter recovery once they become alive, and the recover percentage is hardcoded at 0.
Here are the timings:
[tbl][th]Monster group[/th][th]Ghost Time[/th][tr][td]1[/td][td]-[/td][/tr][tr][td]2[/td][td]18 seconds[/td][/tr][tr][td]3[/td][td]36 seconds[/td][/tr][/tbl][/SPOILER]
[SPOILER="Vanishing"]These behave similarly to the mobbing rooms, but in reverse.
[tbl][th]Monster group[/th][th]Vanishes after[/th][tr][td]1[/td][td]Never[/td][/tr][tr][td]2[/td][td]13 seconds[/td][/tr][tr][td]3[/td][td]24 seconds[/td][/tr][/tbl][/SPOILER]
[SPOILER="Various props"]Some props have puzzle scripts too! Most simply set aside a space and allocate the prop, but others have a bit more meat to them.
- Black orb: Known as "black bead" to the script, it spawns the prop with an initial count of 5. Every time it's hit, it shows a message and decrements the counter. When the counter reaches 0, it shows another message (or two, if you have a keyword) and drops the item, locking it to the person that broke the orb. Ironically, the unbroken state is called "off" and broken is "on".
- Courcle Eye: Simply shows some G7 prop.
- G3 Dragon: Shows Cromm "sleeping".
- Mirror Witch's mirrors: This almost deserves its own entry... In fact, I think I'll give it one. Look father down.
- Glas prop: Does nothing.
- Great Spinning Wheel: Arachne's?
- Jenna in prison: Does nothing.
- TNN Gargoyles: Does nothing but spawn some gargoyle-looking things? Unsure, and the prop is invisible.
- TNN sealstone at the end of Barri: Contains a bunch of condition checks for G1 progress, "g1_easy" features, and it also checks if everyone in your party is over level 25. If you pass all these, it'll show you a cutscene and open the door.
[/SPOILER]
[SPOILER="Mirror Witch's Mirrors"]This one creates the mirrors prop with 0 initial damage. The mirrors are actually present during the Wendigo fight but are set to a "hidden" state. When the witch spawns, the game reveals some/all of the mirrors.
Hitting the prop does nothing until it's in the "halfbroken" state from playing the flute. Then, every hit adds one damage until the damage is over 10. It records the mirror as broken and reduces the mirror count. If there are no more mirrors, shit gets real.
[Image: http://perfectlycursedlife.com/wp-content/uploads/2014/03/shit-just-got-real.gif]
The mirror witch (called "zin_boss" internally) is despawned. Yes, despawned. Next, "real_zin_boss" (the upgraded mirror witch) is spawned with an "ANGRY" parameter set. She shows her furious mug to the player in the cutescene that the script then invokes.[/SPOILER]
So some important things from the above:
Nothing in this puzzle decreases the reward value of end chests, so we can stop that silly rumor right now.
The correct orb does not rotate. Ever. PERIOD. There is no way to predict the correct orb or what monsters will spawn where. So we can stop this rumor about "clockwise every 10 seconds" as well!
Chests have a fall-back of random-dropping a key if their spawns fail to allocate.
[SPOILER="Thinking back on all the time I wasted counting orbs"]
[Image: http://i.imgur.com/0HpUQes.gif]
[/SPOILER]