Skip to main content

Combat routines

Routines · Data · Address index

Weapon attacks, hit rolls, damage, and flying objects that hit monsters or the party. The routines page explains how the entries are written.

0x1fdb9, 0x1f930 — Use a weapon slot, melee attack​

0x1fb78, 0x1fab3 — Throw a weapon, refill the hand​

  • Ranges: 0x1fb78–0x1fbfc; 0x1fab3–0x1fb77
  • Role: 0x1fb78 (item kind 2) launches the hand item from the party's block at the launch position of the character's row (slots 0 and 1 front, 2 to 5 back), with the item's type as weapon type. Only when the launch succeeds (0x1fbbd) does it play sound 0x0b, clear the hand and call 0x1fab3 (0x1fbec). Returns 0. 0x1fab3(character, hand slot, type, quiver) moves into the hand the first item of inventory slots 24, 23 and 22 whose type is not type, or the first item at all when type is −1 (0x1fb06–0x1fb6a). With quiver nonzero and a quiver that is not empty, it takes the top quiver item instead (0x1fabd–0x1fb00). Its only caller passes −1 and 0 (0x1fbe0–0x1fbe6), so the game uses neither the quiver branch nor the type test.
  • Used by: On the floor and in the air › Throwing and launching items, Sound effects

0x1fbfd — Use a launcher​

0x1f55c — A character's hit roll​

0x1ac5f — A monster's hit roll​

0x20662 — Damage to a monster​

  • Range: 0x20662–0x20807; 0x1ecb6 is the evasion test and 0x1f7a1 the missile test (item kind 2 or 3)
  • Role: Arguments: monster, count or attacker, sides or item, bonus or strength switch, damage flags, saving-throw category and effect. With flag 0x100, the weapon damage; otherwise a dice roll. Unless the category is 5, a saving throw(monster, 0, type level +0x02, category, race 6) reduces the damage (0x206d7–0x2070c). Flags 0x110 with an item that is not a missile give 1 (0x2070e). Flag 0x100 with immunity 0x0100 halves the damage unless the class byte of item-type entry item number, at DS:0x9473 + 16 × item, has 0x04 (0x20736–0x20756): the entry is indexed by the item, not its type, and item numbers of 64 and more read past the table. Immunity 0x2000 divides weapon damage by 4 for a value below 3 and by 2 for 3, giving the value when the result is 0, and halves other damage (0x20758–0x207b4). Flag 0x01 with 1d100 below the type's signed byte +0x2a gives 0. Then each pair of the immunity pair table whose flag and immunity are both set gives 0 (0x207d1–0x207fe). Returns the damage as a signed word; 0x20808 applies it when positive.
  • Comparative source: REF-SCUMM-013, calcMonsterDamage, calcDamageModifers, tryMonsterAttackEvasion.
  • Used by: Damage to a monster › How the damage is reduced, Kinds of damage dealt to a monster, Monster immunities, Damage flags › Effects, Level data (INF), Anomalies and bugs

0x1f8b8 — A flying object hits a monster​

  • Range: 0x1f8b8–0x1f92f
  • Role: Arguments: a flight record and a monster slot. When the record's launcher (+0xb) is a character, makes the hit roll with attack type 0 (dexterity) and returns 0 on a miss; with −1 (a monster, a wall or a script) there is no roll. Then calls 0x20808(monster, launcher, item, 0, flags, 5, 3) with flags 0x110, or 0x910 for a character's throw, and returns 1. The item of the record, the flying one, gives the value and the dice.
  • Used by: Flying weapons › What a flying item hits

0x1f7c9 — A flying object hits the party​

  • Range: 0x1f7c9–0x1f8b7; the two > 2 tests are at 0x1f824 and 0x1f83b
  • Role: Argument: a flight record. Turns the item's quarter into a quarter relative to the party with DS:0x2352 (0 front left, 1 front right, 2 back left, 3 back right) and picks up to two characters in DS:0x5530 from twice that quarter, adding 1d2 − 1 when the quarter is above 2. Each candidate that passes the eligibility test with mask 3 takes damage(character, −1, item, 0, 0x110, 5, 3); no hit roll is made. A second candidate is tried only when the quarter is above 2 and the record's direction is the party's or its opposite; the loop ends after the first candidate otherwise (0x1f89d–0x1f8ad). Returns 1 when someone was hit. The front/back test of the loop is < 2, the other two > 2: the location of the back-left anomaly.
  • Comparative source: REF-SCUMM-014, flyingObjectPartyHit.
  • Used by: Flying weapons › What a flying item hits, Anomalies and bugs, Damage flags › Item-based damage

0x1b51e — A monster at a place​

  • Range: 0x1b51e–0x1b54c
  • Role: Arguments: a monster slot, a block, a position and a switch. Returns 1 when the monster stands on that block at that position, or at position 4, the middle of the block, when the switch is set. The flying-object hit test calls it with the switch set for every slot.
  • Used by: Flying weapons › What a flying item hits