TRAPS--Dungeon Traps, Chest Traps, and Player Traps. Version 0.1.1 Updated 2005-04-14 ======================= Dungeon Trap Creation ======================= Once it is known that a trap will be placed, a random trap is chosen from the subset of the ten traps whose minimum depth is no more than the current dungeon level. That is, at 50' there is a 50% chance each for a gas trap or a playment movement trap, while at 5050' there is a 10% chance for each of the ten types of traps. +----------------------+------------+ | Type | Min. Depth | +----------------------+------------+ | trap door | 100' * | | pit | 100' | | dart | 400' | | discolored spot | 250' | | gas trap | 50' | | summoning rune | 150' | | dungeon alteration | 1000' | | character alteration | 3000' | | teleportation | 50' | | murder hole | 200' | +----------------------+------------+ (*) - trap doors are also disallowed on quest levels and on the bottom floor of the dungeon (6350'). ======================== Dungeon Trap Effects ======================== Note that all once a trap is generated, everything about it will be consistent (that is, a pit trap of daggers will always be a pit trap of daggers no matter how many times you fall in it, etc.). Trap: trap door Moves the player one level deeper than currently, with all the normal effects. If the player does not possess feather falling, does 2d8 points of damage as well. Trap: pit trap The base nastiness of this trap is equal to a random number between one and the current dungeon level, with a 1/20 chance to increase this by 20 and (if the 1/20 roll fails) a 1/5 chance to increase this by 10. Depending on the nastiness of the trap, one of the following things will happen. Note that in all cases, feather falling will avoid all damage and side effects. If the nastiness is more than 80, then there is 2/3 chance that it is a pit of daggers. If it is a pit of daggers, there is a further 1/6 chance that the daggers are morgul blades, in which case the player is infected with the black breath, is dealt 20d15 points of damage, has a 1/2 chance to summon 2 + 1d3 appropriate for one level deeper than the current level, plus one fifth the player's current depth (to a maximum of 4). Morgul traps disappear after being triggered once. If the daggers are not morgul blades, the player will be hit by 5 + 1d10 daggers, each of which does 3d4 points of damage. In either case, the player's cuts counter will be increased by a number between one and the total amount of damage inflicted. If the nastiness is more than 55 and it isn't a pit of daggers, there is a 2/3 chance that it is a poisonous spiked pit. A poisonous spiked pit does 2d6 points of damage and the player has an 85% chance to be impaled on poisonous spikes, in which case the damage is multiplied by (3 + 1d6) and the player's cut counter is increased by a random number between one and the multiplied damage. The player then takes a hit of poison equal to the multiplied damage. With both temporary and permanent resist poison, this does nothing. With only one, the size of the hit is reduced to 1 / 3 (and to 1 / 6 of the already reduced amount, rounded up, with both temporary poison resistance and the enhance magic specialty). If the player is not currently poisoned, this sets the poison counter to 4 plus a random number between half (rounded up) and the full amount of the hit. If the player is already poisoned, the poison counter is increased by between one third (rounded down) and two thirds (rounded up) the amount of the hit. If the nastiness is more than 30 and it isn't one of the above types, there is a 2/3 chance that it is a spiked pit. A spiked pit does 2d6 points of damage and the player has an 85% chance to be impaled on spikes, in which case the damage is multiplied by (2 + 1d4) and the player's cut counter is increased by a random number between one and the multiplied damage. Otherwise, the pit is a normal pit which does only 2d6 points of damage. Trap: dart trap To hit a player, a dart trap attacks as a monster with an attack power equal to 50 plus the current depth. If the dart misses, nothing happens. If it hits, the trap has an equal 1/6 chance to target each of the six stats. Its nastiness is equal to a random number between one and the current dungeon level. If this is greater than 50, there is a 1/3 chance that the targetted stat will be decreased 1d4 times; otherwise, it will only be decreased once. In either case, sustains apply as normal. Trap: discolored spot The nastiness of a discolored spot is equal to a random number between one and the current dungeon level, with a 1/5 chance that this is increased by 10. If the nastiness is at least 50, there is a 1/2 chance that it does 6d30 damage; otherwise, it does 4d8. The damage done is a random elemental type, with 1/4 chance of each of fire, cold, electricity, and acid. Resistances (both temporary and permanent) and immunities apply as normal, and all normal side effects of elemental damage may occur. Trap: gas trap A gas trap has an equal 1/4 chance of being each of the following types: 1] Blindness trap Blinds the player for 15 + 1d30 (more) turns, unless resist blindness is possessed. 2] Confusion trap Confuses the player for 10 + 1d20 (more) turns, unless resist confusion is possessed. 3] Poison trap With both temporary and permanent resist poison, nothing happens. With the temporary resist and enhance magic, sets the poison counter to 6 (or increases it by 1 if already poisoned). With exactly one of the permanent resist and the temporary resist without the specialty, sets the poison counter to 8 + 1d4 (or increases it by 2 + 1d3 if already poisoned). With no resist, sets the poison counter to 16 + 1d13 (or increases it by 8 + 1d9 if already poisoned). 4] Sleep trap Paralyzes the player for 5 + 1d10 (more) turns, unless free action is possessed. Though I'd be curious as to how you could set off a sleep trap while already paralyzed... Trap: summoning rune Summoning traps all disappear after being triggered once. If the current depth is at least 400', there a 1/5 chance of this being a den of thieves trap, in which case 2 + 1d3 thieves are summoned, each appropriate for one level deeper than the current level plus an additional one fifth the current level (to a maximum of 4). Otherwise, there 1/8 chance to summon a single unique appropriate for six levels deeper than the than the current level plus an additional one fifth the current level (to a maximum of 4). Otherwise, 2 + 1d3 monsters will be summoned, each appropriate for one level deeper than the current level plus an additional one fifth the current level (to a maximum of 4). Trap: dungeon alteration Dungeon alteration traps disappear after being triggered once. The nastiness of one of these traps is equal to a random number between one and the current dungeon level, with a 1/5 chance that this is increased by 10. If the nastiness is greater than 60, there is a 1/12 chance that the entire level is destroyed, the player is confused for 10 + 1d20 (more) turns ignoring confusion resistance, blinded for 15 + 1d30 (more) turns ignoring blindness resistance, has the stun counter increased the 50 + d50, and takes 15d15 points of damage. Otherwise, if the nastiness is greater than 20, there is a 1/4 chance that a radius 10 earthquake is triggered centered on the trap. If this does not occur and the nastiness is at least 5, there is a 1/2 chance that a rock will fall on the player's head, doing 2d10 points of damage and adding 10 + 1d10 to the stun counter. Finally, if none of the above occur, the player will take 1d8 points of damage. Trap: character alteration Character alteration traps disappear after being triggered once. The following things have a chance of occuring: 1] trap of drain wands (15% chance) A random item is chosen 20 times from the player's pack. The first time (if any) a rod, staff, or wand is chosen, it is drained of energy. For a rod, this means its timeout is set to double the normal recharging time for the stack. For a wand or staff, all charges are drained from the stack. 2] trap of forgetting (20% chance) If a normal saving throw is failed, the character suffers amnesia, forgetting the layout of the level and the identities of all non-*ID*ed objects in the pack. 3] trap of alter reality (15% chance) Regerates the dungeon level (as the alter reality spell). 4] trap of remold player (25% chance) If a normal saving throw is failed, two random stats of the player's are swapped. Note that unlike the similar effect of nexus damageeffect, resist nexus does not help against this trap. 5] time ball trap (15% chance) Fires a ball of time centered on the player doing 75 points of damage. 6] trap of software bugs (10% chance) Confuses the player for 10 + 1d20 (more) turns unless resist confusion is possessed, causes the player to hallucinate for d40 (more) turns unless resist chaos is possessed, and summons 2 + 1d4 software bugs. Trap: teleportation Teleports the player a distance of 250 squares. Trap: murder hole Does one of the following, with 1/3 chance of each: 1] If the current level is less than 40, fires a shot doing 2d3 points of damage; otherwise, fires a seeker shot doing 3d7 points of damage. 2] If the current level is less than 55, fires an arrow doing 2d4 points of damage; otherwise, fires a seeker arrow doing 3d9 points of damage. 3] If the current level is les than 65, fires a bolt doing 2d5 points of damage; otherwise, fires a seeker bolt doing 3d11 points of damage. The trap attacks the player as a monster with an attack power equal to 75 plus the current depth. If it misses no damage is done. If it hits, there is a 1/2 chance of a critical (which multiplies the damage done by (1 + 1d2) and an independent 1/2 chance of a gouge, which multiplies the damage by 3/2 and increments the cut counter by a random number between one and the total damage done (after all multipliers are applied). In each case, one of the appropriate typo of ammo is created, identified, and dropped on the ground near the trap. ======================== Chest Trap Creation ======================== The type of trap (if any) placed on a chest and its level depend only on the type of chest. Deeper chests have a greater chance to have at least one trap and, in general, more and deadlier traps if they have at least one. The trap on a given chest is determined by taking the native depth of the chest, adding 20, and subtracting 4d9 (yielding a number between the depth - 16 and the depth + 16). If this is greater than the chest's native depth (which occurs 3036/6561, or .46273, probability) then the trap is instead determined by adding 1d4 to the native depth of the chest. If this final value is less than 5, it is increased to 5 (this can only occur with small wooden chests); if greater than 99 it is decreased to 99 (this cannot happen with any currently existing chest). This number is the trap's level and is then used to look into the array of chest traps duplicated below. In cases where multiple traps are separated by a comma below, all listed traps will be present on the chest. For example, suppose there were a small steel chest (native depth 65) and the 4d9 roll was 13. Then the native depth plus 20 minus the roll would be 72, which is greater than the native depth, so we roll 1d4 instead and add it to the native depth. If this 1d4 roll is 2, we have 67 for the index in the trap. Looking in the table below, we see that this chest will have three traps--one which poisons, one which paralyzes, and one which drains constitution. +----+----------------+----+----------------+----+----------------+ | # | Trap (s) | # | Trap (s) | # | Trap (s) | +----+----------------+----+----------------+----+----------------+ | 0 | None | 34 | explode | 68 | bird summon | | 1 | poison | 35 | bird summon | 69 | scatter | | 2 | -str | 36 | None | 70 | typed summon | | 3 | -con | 37 | summon | 71 | pois,para,scat | | 4 | -str | 38 | explode | 72 | typed summon | | 5 | -con | 39 | ele summon | 73 | explode,summon | | 6 | None | 40 | explode,summon | 74 | typed summon | | 7 | poison | 41 | bird summon | 75 | explode,summon | | 8 | poison | 42 | explode | 76 | explode,summon | | 9 | -str | 43 | bird summon | 77 | explode,summon | | 10 | -con | 44 | ele summon | 78 | typed summon | | 11 | poison | 45 | bird summon | 79 | explode,summon | | 12 | scatter | 46 | None | 80 | bird summon | | 13 | -str, -con | 47 | ele summon | 81 | scat, t summon | | 14 | -str, -con | 48 | -str, -con | 82 | typed summon | | 15 | summon | 49 | pois,para,-str | 83 | bird summon | | 16 | None | 50 | ele summon | 84 | -str, -con | | 17 | -str | 51 | bird summon | 85 | typed summon | | 18 | scatter | 52 | ele summon | 86 | typed summon | | 19 | paralysis | 53 | typed summon | 87 | typed summon | | 20 | -str, -con | 54 | bird summon | 88 | ele summon | | 21 | summon | 55 | poison, para | 89 | typed summon | | 22 | paralysis | 56 | bird summon | 90 | runes of evil | | 23 | -str | 57 | explode,summon | 91 | poison, para | | 24 | -con | 58 | ele summon | 92 | typed summon | | 25 | explode | 59 | typed summon | 93 | runes of evil | | 26 | None | 60 | bird summon | 94 | typed summon | | 27 | ele summon | 61 | explode,summon | 95 | runes of evil | | 28 | -con, poison | 62 | bird summon | 96 | runes of evil | | 29 | -str, -con | 63 | scatter | 97 | typed summon | | 30 | explode,summon | 64 | -str, -con | 98 | runes of evil | | 31 | bird summon | 65 | typed summon | 99 | runes, explode | | 32 | poison, summon | 66 | bird summon +----+----------------+ | 33 | ele summon | 67 | pois,para,-con | +----+----------------+----+----------------+ For the actual chests currently in Oangband, their native depths and the distribution of traps to be found on them are listed below. The number is parentheses is the actual number of times out of 6561 that the trap will occur. Underneath each chest, the traps (or combinations of traps) that may occur on that chest are listed in order of frequency. +--------------------------------+-------------------+ | Chest | Depth | | Trap | Probability | +--------------------------------+-------------------+ | Small wooden chest | 15 | | scatter | 0.17969 (1179) | | -str | 0.15683 (1029) | | -str, -con | 0.14266 (936) | | None | 0.13397 (879) | | paralysis | 0.11568 (759) | | poison | 0.11522 (756) | | -con | 0.08139 (534) | | summon | 0.07453 (489) | | Large wooden chest | 25 | | -str, -con | 0.17893 (1174) | | None | 0.13397 (879) | | -con, poison | 0.11568 (759) | | elemental summon | 0.11568 (759) | | paralysis | 0.10516 (690) | | -str | 0.09480 (622) | | explode | 0.07453 (489) | | -con | 0.07376 (484) | | summon | 0.06995 (459) | | scatter | 0.03597 (236) | | poison | 0.00152 (10) | | Small iron chest | 40 | | bird summon | 0.29903 (1962) | | explode | 0.22694 (1489) | | elemental summon | 0.22481 (1475) | | explode, summon | 0.08733 (573) | | summon | 0.06401 (420) | | None | 0.05868 (385) | | poison, summon | 0.02514 (165) | | -str, -con | 0.00853 (56) | | -con, poison | 0.00533 (35) | | -con | 0.00015 (1) | | Large iron chest | 50 | | bird summon | 0.33257 (2182) | | elemental summon | 0.30391 (1994) | | typed summon | 0.11568 (759) | | poison, paralysis, -str | 0.07315 (480) | | -str, -con | 0.06950 (456) | | None | 0.05868 (385) | | explode | 0.03063 (201) | | explode, summon | 0.01280 (84) | | summon | 0.00304 (20) | | Small steel chest | 65 | | bird summon | 0.37311 (2448) | | scatter | 0.18518 (1215) | | typed summon | 0.12101 (794) | | poison,paralysis, -con | 0.11568 (759) | | explode, summon | 0.08230 (540) | | -str, -con | 0.07315 (480) | | elemental summon | 0.03657 (240) | | poison, paralysis | 0.01280 (84) | | poison, paralysis, -str | 0.00015 (1) | | Large steel chest | 75 | | explode, summon | 0.49123 (3223) | | typed summon | 0.31519 (2068) | | poison, paralysis, scatter | 0.05715 (375) | | bird summon | 0.05486 (360) | | scatter | 0.04648 (305) | | poison, paralysis, -con | 0.02514 (165) | | -str, -con | 0.00853 (56) | | Small Jeweled chest | 85 | | typed summon | 0.53071 (3482) | | bird summon | 0.11888 (780) | | elemental summon | 0.11568 (759) | | explode, summon | 0.10272 (674) | | -str, -con | 0.07315 (480) | | scatter, typed summon | 0.05715 (375) | | poison, paralysis, scatter | 0.00152 (10) | | scatter | 0.00015 (1) | | Large Jeweled chest | 95 | | runes of evil | 0.42478 (2787) | | typed summon | 0.35329 (2318) | | runes of evil, explode | 0.11568 (759) | | poison, paralysis | 0.05715 (375) | | elemental summon | 0.03292 (216) | | -str, -con | 0.00853 (56) | | bird summon | 0.00594 (39) | | scatter, typed summon | 0.00152 (10) | | explode, summon | 0.00015 (1) | +--------------------------------+-------------------+ ========================= Chest Trap Effects ========================= Trap: -str Appears as: Poison Needle Does 1d4 points of damage to the player and reduces strength by 1 until restored (if not sustained). Trap: -con Appears as: Poison Needle Does 1d4 points of damage to the player and reduces constitution by 1 until restored (if not sustained). Trap: poison Appears as: Gas Trap With both temporary and permanent resist poison, nothing happens. With the temporary resist and enhance magic, sets the poison counter to 6 (or increases it by 1 if already poisoned). With exactly one of the permanent resist and the temporary resist without the specialty, sets the poison counter to 8 + 1d4 (or increases it by 2 + 1d3 if already poisoned). With no resist, sets the poison counter to 16 + 1d13 (or increases it by 8 + 1d9 if already poisoned). Trap: paralysis Appears as: Gas Trap If the player has free action, does nothing. Otherwise, paralyzes for 10 + d20 turns. Trap: summon Appears as: Summoning Runes Summons 2 + 1d3 monsters appropriate for one level deeper than the level of the trap on the chest, plus one fifth the player's current depth (to a maximum of 4). Trap: explode Appears as: Explosion Device Does 5d8 points of damage to the player and destroys the chest. Trap: scatter Appears as: A Strange Rune Generates the chest objects as if the chest had been opened normally and places all objects at random clear locations on the current dungeon level. Trap: elemental summon Appears as: Summoning Runes Summons 5 + 1d3 elementals appropriate for one level deeper than the level of the trap on the chest, plus one fifth the player's current depth (to a maximum of 4). Trap: bird summon Appears as: Summoning Runes First fires 3 + 1d3 balls of force centered on the chest, each of which has radius 7 and does one fifth the trap's level in damage. Then it summons one fifth the trap's level + 1d5 birds appropriate for one level deeper than the level of the trap on the chest, plus one fifth the player's current depth (to a maximum of 4). Trap: typed summon Appears as: Summoning Runes Does one of the following, with 1/4 chance of each: 1] 2 + 1d3 times, projects a ball of fire centered on the chest which has radius 5 and does 10 damage, then summons a demon appropriate for one level deeper than the level of the trap on the chest, plus one fifth the player's current depth (to a maximum of 4). Note that demons summoned may be hit by subsequent balls of fire if they are within the radius. 2] Summons 2 + 1d3 dragons appropriate for one level deeper than the level of the trap on the chest, plus one fifth the player's current depth (to a maximum of 4). 3] Summons 3 + 1d5 hybrids appropriate for one level deeper than the level of the trap on the chest, plus one fifth the player's current depth (to a maximum of 4). 4] Summons 2 + 1d3 vortices appropriate for one level deeper than the level of the trap on the chest, plus one fifth the player's current depth (to a maximum of 4). Trap: runes of evil Appears as: Gleaming Black Runes Attempts to foist 4 + 1d3 "tricks" on the player. Each individual trick may be avoided by a roll of the player's saving throw or less on a die with twice the trap's level in sides (and note that since the minimum trap level for runes of evil is 90, even a perfect saving throw will not guarantee avoiding a trick). Each trick not avoided does one of the following, with 1/6 chance for each: 1] Does 5d20 damage to the player. 2] Adds 200 to the player's cuts counter. 3] Paralyzes the player for 2 + 1d6 (more) turns, or adds 10 + d100 to the player's stun counter instead if free action is possessed. 4] Attempts to disenchant a random slot on the player. Note that resist disenchantment does _not_ help to avoid this, but being shapechanged is a perfect defense. Artifacts still receive their normal chance to avoid disenchantment. 5] Reduces each of the player's unsustained stats by 1. 6] Fires a ball of nether of radius 1 doing 150 points of damage centered on the chest. ======================== Player Trap Effects ======================== When a monster enters a square containing a player's trap, the first thing checked is to see whether it ignores the trap completely because it can either fly over or simply pass through it. The chance for a monster to be affected by a given trap is listed below according to the type of trap. Ghost refers to any monster which can pass through walls; flying to any non-ghost which flies, and normal to any monster not in one of the previous two categories. +-----------+--------+--------+-------+ | Trap | Normal | Flying | Ghost | +-----------+--------+--------+-------+ | Net | 1 / 3 | 1 | 0 | | Spirit | 0 | 0 | 1 | | Stasis | 1 | 1 | 1 | | Lightning | 1 | 1 | 1 / 4 | | Other | 1 | 1 / 4 | 1 / 4 | +-----------+--------+--------+-------+ Assuming they don't avoid the trap completely, intelligent monsters have a chance to disarm traps. The monster's disarming skill is equal to 40 plus twice its level, to a maximum of 215 (for monsters native to 4400' or deeper). Then a random number is generated between one and the monster's disarming skill is compared against 15 less than the player's disarming skill; if greater, the trap is disarmed. Finally, if the trap would affect the monster and isn't disarmed, all monsters get one final chance to avoid a trap if they have previously triggered a trap and are still wary. In this case, a new random number is generated between one and the monster's disarming skill and compared against half of the quantity 15 less than the player's disarming skill; if greater, the monster avoids the trap this time. Wariness works as follows: unless it is stupid, each time a monster triggers a trap it has a 1/4 chance of becoming wary. A monster which is not stupid will _always_ become wary if it has fewer than half its maximum HPs after the trap takes effect (even if the trap itself does no damage). Afterward, every turn that the monster takes while it can see the player, it has a 1/4 chance of losing its wariness. Assuming that the trap affects the monster and wasn't disarmed or avoided, its base power (which determines its effectiveness) is determined by taking the level of the player plus 1 / 25 the level of the player squared. Then a random number is generated between one and this value and added to half this value plus three. This final result is the power of the trap; its average value for each character level is listed in the table below. +----+-------+----+-------+----+-------+----+-------+----+-------+ | Lv | Value | Lv | Value | Lv | Value | Lv | Value | Lv | Value | +----+-------+----+-------+----+-------+----+-------+----+-------+ | 1 | 4 | 11 | 18 | 21 | 41.5 | 31 | 72 | 41 | 111.5 | | 2 | 5.5 | 12 | 20 | 22 | 44 | 32 | 75.5 | 42 | 115.5 | | 3 | 6 | 13 | 22 | 23 | 47.5 | 33 | 79.5 | 43 | 119.5 | | 4 | 7.5 | 14 | 24 | 24 | 50 | 34 | 83.5 | 44 | 124 | | 5 | 9.5 | 15 | 27.5 | 25 | 53.5 | 35 | 87.5 | 45 | 129.5 | | 6 | 10.5 | 16 | 29.5 | 26 | 56 | 36 | 90 | 46 | 133.5 | | 7 | 11.5 | 17 | 31.5 | 27 | 59.5 | 37 | 94 | 47 | 138 | | 8 | 13.5 | 18 | 33.5 | 28 | 62 | 38 | 98 | 48 | 143.5 | | 9 | 15.5 | 19 | 36 | 29 | 65.5 | 39 | 102 | 49 | 148 | | 10 | 17.5 | 20 | 39.5 | 30 | 69.5 | 40 | 107.5 | 50 | 153.5 | +----+-------+----+-------+----+-------+----+-------+----+-------+ If the monster is currently wary of traps (see above), this power is reduced by a factor of 3. If it isn't wary, a random number is generated between 1 and the player's disarming skill, and if this is more than 50 greater than the monster's level, the trap scores a critical and its power is increased by 1 / 2. The damage actually done by the trap depends on its power and the type of the trap, as discussed below. 1] Base trap Does the trap's power in damage to the monster which triggered it. This is the most damaging trap, though it has no special abilities. 2] Sturdy trap Does 3 / 4 the trap's power in damage. 3] Netted trap Does 3 / 4 the trap's power in damage. 4] Confusion trap A random number is generated between 0 and one fewer than 3 / 2 the trap's power, then (10 + the monster's level) is subtracted from it. If the monster can be confused and this value is greater than 0, the monster is confused for 4 + this number of turns, or 2 + half this number of turns if already confused. 5] Poison gas trap Fires a ball of poison with radius 3 doing half the trap's power in damage and centered on the trap. This trap can therefore hit many monsters each time the trap is triggered. 6] Spirit trap Does 3 / 4 the trap's power in damage. 7] Lightning trap Fires a ball of electricity with radius 0 doing 7 / 8 the trap's power in damage and centered on the trap. The advantages this offers of the base trap are the side effects of lightning damage (stunning) and unavoidability for flying monsters. 8] Explosive trap Fires two radius 1 balls, each of which is centered on the trap, has radius 1, and does 3 / 8 the trap's power in damage. The first ball does fire damage; the second does shard damage. 9] Portal trap Teleports the target a distance of 5 plus 1 / 10 the trap's power squares. 10] Stasis trap Puts the target in stasis for 3 + 1 / 12 the trap's power in turns. After the trap has been set off, it has a chance to be destroyed. Explosive and stasis traps are always destroyed, sturdy traps are destroyed 1 / 8 of the time, and all other traps are destroyed 1 / 3 of the time, as listed in the table below. +-----------+-------------+ | Trap | Dest Chance | +-----------+-------------+ | Explosive | 1 | | Stasis | 1 | | Sturdy | 1 / 8 | | Other | 1 / 3 | +-----------+-------------+