# Damage

*809*pages on

this wiki

**Damage**is anything that causes B.J. Blazkowicz or an enemy to lose health. Damage may arise from being shot by an enemy, or bitten by Dogs, through attacks with projectiles, or by contact with Ghosts. Too much damage and they will die. This article explains the mechanics behind various enemy attacks on the player in

*Wolfenstein 3D*and

*Spear of Destiny*, as well as player attacks on the enemy.

## Factors that affect damageEdit

Various kinds of attacks calculate how much damage is dealt differently. The following factors affect the damage dealt:

### Random numbersEdit

The primary decisive factor is that of two random numbers, each of which is between, and including, 0 and 255.^{[1]}

### DifficultyEdit

Playing on “Can I play, Daddy?” difficulty divides all damage you take by four.^{[2]}

### Enemy TypeEdit

SS guards and Bosses are considered better shots in the game, so for any calculations the distance used for calculating hit or damage is reduced by one third.^{[3]}

### DistanceEdit

The further away you are, the lesser chance of the enemy hitting you, and the less damage you will take. This only applies to hitscans.

### SpeedEdit

If the player is running, the enemy’s chance of hitting you is reduced.^{[4]} This only applies to hitscans.

### LookingEdit

If you can see the enemy shooting at you, you have half as much chance of being hit as if they are shooting you from out of the player’s view. This is because the game assumes B.J. would be more likely to ‘see’ the enemy shooting at him and would try to dodge the shot.^{[4]} This only applies to hitscans.

## Hit FormulaeEdit

The following variables will be referred to:

- [DIST]
- Distance between enemy and player (in number of squares).
- [SPEED]
- 160 (if player is running) or 256 (if player isn't).
- [LOOK]
- 16 (if player can see the shooter) or 8 (if the player can’t).
- [RAND1]
- A random number between 0 and 255 (inclusive).
^{[1]}Used for hit calculation. - [RAND2]
- A second random number between 0 and 255 (inclusive).
^{[1]}Used for damage calculation.

### HitscansEdit

*Main article:Hitscan*

Hitscans are the game's method of calculating bullets. There are two calculations for hitscans: one to determine if the player is hit, followed by one to determine how much damage is dealt.

The Formula to calculate a hit is:

If shooter is SS or Boss then: [DIST] = [DIST] x (2 / 3) Player is considered hit if: [RAND1] < ( [SPEED] - ( [DIST] x [LOOK] ) )

If the player is hit then the second calculation is performed to determine how much damage the player will take. The Formula to calculate damage is:

If shooter is SS or Boss then: [DIST] = [DIST] x (2 / 3) If ( [DIST] less than 2 ) then damage is: [RAND2] / 4 If ( [DIST] between 2 and 4 ) then damage is: [RAND2] / 8 If ( [DIST] is 4 or more ) then damage is: [RAND2] / 16 If “Can I play daddy” then [DAMAGE] = [DAMAGE] / 4

#### ExampleEdit

The player is shot at by a normal guard from 2 squares away. The player can see the shooter, but was only walking at the time. The first random number is 69.

[RAND1] < ( [SPEED] - ( [DIST] x [LOOK] ) ) 69 < (256 - (2 x 16)) 69 < (256 - 32) 69 < 224

The statement is true so the player received a hit! Now to calculate damage. The second random number is 140. The distance was 2, so the formula is:

[RAND2] / 8 140 / 8 17.5

Due to the use of bit shift the result is rounded down to 17. Therefore the player would lose 17 health as a result from the guard shooting the player in this example.

### BitesEdit

Dogs can only attack when the player is in the adjacent square using the following formula:^{[5]}

Player is bitten if [RAND1] < 180 Damage taken = [RAND2] / 16

### ProjectilesEdit

Many characters shoot projectiles, including Fake Hitlers, Dr Schabbs, General Fettgesicht and Otto Giftmacher .

The player can dodge these projectiles so no calculation is done to determine hit chance, only damage:^{[6]}

Needle damage = ( [RAND2] / 8 ) + 20 Rocket damage = ( [RAND2] / 8 ) + 30 Fireball damage = ( [RAND2] / 8 )

### GhostsEdit

Ghosts and Spectres only do damage upon contact with the player:^{needs verification}

Damage = 10

## Player shootingEdit

The formula used to determine the damage given to an enemy by the player is as follows:^{[7]}^{[8]}

### KnifeEdit

[DAMAGE] = [RAND2] / 16

### GunEdit

If ( [DIST] is 4 or more ) then only hit if ( ( [RAND1] / 12 ) < [DIST] ). If ( [DIST] is less than 2 ) then [DAMAGE] = [RAND2] / 4 If ( [DIST] is 2 or more ) then [DAMAGE] = [RAND2] / 6

## ReferencesEdit

- ↑
^{1.0}^{1.1}^{1.2}WOLFSRC/ID_US_A.ASM from the*Wolfenstein 3D*source code on github.com - ↑ WOLFSRC/WL_AGENT.C from the
*Wolfenstein 3D*source code on github.com, line 386 - ↑ WOLFSRC/WL_ACT2.C from the
*Wolfenstein 3D*source code on github.com, line 3461 - ↑
^{4.0}^{4.1}WOLFSRC/WL_ACT2.C from the*Wolfenstein 3D*source code on github.com, line 3464 - ↑ WOLFSRC/WL_ACT2.C from the
*Wolfenstein 3D*source code on github.com, line 3530 - ↑ WOLFSRC/WL_ACT2.C from the
*Wolfenstein 3D*source code on github.com, line 302 - ↑ WOLFSRC/WL_AGENT.C from the
*Wolfenstein 3D*source code on github.com, line 1133 - ↑ WOLFSRC/WL_AGENT.C from the
*Wolfenstein 3D*source code on github.com, line 1168