Difference between revisions of "Attack speed"

From CrawlWiki
Jump to: navigation, search
(Major rewrite. Lots (maybe too much) information added. Still work to do.)
Line 1: Line 1:
{{Version014}}
+
{{Version028}}
  
 
''See [[Weapon Speed]] for tables summarising this information.''
 
''See [[Weapon Speed]] for tables summarising this information.''
 +
''This page goes into great detail about attack delay calculations.''
  
When deciding between two different weapons, it can be helpful to understand exactly how attack speed works. Each physical attack in ''Crawl'' causes a certain amount of delay, which is the amount of time measured in [[aut]]s before you can act again. A character with a small attack delay will swing more frequently than a character with a large attack delay. As this greatly multiplies the damage you can inflict in combat, it is strongly recommended to get your attack delay as low as possible.
+
When deciding between two different weapons, it can be helpful to understand exactly how attack speed works. Each physical attack in ''Crawl'' takes a certain amount of time. A character with a smaller attack delay will swing more frequently than a character with a larger attack delay. This can greatly multiply how often you can inflict damage in combat. So it is strongly recommended to get your attack delay as low as possible.
  
==Base and adjusted attack delay==
+
==Attack Delay Calculations for Weapons and Missles==
The base attack delay of a weapon is listed upon examination. For example, examining a [[hand axe]] shows that its speed is 130%. To convert this to base delay, simply chop off the last 0. Our hand axe has a base delay of 13, meaning it takes 13 auts to recover from your attack.
+
*Note that [[strength]], [[dexterity]] and [[armour]] have no effect on attack delay.
 +
===Base attack delay===
 +
All weapons, thrown objects, and launched objects have a base attack delay. You can find this information in game by examining the weapon or launcher. The base attack delay in game should be multiplied by 10 to give the delay in [[aut]]s. The [[Weapon Speed]] page has a complete tables and includes thrown objects. It also lists the base delay in [[aut]]s. For reference most species move and cast spells with a delay of 10 [[aut]]s.
 +
===Minimum attack delay===
 +
By raising your skill with the weapon or launcher you can reduce attack delays to the minimum attack delay. The minimum delay is usually 1/2 the base delay rounded down. If this is greater than 7 then the minimum attack delay is set to 7. There are three exceptions to this rule:
 +
*[[Short blades]]: The rapier with a base delay of 12 has a minimum delay of 5.
 +
*All [[Crossbows]] have a minimum delay of 10.
 +
