Skills and missiles
This page explains what the server does when a unit uses a skill: how the request is checked, which function runs when the skill’s animation starts and which on its action frame, what the skill costs and how its delay works, how a skill’s melee hit is built, what the charge-up skills and their finishers do, which item stats and skills react to hits and kills, how a summon is made, and how a missile is created, flies, collides and hits. It restates the reviewed skills specs: the overview in skills, the skill side in dispatch and the missile side in missiles. The specs carry the exact arithmetic and draw order; this page tells the story. Where something is read from the code but not yet seen in a test run, or is still unknown, the page says so. “Confirmed by a second reading” means the instructions were read again with a second tool, or every call of or store into the thing was scanned: it covers what the code says, not that a game reached it.
Skills and missiles are the project’s third simulation subject, after combat and stats and states. Combat takes a skill’s damage packet as given; this subject explains where it comes from. The specs cover the machinery that every skill goes through, and a named set of skills, called tier A, whose own functions are specified too. What each of the other numbered skill and missile functions does is in the function catalogue. The specs were checked against two recorded runs of skill-using characters (the second built for what the first met too rarely) and against single functions run on their own under emulation, up to a call that ends the reproduced part. Life, mana and damage are kept in 1/256 points, and time is counted in game frames.
The big picture
Section titled “The big picture”A skill use is a chain of server events:
- The request. A player’s client asks to use the left or right skill at a point or at a unit; the server checks the skill can be used and starts the skill’s animation (its mode). A monster’s AI skips the checks.
- The mode start. The skill’s start function runs. Some skills build and roll their melee hit here, at the start of the swing.
- The action frame. On the frame of the animation that carries the action, the skill’s do function runs, then the skill’s missile is created, the cost is paid if it was not paid at the start, and the delay begins.
- The missile steps every frame, tests the cells it crosses for units and walls, and on a hit builds its own damage packet and hands it to combat.
- Handlers. The hits and kills fire the stat events that item stats (thorns, knockback, chance to cast) and some skills (Bone Armor, Life Tap) registered on the units.
- Summons. A summoning skill creates a monster owned by the caster.
The order of these steps is read from the code; which parts of each the runs confirmed is said in the sections below. Each step draws on a particular seed: the caster’s, the target’s, the game seed (one step for each missile and each summon created, in every creation the runs logged), the missile’s own seed, and a few short-lived local seeds. The rest of this page follows the steps in order and names, for each, whose seed it draws on.
What the model takes as given
Section titled “What the model takes as given”Some inputs belong to other subjects and are taken as given, logged in the runs:
- The frame on which the action happens. Which frame of an animation carries the action is animation timing’s.
- A monster’s choice of skill, mode and target: monster AI.
- The live collision grid at a plan or a step, and the cells a missile’s step crosses, the order in which an area skill visits the units near it, and which pet the pet limit removes. The planner’s points are not among these inputs: pathing explains the planners, which reproduce given the live grid.
- A unit’s final stats, which stats and states explains.
Asking for a skill: the request and its checks
Section titled “Asking for a skill: the request and its checks”A player’s request arrives as one of the skill packets: left or right skill, at a point or at a unit, with or without walking to the target first. The packet table’s skill rows, their lengths and fields, and the handlers’ calls are confirmed by a second tool.
- Every request moves a counter. Before any check the player’s stat 328 rises by one: confirmed, the stat rose by the number of requests between two observations in 1 660 pairs. That counter later seeds every pierce count of the player’s missiles. Every logged request passed, so that a refused request still moves it, and so changes the player’s later missiles, is read from the code.
- Dual wielding alternates. With a weapon in each hand, the Attack skill alternates request by request between Attack and Left Hand Swing: confirmed in 56 of 56 consecutive pairs of a dual-wielding Barbarian’s requests. Left Hand Swing reached the run only this way (30 uses).
- A request that passes reaches the mode start in its frame (confirmed for 2 823 point requests and 1 521 unit requests). A request that asks to walk, at a unit too far away for a melee skill, first makes the player run to it: seen for 12 Kick requests, whose mode started in a later frame with the skill kept.
The checks run in a fixed order and return a code. 0 means usable: the server then starts the skill’s mode; 1 makes it send the “not enough mana” message; any other code does nothing.
| Order | Test | Refused with |
|---|---|---|
| 1 | the skill exists and is usable in game | 3 |
| 2 | the unit has the skill at a level above 0 | 7 |
| 3 | the skill is not an aura | 6 |
| 4 | the skill is not a passive | 5 |
| 5 | ammunition and item tests (a throw needs a throwable item, Left Hand Swing two weapons) | 2 |
| 6 | the weapon types the skill needs | 2 |
| 7 | enough mana (or life under Blood Mana, or charges for an item skill) | 1 |
| 8 | the skill’s restriction to certain states | 4 |
| 9 | the starting mana of a channelled skill (Inferno, Arctic Blast, Blade Fury) | 1 |
| 10 | an item skill has charges left on its item | 2 |
| 11 | the delay state, for a skill with a delay | 8 |
What the run confirmed. Codes 0, 1, 6 and 8 and their order are confirmed over 1 340 checks: an aura refused with 6, the mana test with 1, the delay with 8, everything else usable. A cost equal to the mana passes: five checks with exactly as much mana as the cost returned 0. No check of the run reached the other codes, but tests 7 to 10 (mana, life under Blood Mana and charges; the state restriction; the starting mana; the item charges) ran under emulation and are confirmed that way. Tests 5 and 6 (ammunition and weapon types) and the return of codes 2 to 5 and 7 from the check as a whole are read from the code.
No refused request reached the server. All 1 126 requests of the run passed, while the client’s own check of the same skills switched to a refusal 85 times. Read from the code, the client runs the same checks on its own copy of the player every frame for the skill buttons; in the run it sent no request for a refused skill (its sending code is not read). So what the server does with a refused request, codes 2 to 5 and 7, and the refusal of a skill not allowed in town, are the code reading: a test needs a client that sends what a stock client does not.
The skill level and its bonuses
Section titled “The skill level and its bonuses”The level the checks test, and the level a skill’s formulas use, is the unit’s hard points in the skill plus a bonus, kept between 0 and the skill’s maximum; the mana test adds the same bonus. Read from the code, the bonus adds up:
- a per-skill bonus word of the unit’s skill entry, 2 while the unit has the skill shrine’s state, and ”+ to all skills”;
- for a player’s skill of its own class: ”+ to class skills”, the ”+ to a skill tab” stat for the tab the skill sits
on, and the
item_nonclassskillstat for that skill, capped at 3; a skill of another class takes that stat uncapped; - ”+ to elemental skills” for a skill with an element, and ”+ to a single skill” for that skill.
The skill tab comes from the SkillDesc table, the skill tree’s own table: its page number (1 to 3) picks which tab
bonus applies, and a skill on no page gets none. That is the server’s one use of a skill-tree column outside the
formulas. The bonus makes no random draw. Confirmed: the mana test ran it 1 339 times in the skills runs, 182 times
with a bonus of 1 to 4, but those logs hold no character stats, so the split into its terms is still the code
reading.
The mode start and the action frame
Section titled “The mode start and the action frame”When the request passes, the skill’s mode starts. The server checks the target, refuses a skill not allowed in town while the caster stands in a town, tests line of sight for the skills that need it, and runs the start function. The cost is paid here, unless the skill pays on the action frame (two rows, Plague Javelin and Blade Fury) or has no start function. Seen in the logs: the start routine’s calls, a row with no start function passing (6 216 times), and exactly one payment whenever a start function passed on a row that pays at the start (1 602). The refusals at this point are read from the code; a refusal puts a player into mode 5 and a monster just returns, confirmed by a second reading.
The target test ran under emulation. A skill with no target passes. A skill that needs a targetable unit passes only for a hostile, for its own pet when its row allows that, or for an ally in the same party when its row allows that. Past those tests the target is kept or dropped by one bit of the target unit and the skill’s corpse column: with the bit clear the target is always dropped; with it set, a corpse skill keeps only a monster in its death mode, and any other skill keeps anything but that.
On the action frame the do function runs, and then the skill’s missile is created, if the row names one: 48 stock rows, Fire Bolt among them, have a missile and no do function, and get only the missile (confirmed against the table). Then come the cost (if not paid at the start), the ammunition for the rows that use some, and the delay; that order is read from the code. A flag on the unit, set by the do function or by the missile creation and cleared at a player’s mode start, makes the do function run once per mode, even if the animation carries the action on more than one frame. That flag, its 124 setters, 17 clearers and two readers, is confirmed by a second reading.
The machinery draws nothing. Over 1 142 mode starts and 1 269 action frames, the caster’s seed after the start or do function was its seed before it, stepped only by the draws of the events nested inside (a hit’s to-hit and damage rolls, the target’s defence rolls, a missile creation’s critical roll, an aura’s elemental roll). The payments and 251 of the 277 delay states set are among what draws nothing. This is confirmed.
A skill’s melee hit may roll at the start of the swing. Read from the code: Bash, Stun, Concentrate and the other
rows that share Bash’s start function roll the to-hit, defence and damage when the mode starts and deliver the hit on
the action frame; Jab does everything on the action frame. A rebuild has to order the draws by frame accordingly. Kick’s start function builds
its hit from its row’s values (a set result and hit class, the row’s MinDam shifted by its HitShift as physical
damage), read from the code, and the same delivering do function delivers it. The stock Kick row’s MinDam is 0, so
that physical damage is 0 (from the table). In the 25 of its 32 uses whose hit reached the damage step, on Normal
against nine monster kinds with no physical resistance, the hit carried no physical damage, which the
strength-and-dexterity damage below could not have given (confirmed); that the start stores the shifted MinDam
rather than nothing at all is read from the code, and why the other 7 uses reached no damage step is not read. In its
32 uses the caster’s seed did not move at the start, and the
action frame added no draw of its own (confirmed). The
delivering do function was run on its own under emulation up to its calls.
A monster reaches the same start and do functions through its AI, which picks the skill, sets the once-per-mode flag itself and sets the mode. In its attack and skill modes the do function runs on a path that does not test the flag. The sequence mode (14) is the exception: its start clears the flag, and its frame runs the do the way a player’s does, once per mode. Confirmed: the flag was set at all 1 460 logged monster starts in the attack and skill modes and clear at all 566 in mode 14. A monster passes none of the request checks (confirmed by three tools: the check has no caller on a monster’s path), pays no cost, uses no ammunition and gets no delay; those last three are read from the code.
Mana cost and delay
Section titled “Mana cost and delay”The cost is
cost = (
lvlmana× max(level − 1, 0) +mana) shifted left bymanashift, in 1/256 mana.
Confirmed over 1 334 payments: the mana fell by exactly this amount each time, 258 of them at a level above 1 with a
per-level term, and with shifts of 5, 6, 7 and 8. As a made-up example, a row with mana 8, lvlmana 1 and
manashift 8 at level 5 costs (1 × 4 + 8) × 256 = 3 072, that is 12 mana. Only players pay: confirmed for 205
calls on other units.
Read from the code only, none of it met in the run:
- The minimum cost (
minmana) binds the payment, not the checks, so a skill whose per-level cost falls (seven stock rows, Teleport and Magic Arrow among them) is checked against its cost without the minimum. - A failed payment still casts. When the cost turns out to be above the mana at payment, nothing is taken and the skill runs anyway.
- Blood Mana takes life instead of mana, and ends when life falls too low.
- Charged skills on an item spend a charge instead of mana.
The delay. A
player’s skill with a delay (Meteor, Firestorm, Plague Javelin and 20 other stock rows) puts the player in a delay
state for that many frames. Confirmed: a delay set at frame f for d frames ends at frame f + d, when a
request passes again; and in the delay state a skill with a delay is refused while a skill without one is not. Read
from the code: the state is one per unit, so one delay blocks every delayed skill, not only the one cast.
Repeating skills. The two periodic rows (Thunder Storm, Blade Shield) and the auras run again on a fixed grid
of frames: every perdelay frames (5 when the formula gives less than 6), on a frame one past a multiple of it, the
same grid as the auras of stats and states. The channelled skills (Inferno, Arctic Blast, Blade
Fury) are the three with a starting mana: the first frame needs it, the later ones the per-use cost. Read from the
code.
Item skills and chance to cast
Section titled “Item skills and chance to cast”Dispatch § H, read from the code unless said:
- An aura granted by an item runs on the same frame grid as a selected aura, while the item’s aura stat stays above 0.
- A chance to cast (on attack, on striking, on kill, when struck, on death or on level-up) casts through one routine that pays no mana, uses no ammunition and sets no delay. Three skills, Nova, Frost Nova and Chain Lightning, then use a special item form of their do function, and only when cast by the “on attack, kill or hit” stats.
- A random target point. For the one stock skill whose item cast aims at a random nearby point (Teleport), the caster’s seed steps twice per try (an offset from −20 to 19 on each axis) for at most 10 tries until a free point is found. The first try’s two steps are confirmed under emulation; the later tries are read from the code.
A skill’s melee hit
Section titled “A skill’s melee hit”A skill’s melee hit builds the same damage packet as a normal attack and hands it to the combat build and queue. Bash’s start function is the pattern, read from the code:
- The skill’s attack rating goes into the hit test: the to-hit draw on the attacker’s seed, then the defence rolls on the target’s.
- On a hit, the skill’s result flags and hit class are added, its enhanced damage (
calc1) set, and for a skill with an element type a conversion of physical damage into that element (Concentrate, for one, converts to magic). - The skill’s elemental damage is rolled: one draw on the attacker’s seed for the range (none when the range is empty), and one more for the random element type 10.
- The combat build adds the weapon damage and queues the hit; the skill’s flat physical bonus (
calc2) is added after the defender’s reductions.
Bash’s start function was run under emulation up to the call that sets its attack rate; the rest is the code
reading. A skill’s own physical damage is the skill’s min and max damage by level bands plus its synergy percent,
run under emulation for a row with no weapon share; the weapon share, and which code uses this damage (summons,
missiles and several do functions), are read from the code. For a row flagged Kick the minimum is instead a quarter of (strength + dexterity − 20)
for a player, or of three times the level for another unit, at least 1 before the quarter (run under emulation); the
maximum is a third of the same, read from the code. Kick’s own start function, above, does not use it: it reads
its row’s MinDam itself (read from the code), which is 0 for Kick. Read from the code, the Kick-flagged damage is reached by the
Assassin’s Dragon Talon, Dragon Tail and Dragon Flight (strength and dexterity for the Assassin, three times the
level for the two shadow monsters that cast Dragon Flight), and not by a direct call of Kick’s own functions; the
calls that pass a skill chosen at run time are not followed. On those kicks, read from the code, the kick damage stat counts
twice when boots are worn (once alone, once with the boots’ values), and the damage stats of a weapon in either hand are unlinked
while the hit is built, so a weapon’s elemental damage stays out and other items’ still reaches it. The weapon masteries enter
through the combat build and the missile damage, the synergies through the skill’s formulas, read from the code.
Three things that look like slips, all read from the code. A player’s Smite runs its hit test
with its draws and then forces the hit bit; a monster’s Smite takes its A2 stats whatever mode it used. The knockback chance
of Dragon Talon and Psychic Hammer adds the skill level to the target’s level and subtracts the target’s level again, so the
difference is always the skill level. A running Blessed Aim removes Penetrate’s list from its caster, because both rows name
the same passivestate.
Charge-up skills and the finisher
Section titled “Charge-up skills and the finisher”The Assassin’s charge-up skills (Tiger Strike, Cobra Strike, Royal Strike; Fists of Fire, Claws of Thunder, Blades of Ice) hit, and on a hit add a charge to a timed state on the Assassin, up to 3. The next normal attack, or a finishing move, runs the finisher: for each charged state it looks at the attacker’s next random number without using it (a step on a copy) and runs the charge’s entries. All of that is read from the code.
| Charges spent | What runs | Draws on the attacker’s seed |
|---|---|---|
| Claws of Thunder at 2 | a nova of 64 missiles from the target | none of its own |
| Claws of Thunder at 3; Fists of Fire at 1; Royal Strike at 2 | a ring of missiles, each seeded from a local seed | 1 at entry |
| Fists of Fire and Blades of Ice at 2 | the queued hit, then an area hit around the target | 2 (3 for element type 10) |
| Fists of Fire and Blades of Ice at 3 | scattered points from a local seed | 1 at entry |
| Royal Strike at 1 | one missile at the target | none |
| Royal Strike at 3 | several missiles, each with two local steps | 1 at entry |
An entry steps even when it does nothing. The entries with a step at entry take it before testing their missile, so Fists of Fire’s first charge steps the seed although its row names no missile. This, and the boundaries of the entries, are confirmed under emulation. Fists of Fire runs every entry up to its charge count (at three charges all three); Royal Strike only the current one (read from the code). No finisher was checked in a run: its order is the code reading.
Item-stat and skill handlers
Section titled “Item-stat and skill handlers”Many item stats and some skills react to events on a unit: a melee hit given or taken, a missile hit taken, a kill, a death, a level-up. They do so through a table of 31 handlers registered on the unit. Read from the code: a handler draws, when it draws, on the seed of the unit that owns the event (the attacker for an attack or a kill, the defender for a hit taken or a death), and inside delivery the attacker’s melee handlers run before the defender’s, the victim’s “killed” handlers before the attacker’s “kill” ones, newest first.
Which events ever fire, read from the code.
The events are numbered by the rows of the Events table, 0 to 12, and the game raises 0 to 3, 5 to 7 and 9 to 12
(and a 13 at a monster’s death that no table can name). Two events are never raised: 4 (doactive) and 8
(domissileattack). So the second event of the “chance to cast on attack” stat, the missile-attack one, never fires;
the stat casts only through the melee-attack event, and whether a ranged attack reaches that one is not settled. An
item stat registers its event only when the number is above 0, a skill’s aura event when it is 0 or more, so Chilling
Armor’s “hit by missile” event registers and an item stat’s could not.
The draws, measured. Over 1 303 handler calls of the two runs, each handler’s unit seed stepped by exactly the count below; the 3 461 handler fires of the earlier combat and stats runs and of the Fleshripper log give the same, with no mismatch. Confirmed:
| Draws | Handlers |
|---|---|
| none | Life Tap, physical thorns, damage taken to mana, mana after a kill, slow target, Bone Armor’s absorb, life after a kill, the “rest in peace” state on the victim |
| one | knockback, howl (the monster flees), stupidity, open wounds, crushing blow |
| one when the roll fails, at least one when the cast follows | chance to cast on attack, kill or hit |
| at least one | chance to cast when struck |
Also confirmed: life and mana after a kill add the stat in whole points and are capped at the maximum (the cap
bound in 154 of 156 gains; mana’s addition below the cap is read from the code), and open wounds rolls low mod 100 of
the attacker’s next draw against its chance (82 of 120 fires applied it, for 200 frames). Slow target puts the
slow state on the other unit for 750 frames, its stats lowering the speeds by the item’s value: confirmed, with the
state, its length and the first speed stat in the logged fires.
Run under emulation past the logs, each to its first call into another function: knockback whole (a chance of 32, 64 or 128 in 128 by the target’s size), howl’s test of the other unit, stupidity’s chance and length, lightning thorns, freeze’s one draw, life after a demon kill, Cyclone Armor’s absorb up to its calls, the two golem handlers (Blood Golem’s owner losing life with it, Clay Golem’s slow) and reanimate. The three chance-to-cast handlers ran up to their cast. The rest is read from the code: Chilling Armor, Frozen Armor, Shiver Armor, Iron Maiden, fire and cold thorns, Blood Golem’s heal, Energy Shield, chance to cast on death or level-up past its draw, and the effects of the measured handlers the logs do not show.
Prevent heal is not a handler. The item property that stops a monster from healing (Fleshripper, Nature’s Peace) is applied, read from the code, right after a successful to-hit roll and before the defence rolls. Confirmed: the monster gets the prevent-heal state for 120 000 frames, with no draw: in 918 such checks the state landed in exactly the 86 with the property on the player attacker, and neither unit’s seed moved. Every check had a player attacking a monster, so the tests on the attacker’s and the monster’s types are read from the code.
Summons
Section titled “Summons”A summoning skill creates a monster owned by the caster (for Raven, at the target point, read from the code).
- The new unit’s seed, life and defence are those of any spawned monster: the game seed steps once, the new monster’s seed is made from it, and its life and defence come from the usual creation draws on that seed. Confirmed over 219 summons, 207 Ravens and 12 skeletons of Raise Skeleton.
- The summon’s level. A skill that passes no level (Raise Skeleton) takes
min(max(L × 3 ÷ 4 + skill level, 1), L), L the owner’s level. Confirmed in 12 of 12 summons, all with the same input (see the worked example); the clamps, which did not bind there, bind under emulation (6 000 cases), with the three-quarters rounding toward 0 in 32 bits. A skill that passes a level, such as Raven, uses it as given (confirmed for 207 Ravens). - Raise Skeleton draws on the caster. After the spawn, the caster’s seed steps once for a skeleton warrior above
skill level 2 (a roll against the skill’s
Param1) and once for a skeleton mage. Confirmed: one step, and only there in the action frame, in 12 of 12 casts of a skeleton warrior at skill level 20. The level gate and the mage’s draw ran under emulation (no step at skill level 2 or below, one above it). - The summon’s other stats (the skill’s passive and aura stats, life bonus, its own skills) are read from the code, as are summon classes scaled by level and the golems.
- The pet limit, players only, read from the code: a new summon removes the owner’s pets of the other types of its group, and while the owner has more pets of its type than the skill allows, removes the first pet of the list (not necessarily the oldest).
- No
noRatiotest, confirmed under emulation (4 011 cases): a summon gets its level-table defence and to-hit added whole, whatever its class’snoRatiobit.
A monster’s attack stats
Section titled “A monster’s attack stats”When a monster attacks or uses a skill, the game writes its damage and to-hit for that attack mode.
Confirmed over 26 425 such calls: minimum damage, maximum damage and to-hit are the monster’s level-table values
scaled by the attack mode’s own columns (the second attack for mode 5, the skill columns for modes 7 and 8, the first
attack for every other mode); a summon adds its other stat lists on top. The monster’s seed moves only by the
elemental chance rolls (one roll in 21 calls, 2 of them applying the element); a monster with no stat list yet
writes nothing. The Druid’s Raven adds the damage and to-hit of the Raven skill at level 20, the level of the one player in
the sessions measured, who cast it; those games have one player, so they don’t tell the owner from any other player. Read from the code: a summon whose class names a skill for its damage adds that skill’s damage and to-hit at its owner’s level in it,
never the summon’s own, for the Raven and the three other such classes; the level table’s L columns, the classic and expansion terms, and
the second and third elemental attacks.
Ammunition and weapon wear
Section titled “Ammunition and weapon wear”Read from the code: a skill that uses ammunition takes one arrow or bolt from the quiver with a bow or crossbow, or one from the thrown weapon itself, and a throw or a normal ranged attack takes one at the missile’s creation (Magic Arrow excepted).
Impale is the one skill that wears its weapon (its one caller, confirmed by three tools): one draw on the user’s seed, and when it falls below the skill’s chance the weapon loses durability or breaks (a stacked throwing weapon loses one of its quantity instead). The wear ran under emulation: one step once its gates pass, none before them. The break test is the sign bit or zero of the 32-bit durability left, not a true “zero or less”, so the two differ when the subtraction wraps.
Tier A: the skills specified
Section titled “Tier A: the skills specified”The tier-A rows are the ones whose own start and do functions are specified, not only the machinery. In short:
| Skill | What runs on the action frame |
|---|---|
| Attack, Left Hand Swing | the normal attack of combat, or the weapon’s missile |
| Kick | the hit built at the start, delivered |
| Throw, Left Hand Throw | the thrown item as a missile |
| Plague Javelin, Multiple Shot | the skill’s missile; Multiple Shot fans several across the line to the target |
| Jab | the whole hit: to-hit, damage, conversion, elemental roll, delivery |
| Raise Skeleton | the summon of the section above |
| Fists of Fire | a charge-up hit |
| Holy Shield, Bone Armor | a timed state on the caster with its stats and handlers |
| Static Field | its effect on the units in range |
| Nova, Frost Nova, Howl | a ring of missiles around the caster |
| Teleport | the move to the target point |
| Meteor | its missile at the target point, if the cell is free |
| Amplify Damage | the curse on the units around the target point |
| Might, Holy Fire | an aura run (Holy Fire’s with one elemental roll per run) |
| Raven | the summon |
| Firestorm | its maker missile, then the sub-missiles through a re-seeding step |
| Fire Bolt, Fire Trauma | the skill’s missile only |
No skill function of its own draws, measured. For Fire Bolt, Frost Nova, Nova, Teleport, Meteor, Might, Holy Fire, Howl, Raven, Firestorm and Multiple Shot (30 or more uses each), then Plague Javelin, Amplify Damage, Bone Armor, Fire Trauma and Holy Shield once the second run raised them over 30, and for Kick, Left Hand Throw and Left Hand Swing, the caster’s seed moved by exactly the nested events’ draws. Attack is confirmed by the combat run, and Raise Skeleton’s one step above. Throw, Jab, Fists of Fire and Static Field were not measured: they are read from the code, and most of the tier-A functions were run under emulation up to a call that ends the reproduced part.
The function catalogue: what every other skill and missile function does
Section titled “The function catalogue: what every other skill and missile function does”Tier A names the skills whose own functions the machinery spec writes out. The function catalogue covers the rest: every numbered start, do, progressive, item-effect and periodic-state entry a stock Skills or States row uses, and every missile do, hit and damage entry a stock Missiles row uses (310 entries in all, counting the six general-purpose ones). Each entry says what it tests, what it writes, which missiles, units, states and packets it makes, and which random draws it makes in order. The general-purpose entries and the tier-A ones are written out in the machinery specs; the catalogue links them.
Finding a function
Section titled “Finding a function”A reader starts from a table row and follows one column to an entry number.
| Starting from | Read the column | Then go to |
|---|---|---|
| A skill’s start of animation | Skills srvstfunc |
the class section below, or the monster sections, by skill row |
| A skill’s action frame | Skills srvdofunc (srvprgfunc1..3 for a progressive skill) |
the same sections |
| An item that casts a skill | ItemEffect |
the item, charge and shrine callers |
| A timed state that acts each period | States srvactivefunc |
the section of the class that owns the state |
| A missile’s every-frame code | Missiles server do function | missile do entries |
| What happens when a missile hits | Missiles server hit function | the hit entries, 1 to 29 and 31 to 59 |
| How a missile’s damage is built | Missiles server damage function | the damage entries |
The spec’s first section fixes the naming (start entry, do entry, missile do, hit and damage entry) and says how far each statement reaches: an entry that ends in a callee is described up to that call, and what follows is marked as reading.
By class
Section titled “By class”| Section | What it holds |
|---|---|
| Sorceress | start entries 11 to 14; do entries 17 to 29 and 144 |
| Amazon | start entries 4 to 10; do entries 6 to 8 and 10 to 16 |
| Necromancer | start entries 15 to 21; do entries 30 to 32 and 55 to 63 |
| Paladin | start entries 29, 31 and 35 to 37; do entries 64 to 67, 73, 79 to 82 and 150 |
| Barbarian | start entries 32 to 34 and 38 to 41; do entries 2, 9, 68 to 72 and 74 to 78 |
| Druid | start entries 56 to 58; do entries 114 to 124, and entries 145 and 146 |
| Assassin | start entries 22 to 28; do entries 33 to 35, 42 to 52 and 54; progressive entries 36 to 41 and 143 |
| Item, charge and shrine callers | start entry 3; do entries 4, 113 and 151, and the callers of the stat-event handlers and shrines |
| Monster skills, Skills rows 156 to 189, 190 to 289 and 290 to 338 | the entries the monster Skills rows name, grouped by row range; which monster uses which skill, and when, is the monster-AI plan’s |
The draws, by seed
Section titled “The draws, by seed”Most entries draw nothing before the point where the description stops. The spec lists the ones that do, in one table. In plain words:
- The caster’s seed moves in a handful of skill functions: one roll of a hundred, one roll in a damage range,
or one bare step. One of them,
do 112, steps before any test, so a refused cast still moves the seed. - A missile’s own seed moves in a missile’s do, hit and damage entries. Some of them first re-seed the missile from a value the missile carries (its sub-position, for instance) and then draw, which is how the sub-missiles of a storm or a fall of rocks scatter. A creation callback can re-seed the missile as it is made.
- Another unit’s seed moves in a few places: the missile do that draws on its target, the stat-event handlers that draw on the unit they belong to, and the shrines on the shrine object.
- A seed no unit keeps: the progressive (charge-up) entries step the caster once at entry, copy its seed into a local one and draw from that; one monster start (start 55) draws from a local seed built from the target’s and the caster’s ids.
The same section’s note on draws after a boundary lists the draws that lie past where the emulation stopped; those are the code reading’s order, not a measured one. How the seeds are chained in general is on randomness, and the re-seed sites on the re-seed section below.
What the checks reached
Section titled “What the checks reached”Every entry was run on its own code with synthetic and stock inputs, and a sample of one member per monster family and the item casts was played in the game and compared with the catalogue’s reading. That run also measured the re-seed of the catapult bolts. Entries are described only as far as that reach: where a function ends in a call the emulation did not follow, the spec stops its description there and marks the rest as reading.
Short floors left open
Section titled “Short floors left open”Open questions in the spec lists them. In short:
- Baal’s tentacle skill was not reached in a game, so one value that decides which of two draw counts it makes is unknown.
- The charged suffix path and the item do function were not played: no session used an inventory item, and the game log does not say which do entry ran.
- No Act 2 monster of the first monster family was logged.
- What the Iron Maiden handler draws when its damage kills the cursed unit is unknown, and the check does not cover that branch.
- Everything past each entry’s stopping point, which the spec lists per entry, waits for a game session or for a check against monster AI.
Missiles: creation, speed, range, seed and damage
Section titled “Missiles: creation, speed, range, seed and damage”A missile is a unit of its own, created by a skill, an item cast, a monster, a shrine, a quest or another missile. The routine that creates one at a point has 17 callers, counted by three tools: quest, missile and skill functions and two monster AIs, and no shrine. Its life:
Creation, confirmed over 31 391 creations:
- The missile’s seed. Creating it steps the game seed once and makes the missile’s own seed from the result, as for every unit. In one skill’s action frame the game seed chains from one creation to the next (21 860 pairs).
- The speed is the row’s
Vel(or the caster’s given speed) times 256, then times 75 ÷ 100; acceleration and maximum speed as the row gives them. - The range is
LevRange × level + Rangeframes, with no ”− 1”: 271 Blaze missiles at level 2 had 25 × 2 + 90 = 140, where a per-level term from level 2 would give 115. The missile runs at most that many frames, and starts hitting units once itsActivateframes have passed (read from the code).
Emulated, up to the new unit’s allocation (1 577 calls): the owner and class guards, the start point and its room,
the target point, the speed with its per-level term VelLev × level ÷ 8 (with no ”− 1”, against a community source
that counts it per level beyond the first; that reading fails 853 cases above level 1), the Slow Missiles scaling and
the 75 % scaling, and the refusal of a target 100 or more sub-tiles away. What the creation does after the allocation,
the sub-loops of the range among it, is read from the code.
The damage is taken at creation. The weapon share, the owner’s enhanced damage and the elemental damage are stored as the missile’s own stats when it is created, and drawn from at the hit, so the damage does not follow a weapon swap after the missile is fired (read from the code). Two draws happen at creation:
- The critical roll, on the owner’s seed. A missile that takes a share of the weapon’s damage rolls the owner’s critical chain. Confirmed: one step of the owner’s seed per such creation (984), none for any other missile (30 407): the chain’s first roll draws even when its chance is 0. The second and third rolls, after a non-zero chance, were never reached in a game; the whole chain ran under emulation, the code’s map, 3 000 cases. This chain is not the melee build’s, whose first two rolls draw only above a chance of 0; that the order differs too is read from the code.
- The pierce count, on a local seed. For a missile that can pierce and an owner with a pierce chance, a local seed made from the owner’s request counter (see the request above) is stepped up to four times while its roll is below the chance; the count of successes is the missile’s pierce count. Confirmed over 1 066 creations, the owner’s and game seeds untouched. So the count depends on how many skill requests the owner has made.
Missiles: each frame
Section titled “Missiles: each frame”- Missiles move first. Read from the code, every frame runs the missiles, then players, monsters and objects, so every missile steps before any unit acts. Confirmed: a new missile first steps on the frame after its creation (493 of 493 followed).
- Motion, confirmed over 11 413 logged frames: the speed rises by the acceleration on every fifth step and stops at the maximum, the position moves by the step’s shifts along a direction vector, and the frames left fall by one per frame. Read from the code: the direction vector is looked up in a table, not computed with trigonometry.
- No draw of its own. The common step function leaves the missile’s seed unchanged except by the hits inside it. Confirmed on 37 followed frames.
- Town. Read from the code: a player’s missile ends as soon as the player stands in town; a monster’s only for the rows that say so; any missile in a town whose row does not allow it.
- Collision. Read from the code: each missile’s collide type picks which units it can hit (players, monsters,
both, or walls only), and the cells it crosses are tested in turn. A unit there is hit; a wall ends the missile with
its end-of-life hit (its explosion), as does a spent range or a step that does not move it; a blocked cell under the
missile itself frees it without an explosion. Clouds and blizzards mark their cell as holding a missile (a
0x40mark in the collision grid); no stock missile reads that mark.
Missiles: the hit
Section titled “Missiles: the hit”Missiles § E and § F:
- The filters. Read from the code: the missile records the unit as its last one hit before the type and friend filters, which may still refuse it.
- A pierce is spent before the to-hit roll. For a piercing missile with pierces left, one is used (read from the code for its order; see the miss below).
- The to-hit roll, on the owner’s seed. A missile row with a to-hit rolls
low mod 100of the owner’s next draw against the hit chance, with the missile’s own attack rating. A miss frees the missile at that unit, a piercing one having spent its pierce first. Confirmed: 105 misses, 7 with a pierce left. - The hit function of the row, if any, runs and its result decides the missile’s fate (read from the code).
- The damage packet, on the missile’s seed. For each of up to seven damage pairs (physical, fire, magic, lightning, cold, poison, burning) whose bounds are both at least 1, the game draws the damage between them on the missile’s seed; then the enhanced damage percent, and a critical doubles the physical part. Confirmed over 4 118 builds in the two runs (the first run’s 778 had 0, 1 or 2 draws each). Read from the code: once both bounds are found above 0, an inverted pair is swapped (no build of either run had one), then the elemental mastery, read on the missile itself, not on its owner, is added to both bounds, then the draw; and the pair order, which only 19 builds separate. No logged missile carried a mastery stat, so whether a missile ever carries its owner’s mastery is still open.
- Delivery. Read from the code: knockback is one
Range(100)on the missile’s seed, then the defender’s defence rolls on its own seed and the delivery of combat.
The end of a damaging hit, confirmed for rows with no hit function over 3 876 hits: with a pierce left the missile uses one and flies on (130); otherwise it ends at the unit when its row says so (276) and flies on when not (3 470). The rows with a hit function, the filters before the build and the “always explode” rows are read from the code. One stock row (a Royal Strike chain lightning) holds a function number that is negative when read as a signed 16-bit value, so it behaves as a row with no hit function: read from the code.