*The [[Woodcutter's axe]] always has a delay of 10 irregardless of skills.
 +
===Skill adjustments===
 +
Weapon, launcher, or throwing skills brings down the attack delay by <code>(skill level)/2</code> until you reach minimum weapon delay. Increasing your skill beyond that will not let you attack faster but it will slightly improve your damage and accuracy with the weapon. Normally you turn off your weapon skill when you hit minimum delay and dump experience points into increasing skills in other areas. The gods [[Ashenzari]] and [[Okawaru]] can increase your weapon skills and thus contribute to lowering your weapon delay.
 +
===Speed Brand===
 +
The [[speed (brand)|speed brand]] further reduces the delay to 2/3 of the skill adjusted delay.
 +
With skill and speed brand improvements there is a hard coded minimum delay of 3.
 +
===Shield Penalties===
 +
[[Shields]] will slow down weapon speed. This slow down can be reduced by increasing your [[shields (skill)|shield skill]].
 +
The detailed formula is <code>2*(shield encumberance)^2*(270-(10x shield skill))*scale/(5*(20-3*(size factor))/270</code>.
 +
The values for shield encumberance and size factor can be found on the [[shields]] page. The scale used in this formula is 20. The game does display the [[Encumbrance rating|shield encumberance]] when describing the item, but it does not report the character size factor. Notice the shield penalty can be reduced to zero with a shield skill of 27.
 +
===God Given Abilities===
 +
The god [[Okawaru]]'s Finesse ability will further cut the delay in half. Note that this will not stack with haste nor berserk.
 +
===Status modifiers===
 +
*[[Potion of haste|Haste]] and [[berserk]] will further reduce the delay to 2/3 of its calculated value if you have not invoked Finesse. You cannot be both hasted and berserked.
 +
*[[Statue Form]], [[Petrify]]ing, and [[Slow]]ness will increase the delay to 3/2 of the calculated value. These status conditions do stack with haste resulting in a net cancellation of the two different statuses. Slowness can stack with both statue form and petrifying.
 +
*In no case, will the delay be reduced below 2.
  
Having skill levels in a weapon's associated skill will decrease this delay. Take your weapon skill and divide it by two, rounding down. Subtract the result from the weapon's base delay to determine your adjusted delay. So if you have a skill of 2 in [[Axes]], your hand axe would have an adjusted delay of 12. As soon as you reached a skill of 4 in Axes, the adjusted delay would decrease to 11.
+
==Unarmed Combat==
 +
[[Unarmed combat]] has a different attack delay calculation. It is <code>10-(unarmed combat skill)/54</code>. You start with a delay of 10 with no unarmed combat skill and reach a minimum delay of 5 with an unarmed combat skill of 27. The shield penaties, god given abilities and status modifiers apply to unarmed combat as well.
  
==Minimum delay==
+
==Spells==
Weapons can't just keep getting faster and faster. All weapons have a minimum delay. Once reached, gaining more weapon skill won't decrease the delay any further (but will still slightly improve your damage and accuracy). To find out the minimum delay for a particular weapon, take the base delay, divide it by two, and drop the remainder. So, our hand axe with a base delay of 13 has a minimum delay of 6. That means that our weapon skill can at most lop seven points off of the hand axe's base delay. Once you hit an Axe skill of 14, that hand axe is going to be swinging as fast as it is going to get.
+
Spells can be used for attacking and thus are included on this page. The base delay for casting a spell is 10. It can be modified by status modifiers but delay is not affected by skill, shields, or god abilities.
 +
An exception to this is the spell [[Manifold Assault]]. The delay of casting manifold assault is the calculated weapon or unarmed combat delay.
  
===Exceptions===
+
==Movement Based Attacks==
There are a couple of exceptions to the minimum delay calculation. First, if the weapon in question is a short blade and the calculated minimum delay is larger than five, then the minimum delay is adjusted to five. As a result, even though [[cutlass]]es have a base delay of 12, their minimum delay is 5 instead of 6.
+
Some attacks are combined with movement. Even if the actual attack delay is not changed, they are mentioned here for completeness.
 +
===Martial Arts Attacks===
 +
The [[Wu Jian]] Council allows a player to make a number of different martial arts attacks. The number of attacks is based on the attack delay and the movement delay. The movement delay is:
 +
*10 if you have invoked the serpent's lash ability, or
 +
*twice your movement delay if you have invoked the wall jump ability. (The wall jump ability takes two turns.)
 +
*Otherwise your normal movement delay is used.
 +
Your attack delay is the delay calculated in the previous sections. The number of attacks is the movement delay divided by the attack delay. If this is not an integer, the number of attacks could be rounded up or down. The number of attacks will average out to the non-integer number of attacks calculated. Extreme examples of the numbers of attacks would be a spriggan wielding a triple cross bow. With a movement delay of 6 and an attack delay of 23 the spriggan would only make one attack 6/23 of the time. The other extreme would be a naga wielding a quick blade with sufficient short blade skill. The naga's movement delay would be 14 and the weapon delay would be 3. For a wall jump which counts as two turns the expected number of attacks would be 28/3. So there could be 10 attacks 1/3 of the time.
 +
*Note that the serpent's lash ability allows you to take two turns to make martial arts attacks without taking any time.
 +
===Charging Attacks===
 +
*The [[rampaging]] ego allows you to move towards a target and attack. The time taken is the attack delay and not the movement delay. Even a naga wielding a quick blade with sufficient [[short blade]] skill can move and attack a target with a delay of 3. Compare this with a naga's movement delay of 14.
 +
*A [[palentonga]]'s rolling charge allows you to move towards a target and attack. The time taken is the maximum of a movement delay or an attack delay.
 +
===Bolt Attacks===
 +
There are attacks that can hit multiple targets as you move through them like a bolt.
 +
*[[Storm Form]] has the blink bolt ability to move through many targets at once doing damage to each.
 +
*[[Uskayaw]]'s line pass ability has the same properties.
 +
===Instintaneous attacks===
 +
Some spells and abilities let you appear somewhere else and immediately make an attack without any delay.
 +
*[[Passwall]] takes time to set up on one side of a rock wall. But you appear on the other side and can attack without targets being able to react to you first. This is different than blink which moves you to a new location and then you stay there for the turn delay.
  
The second exception is if the calculated minimum delay is larger than 7. In such a case, the minimum delay is set to 7. This mostly happens with big two handed weapons. Because of this exception, an [[executioner's axe]] with a base delay of 20 has a minimum delay of 7 instead of 10.
+
==Detailed Calculations==
 +
The formulas above give you a very close approximation to the average attack delay. Most players can use the values above or the values on the [[weapon speed]] page without needing to know about the detailed calculations in this section.
 +
===Averaging Fractional Delays===
 +
Most calculations above can result in fractional delays. If you have a [[short sword]] with a base delay of 11 and a [[short blades|short blade skill]] of 5.7, the formula above would give you an average delay of <code>11-5.7/2 = 8.15</code>. The game mechanics give you an average delay by rolling a delay of 8 85% of the time and a delay of 9 15% of the time. This is needed because all delays are integer values of [[aut]]s.
 +
===Using Statistical Random Variables===
 +
The fractional delays do not give the entire story because each stage attack delay calculations involve creation of a new random variable. These random variables actually contain all possible integer delays and their weighted probabilities. This can result in a much wider range of attack delays than the averaging of fractional delays would imply. To complicate things, all calculations are done with a fixed precision.
 +
This is best explained by examples.
 +
====Example 1====
 +
Let's use the example of a [[human]] wielding a short sword and a buckler. The human has a [[short blade|short blade skill]] of 7.5 and a shield skill of 4. The [[buckler]]'s encumberance is 5. The human size factor is zero and can be found on the [[shields]] page. There are three random variabls used.
 +
*The first is the base delay of the short sword of 11 [[aut]]
 +
*The second random variable encorporates the additional skill adjustment delay of -skill*10/scale = -75/20
 +
*The third random variable encorporates the additional shield penalty delay of 8/20
 +
*The final probabilities: delay=7 47.4%, delay=8 47.4%, delay=9 5.3%
  
There is also a hard-coded minimum weapon delay of 3. If the calculated minimum delay is less than 3, it gets set to 3.
+
{| class="wikitable"
 +
|- align="center"
 +
!
 +
!colspan="8"|Delays|
 +
|-
 +
! Explaination !! 6 !! 7 !! 8 !! 9 !! 10 !! 11 !! 12 !! 13 !! Total Weight
 +
|-
 +
|Base delay<br>short sword
 +
|  ||  ||  ||  ||  || 1  ||  || || 1
 +
|-
 +
|Subtract Skill reduction<br>7.5*scale/20
 +
|  || 15  || 5  ||  ||  ||    ||  ||  || 20
 +
|-
 +
|Add shield penalty<br>
 +
2*(5)^2*(270-(10*4))*20<br>/(5*(20-3*(0))/270
 +
<br>=2300/270=8
 +
|  || 15*12  || 15*8 + 5*12  || 5*8  ||  ||    ||  ||  ||
 +
|-
 +
|Shield Penalty Weights
 +
|  || 180 || 180  || 20  ||  ||    ||  ||  || 380
 +
|}
 +
*Note that there are three possible delays, not just two based upon one average
 +
*A scale is used to create weights which avoids large integer division truncation inaccuracies
 +
*A random number from 0-380 is created and a delay is selected based upon which bin the number would fall into.
  
The [[speed brand]] comes into effect after the check against the minimum attack delay is done. A weapon with the speed brand will attack faster than the calculated minimum delay. Attacks made with speed branded weapons take only 66% as long as normal. If a weapon's normal speed can't divide cleanly into thirds, then the speed of each attack will be rounded up or down to the nearest integer.
+
==References==
 +
<references/>
  
[[Shields]] can potentially add extra delay to your attacks. To calculate the delay added, you first need to know your adjusted shield penalty:
+
==History==
 
 
Adjusted Shield Penalty = Base Shield Penalty - ([[Shields skill]]/Racial Modifier)
 
 
 
The base shield penalty is 0.8/3/5 for [[buckler]]s/[[kite shield]]s/[[tower shield]]s, and the racial modifier is 3/5/7/9 for [[size|large/medium/small/little]] characters. Throw away any remainder on the division. So a medium size character would have an adjusted shield penalty of 0 when wielding a buckler at shield skill 4, a shield at shield skill 15, and a large shield at shield skill 25.
 
 
 
After calculating your adjusted shield penalty, the game selects two random integers between 1 and your adjusted shield penalty. The smaller one is used as the delay added by the shield. Once your adjusted shield penalty reaches 0 there is no added delay.
 
 
 
At this point, if the weapon delay plus the shield delay is less than 3, it is set to 3, but this is something that never happens.
 
 
 
==Final modifiers==
 
So, now we have an adjusted weapon delay after taking our weapon and shield into consideration. We aren't done yet. If [[slow]]ed or in [[Statue Form]], this value is multiplied by 1.5. If we are [[haste]]d or [[berserk]], it is divided by 1.5. Under [[Finesse]], it is divided by 2. The result of this calculation is an integer, but whether it is rounded up or down is randomized, weighted by the remainder.
 
 
 
For example, say you are wielding a [[demon whip]], and have enough mace skill to reach the minimum delay of 5. You berserk. The berserk divider is 1.5, so your delay value is 3.333. Delays must be integer values though, so 2/3 of the time your delay will be rounded to 3, and 1/3 of the time your delay will be rounded to 4. In effect, you get your delay of 3.333.
 
 
 
The smallest delay you are allowed to swing with is 2. If the final calculation spits out a value less than 2, it is set to 2. That means that you only receive half the speed bonus of Finesse if your mindelay is already 3 (Bear in mind that this still results in a massive boost to damage output).
 
 
 
The functions which calculate the delay can be found in melee_attack.cc. See melee_attack::calc_attack_delay and its sub-functions.
 
 
 
http://git.develz.org/?p=crawl.git;a=blob;f=crawl-ref/source/melee_attack.cc
 
  
 
[[Category:Game mechanics]]
 
[[Category:Game mechanics]]

Revision as of 02:41, 13 April 2022

Version 0.28: This article may not be up to date for the latest stable release of Crawl.

See Weapon Speed for tables summarising this information. This page goes into great detail about attack delay calculations.

When deciding between two different weapons, it can be helpful to understand exactly how attack speed works. Each physical attack in Crawl takes a certain amount of time. A character with a smaller attack delay will swing more frequently than a character with a larger attack delay. This can greatly multiply how often you can inflict damage in combat. So it is strongly recommended to get your attack delay as low as possible.

Attack Delay Calculations for Weapons and Missles

Base attack delay

All weapons, thrown objects, and launched objects have a base attack delay. You can find this information in game by examining the weapon or launcher. The base attack delay in game should be multiplied by 10 to give the delay in auts. The Weapon Speed page has a complete tables and includes thrown objects. It also lists the base delay in auts. For reference most species move and cast spells with a delay of 10 auts.

Minimum attack delay

By raising your skill with the weapon or launcher you can reduce attack delays to the minimum attack delay. The minimum delay is usually 1/2 the base delay rounded down. If this is greater than 7 then the minimum attack delay is set to 7. There are three exceptions to this rule:

  • Short blades: The rapier with a base delay of 12 has a minimum delay of 5.
  • All Crossbows have a minimum delay of 10.
  • The Woodcutter's axe always has a delay of 10 irregardless of skills.

Skill adjustments

Weapon, launcher, or throwing skills brings down the attack delay by (skill level)/2 until you reach minimum weapon delay. Increasing your skill beyond that will not let you attack faster but it will slightly improve your damage and accuracy with the weapon. Normally you turn off your weapon skill when you hit minimum delay and dump experience points into increasing skills in other areas. The gods Ashenzari and Okawaru can increase your weapon skills and thus contribute to lowering your weapon delay.

Speed Brand

The speed brand further reduces the delay to 2/3 of the skill adjusted delay. With skill and speed brand improvements there is a hard coded minimum delay of 3.

Shield Penalties

Shields will slow down weapon speed. This slow down can be reduced by increasing your shield skill. The detailed formula is 2*(shield encumberance)^2*(270-(10x shield skill))*scale/(5*(20-3*(size factor))/270. The values for shield encumberance and size factor can be found on the shields page. The scale used in this formula is 20. The game does display the shield encumberance when describing the item, but it does not report the character size factor. Notice the shield penalty can be reduced to zero with a shield skill of 27.

God Given Abilities

The god Okawaru's Finesse ability will further cut the delay in half. Note that this will not stack with haste nor berserk.

Status modifiers

  • Haste and berserk will further reduce the delay to 2/3 of its calculated value if you have not invoked Finesse. You cannot be both hasted and berserked.
  • Statue Form, Petrifying, and Slowness will increase the delay to 3/2 of the calculated value. These status conditions do stack with haste resulting in a net cancellation of the two different statuses. Slowness can stack with both statue form and petrifying.
  • In no case, will the delay be reduced below 2.

Unarmed Combat

Unarmed combat has a different attack delay calculation. It is 10-(unarmed combat skill)/54. You start with a delay of 10 with no unarmed combat skill and reach a minimum delay of 5 with an unarmed combat skill of 27. The shield penaties, god given abilities and status modifiers apply to unarmed combat as well.

Spells

Spells can be used for attacking and thus are included on this page. The base delay for casting a spell is 10. It can be modified by status modifiers but delay is not affected by skill, shields, or god abilities. An exception to this is the spell Manifold Assault. The delay of casting manifold assault is the calculated weapon or unarmed combat delay.

Movement Based Attacks

Some attacks are combined with movement. Even if the actual attack delay is not changed, they are mentioned here for completeness.

Martial Arts Attacks

The Wu Jian Council allows a player to make a number of different martial arts attacks. The number of attacks is based on the attack delay and the movement delay. The movement delay is:

  • 10 if you have invoked the serpent's lash ability, or
  • twice your movement delay if you have invoked the wall jump ability. (The wall jump ability takes two turns.)
  • Otherwise your normal movement delay is used.

Your attack delay is the delay calculated in the previous sections. The number of attacks is the movement delay divided by the attack delay. If this is not an integer, the number of attacks could be rounded up or down. The number of attacks will average out to the non-integer number of attacks calculated. Extreme examples of the numbers of attacks would be a spriggan wielding a triple cross bow. With a movement delay of 6 and an attack delay of 23 the spriggan would only make one attack 6/23 of the time. The other extreme would be a naga wielding a quick blade with sufficient short blade skill. The naga's movement delay would be 14 and the weapon delay would be 3. For a wall jump which counts as two turns the expected number of attacks would be 28/3. So there could be 10 attacks 1/3 of the time.

  • Note that the serpent's lash ability allows you to take two turns to make martial arts attacks without taking any time.

Charging Attacks

  • The rampaging ego allows you to move towards a target and attack. The time taken is the attack delay and not the movement delay. Even a naga wielding a quick blade with sufficient short blade skill can move and attack a target with a delay of 3. Compare this with a naga's movement delay of 14.
  • A palentonga's rolling charge allows you to move towards a target and attack. The time taken is the maximum of a movement delay or an attack delay.

Bolt Attacks

There are attacks that can hit multiple targets as you move through them like a bolt.

  • Storm Form has the blink bolt ability to move through many targets at once doing damage to each.
  • Uskayaw's line pass ability has the same properties.

Instintaneous attacks

Some spells and abilities let you appear somewhere else and immediately make an attack without any delay.

  • Passwall takes time to set up on one side of a rock wall. But you appear on the other side and can attack without targets being able to react to you first. This is different than blink which moves you to a new location and then you stay there for the turn delay.

Detailed Calculations

The formulas above give you a very close approximation to the average attack delay. Most players can use the values above or the values on the weapon speed page without needing to know about the detailed calculations in this section.

Averaging Fractional Delays

Most calculations above can result in fractional delays. If you have a short sword with a base delay of 11 and a short blade skill of 5.7, the formula above would give you an average delay of 11-5.7/2 = 8.15. The game mechanics give you an average delay by rolling a delay of 8 85% of the time and a delay of 9 15% of the time. This is needed because all delays are integer values of auts.

Using Statistical Random Variables

The fractional delays do not give the entire story because each stage attack delay calculations involve creation of a new random variable. These random variables actually contain all possible integer delays and their weighted probabilities. This can result in a much wider range of attack delays than the averaging of fractional delays would imply. To complicate things, all calculations are done with a fixed precision. This is best explained by examples.

Example 1

Let's use the example of a human wielding a short sword and a buckler. The human has a short blade skill of 7.5 and a shield skill of 4. The buckler's encumberance is 5. The human size factor is zero and can be found on the shields page. There are three random variabls used.

  • The first is the base delay of the short sword of 11 aut
  • The second random variable encorporates the additional skill adjustment delay of -skill*10/scale = -75/20
  • The third random variable encorporates the additional shield penalty delay of 8/20
  • The final probabilities: delay=7 47.4%, delay=8 47.4%, delay=9 5.3%
Delays|
Explaination 6 7 8 9 10 11 12 13 Total Weight
Base delay
short sword
1 1
Subtract Skill reduction
7.5*scale/20
15 5 20
Add shield penalty

2*(5)^2*(270-(10*4))*20
/(5*(20-3*(0))/270
=2300/270=8

15*12 15*8 + 5*12 5*8
Shield Penalty Weights 180 180 20 380
  • Note that there are three possible delays, not just two based upon one average
  • A scale is used to create weights which avoids large integer division truncation inaccuracies
  • A random number from 0-380 is created and a delay is selected based upon which bin the number would fall into.

References


History