One invented missile of an invented row, cast at level 10, every number a toy input. Creation sets the velocity to ((VelLev x level) / 8 + Vel) << 8 and then 75 / 100 of it, the range to LevRange x level + Range with the frames left equal to it, and the activate mark to the range less Activate (missiles § B). Each frame the do function steps the velocity (every fifth step adds Accel, a sum above the cap sets the velocity to it and stops the acceleration), moves the position by the step on both axes and takes one off the frames left (§ D, D3 and D4). Only once the frames left are at or below the activate mark does a non-zero word of the missile’s cell start the search for a unit; a unit found there is hit. The hit records the unit as the last one hit before the filters, and a row with a to-hit rolls on the owner’s seed, the owner’s next draw low mod 100: below the chance the damage is built and applied and, with CollideKill, the missile ends there; otherwise the missile is freed at that unit with no damage built (§ E). Not shown: the missile’s own seed, the damage draws, the knockback roll, the defender’s rolls, the town tests, the direction table, and the cells a step crosses (the toy tests the cell the frame ends in). Seed: illustrative, an input of our own. Every value shown is computed by our model, not observed in the game.
Seeds a missile is given: the re-seed sites
Section titled “Seeds a missile is given: the re-seed sites”A missile’s seed is private: only the missile draws on it, except where the code that creates it sets it from the
creator’s value. Two
such sites are confirmed. Firestorm’s sub-missiles (and those of one monster missile) get the seed Init(w + k),
w a position word of the new missile’s path and k the creator’s argument (for Firestorm, the sub-missile’s index), and the new missile’s own path setup
then steps that seed through a random walk, one step for every two of the missile’s range, the range capped at 77 (20 steps for Firestorm’s, 38 for the monster’s). The bolts made for
a catapult spotter get Init(w) from the same path word alone, and the same walk
steps it 10 times. The game’s own logs hold this in 654 of 654 creations, and both setups were checked under emulation. The walk itself is pathing’s. The other sites (the Assassin’s rings and zig-zags, several missile functions)
are read from the code and none was reached by the runs.
Draw order and chaining
Section titled “Draw order and chaining”The order of events in a frame, and so of draws across units, is the server frame. The order in one missile’s life:
Chaining:
- The caster’s seed chains across its skill events. Confirmed in 3 155 of 3 459 consecutive pairs; in the other 304 it lay a few steps further on the same stream, so something drew on it in between. Walking the unit’s own logged draws between two events closes 90 of the first run’s 133 player gaps and 45 of the second’s 148. The player gaps left are listed in the spec, most with the player defending against a hit in between; the monster gaps point at the AI.
- A missile’s draws chain across its hits in one frame (confirmed, 110 checks), and the handlers step their own unit’s seed by their own draws (confirmed, above).
- The finisher had no checked pairs: its order is the code reading.
- Armageddon re-seeds its caster. Read from the code: each period of Armageddon seeds the caster’s seed from a word stored in its skill entry and stores a fresh random number there.
Difficulty, game type and player against player
Section titled “Difficulty, game type and player against player”Overview § C, read from the code: difficulty enters Static Field, curse lengths and a summon’s level-table stats; expansion and player count change nothing in the machinery itself (a monster skill hit’s terms are its attack stats’). Players and monsters differ in the costs, ammunition, delay, checks and the town rules above, and a skill’s line missile carries the owner’s to-hit only for a monster (Double Throw, which adds the skill’s to-hit to its missile after creating it, is the one exception read). Party auras and player against player were not run.
Worked examples
Section titled “Worked examples”Both from the first skills run; both confirmed.
| # | Situation | Result |
|---|---|---|
| 1 | A level-86 Necromancer casts Raise Skeleton at skill level 20 on a corpse | 86 × 3 ÷ 4 = 64, 64 + 20 = 84, max(84, 1) = 84, min(84, 86) = 84: the skeleton is level 84, not 86 or 85; then the caster’s seed steps once |
| 2 | A Druid casts Firestorm | one maker missile, then the sub-missiles; each is first seeded from the game seed, then re-seeded to Init(w + k) with its index k and stepped 20 times by its path setup, so two sub-missiles with the same w differ only through k |
In example 1 what the caster’s step is used for (a roll against the skill’s Param1 of 5) was not logged. In
example 2 the order of the sub-missile creations is the code reading.
What is not known yet
Section titled “What is not known yet”From the specs’ open questions:
- What each numbered function outside tier A does past its stopping point: the catalogue’s short floors are in its own section. Client-only skill and missile code is presentation and out of scope.
- The server’s handling of a refused request (codes 2 to 5 and 7, starting mana, item charges, Blood Mana, the town refusal), which a stock client never sends; it needs a two-client game or a patched client.
- Handlers no session fired, and the effects of the measured ones beyond their draws.
- A monster’s attack stats: the level table’s
Lcolumns, the classic and expansion terms, the second and third elemental attacks, and the owner’s skill damage past the Raven at one level with one player. - Summons: their other stats, a summon class scaled by level, the golems, Raise Skeleton’s level gate and the mage’s draw; two pet types’ special cases in the pet limit and where the summon’s pet type is filled in.
- The caster gaps left (43 and 103 player gaps over the two runs) and the monster gaps. Their logs hold no AI line; with the AI logged, 41 of 49 new gaps of this shape close.
- Which frame carries the action, and the unit field behind two frame tests: animation timing.
- The finisher in a run.
- The skill-level bonus term by term against a character’s item stats, and whether a ranged attack ever raises the melee-attack event; which event the curse code registers at run time.
- Missiles: the end of a hit for rows with a hit function, the filters before the build, the “always explode” rows and the end-of-life branch in a run; the speed’s per-level term, the slow-missiles scaling, the extra loops and the distance refusal; the re-seed sites other than Firestorm’s and the catapult bolts’; the critical chain’s second and third rolls; how a new missile joins the every-frame list; and the unit filter of a missile used as a skill’s unit, and the fifth list of the frame pass; and whether a missile ever carries its owner’s elemental mastery, which no logged missile did.
Where to read more
Section titled “Where to read more”- The specs: skills overview, dispatch and missiles, and the catalogue for the numbered functions. Each Reimplementation notes section lists the traps for someone rebuilding the system.
- The glossary for D2 terms: start and do functions, progressive charges and the finisher, the server missile, pet type and pet limit.
- Related wiki pages: animation and timing (the do frame, the skill delay and the length of a cast or attack), combat (what a skill hit or a missile hit enters), stats and states (the timed states, auras and the stats a skill reads), randomness (unit seeds and re-seeds), monsters (a summon’s creation and stats), pathing (the planners a skill or a missile asks for), economy (ammunition and wear) and how we know.