Difference between revisions of "Attack speed"

From CrawlWiki
Jump to: navigation, search
m
(simplify the detailed calculations)
Line 24: Line 24:
 
* The [[speed brand]] reduces your weapon delay by x66%.
 
* The [[speed brand]] reduces your weapon delay by x66%.
 
* The [[heavy]] brand increases your weapon's delay by +50%.
 
* The [[heavy]] brand increases your weapon's delay by +50%.
 +
 +
===Body Armour===
 +
If you are using a "[[Ranged Weapons|Ranged Weapon]]" (which does ''not'' include [[Throwing]] weapons), then [[body armour]] will slow down your attack speed (after brand). Body armour slows down attacks based on its [[encumbrance rating]].
 +
 +
The formula is <code>(encumbrance^2 / 2250) * (90 - 2 * [[Armour (skill)|ar,_skill]]) / (3 + str)</code> aut.
 +
 +
Values for armour encumbrance can be found on the [[Armour]] page. Unlike shields, the penalty cannot be fully eliminated with skill.
  
 
===Shields===
 
===Shields===
Line 31: Line 38:
  
 
The values for shield encumbrance can be found on the [[Shields]] page. The shield penalty can be reduced to zero with a maxed out shield skill of 27.
 
The values for shield encumbrance can be found on the [[Shields]] page. The shield penalty can be reduced to zero with a maxed out shield skill of 27.
 
===Body Armour===
 
If you are using a "[[Ranged Weapons|Ranged Weapon]]" (which does ''not'' include [[Throwing]] weapons), then [[body armour]] will slow down your attack speed. Body armour slows down attacks based on its [[encumbrance rating]].
 
 
The formula is <code>(encumbrance^2 / 2250) * (90 - 2 * [[Armour (skill)|ar,_skill]]) / (3 + str)</code> aut.
 
 
Values for armour encumbrance can be found on the [[Armour]] page. Unlike shields, the penalty cannot be fully eliminated with skill.
 
  
 
===Statuses===
 
===Statuses===
Line 69: Line 69:
  
 
==Detailed Calculations==
 
==Detailed Calculations==
{{Too Complex}}
+
The formulas above give you a very close approximation to the average attack delay. However, each individual attack is subject to multiple sources of randomness:
'''Note: Shield penalties have not been updated to 0.30.'''
+
 
 +
* If your weapon delay is in fractional [[aut]], then it is rounded in a weighted fashion. For example, if you "average" attack at 5.1 aut (0.51 decaAut), then you have a 10% chance to attack at 6 aut, and 90% chance to attack at 5 aut.
 +
 
 +
* If you wear a [[shield]], the penalty is randomized. First, the EV penalty (<code>2/5 * encumbrance^2 / (5 + [[str]]) * (27 - [[Shields (skill)|sh_skill]]) / 27</code>) is rounded in a weighted manner. Then, the game will roll 1d(EV_penalty), determining the actual aut delay per attack.
  
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.
+
* If you are using a [[ranged weapon]], then the penalty from [[body armour]] is also rounded in a weighted manner.
  
===Averaging Fractional Delays===
+
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.
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===
+
===Example===
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.
+
Take a human wielding a short sword and buckler. The human has a [[short blade|short blade skill]] of 7.5, shield skill of 4, and strength of 15. The [[buckler]]'s encumbrance is 5.
This is best explained by examples.
 
  
====Example 1====
+
* The short sword has a base delay of 11 aut, which is reduced to 7.25 aut from skill. -> (75% for 7 aut, 25% for 8 aut)
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 encumbrance is 5. The human size factor is zero and can be found on the [[shields]] page. There are three random variables used.
+
* The shield gives a penalty of 1d(0.40) -> (40% chance of +1d1, else 0).
*The first is the base delay of the short sword of 11 [[aut]]
 
*The second random variable incorporates the additional skill adjustment delay of -skill*10/scale = -75/20
 
*The third random variable incorporates the additional shield penalty delay of 8/20
 
*The final probabilities: delay=7 47.4%, delay=8 47.4%, delay=9 5.3%
 
  
 
{| class="wikitable"
 
{| class="wikitable"
 
|- align="center"
 
|- align="center"
 
!
 
!
!colspan="8"|Delays||
+
!colspan="5"|Delays||
 
|-
 
|-
! Explanation !! 6 !! 7 !! 8 !! 9 !! 10 !! 11 !! 12 !! 13 !! Total Weight  
+
! Explanation !! 6 !! 7 !! 8 !! 9 !! 11 !! Total Weight  
 
|-
 
|-
|Base delay<br>short sword
+
|Base delay
|   ||   ||   ||   ||  || 1   ||  || || 1
+
| || || || || 1 || 1
 
|-
 
|-
|Subtract Skill reduction<br>7.5*scale/20
+
|Skill reduction
|   || 15 || 5 ||   ||   ||    ||  ||  || 20
+
| || 15 || 5 || || || 20
 
|-
 
|-
|Add shield penalty<br>
+
|Shield penalty
2*(5)^2*(270-(10*4))*20<br>/(5*(20-3*(0))/270
+
| || 15*12 || 15*8<br>5*12 ||5*8 || || 0
<br>=2300/270=8
 
|   || 15*12 || 15*8 + 5*12 || 5*8 ||   ||    ||  ||  ||  
 
 
|-
 
|-
|Shield Penalty Weights
+
|Final
|   || 180 || 180 || 20 ||  ||    ||  ||   || 380
+
| || 180 ||180 || 20 || || 380
 
|}
 
|}
*Note that there are three possible delays, not just two based upon one average
+
 
 +
The final probabilities are {delay=7, 47.4%}, {delay=8, 47.4%}, {delay=9, 5.3%}.
 +
 
 +
Note that there are 3 possible delays, not just 2 based on one average.
 
*A scale is used to create weights which avoids large integer division truncation inaccuracies
 
*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.
 
*A random number from 0-380 is created and a delay is selected based upon which bin the number would fall into.
 +
 +
==History==
 +
*In [[0.28]], the shield penalty formula changed; before, certain skill thresholds (4 skill for buckler, 15 for kite shield, 25 for tower shield) negated it.
 +
*In [[0.27]], the shield penalty was increased and became less random.
 +
*Prior to [[0.16]], the amount of skill required to negate penalties for wearing a shield was more complex.
  
 
==References==
 
==References==
 
<references/>
 
<references/>
 
==History==
 
*In [[0.28]], the penalty formula changed; before, certain skill thresholds (4 skill for buckler, 15 for kite shield, 25 for tower shield) negated it.
 
*In [[0.27]], the shield penalty was increased and was less random.
 
*Prior to [[0.16]], the amount of skill required to negate penalties for wearing a shield was more complex.
 
  
 
[[Category:Game mechanics]]
 
[[Category:Game mechanics]]

Revision as of 23:06, 30 June 2023

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

See Weapon Speed for tables summarising this information.

Attack speed is how fast a player can attack with melee weapons, ranged weapons, or Unarmed Combat.

Your attack speed is usually measured in the form of "attack delay". A normal action takes 1.0 decaAut, or 10 aut, of time. The more aut you take, the slower you act. So if you have a smaller attack delay, you will attack faster.

Weapon Attack Delay

Base delay

All weapons, including ranged weapons and Throwing implements, have a base attack delay. When looking at the weapon in the 'i'nventory, you'll get the base attack delay (in decaAut). For example, a dagger has a base delay of 1.0 decaAut (10 aut).

The Weapon Speed page has a complete table of every weapon, in aut.

Skill

For every 2 levels in the corresponding weapon skill, your attack delay is reduced by 0.1 decaAut. There is a limit - every weapon has a minimum delay, where skill cannot reduce attack speed any further.

A weapon's mindelay is usually the smaller of base delay / 2 or 0.7 decaAut. For example, a dagger has a base delay of 1.0, so it has a mindelay of 0.5. A large rock has a base delay of 2.0, but its mindelay is still 0.7 decaAut. There are a few exceptions to this rule, such as rapiers and triple crossbows.

Unarmed Combat works differently. For every 5.4 Unarmed Combat skill, attack delay is reduced by 0.1 decaAut.[1] It otherwise works similarly to weapons.

Brands

Weapon brands can modify speed, applied after accounting for skills.

  • The speed brand reduces your weapon delay by x66%.
  • The heavy brand increases your weapon's delay by +50%.

Body Armour

If you are using a "Ranged Weapon" (which does not include Throwing weapons), then body armour will slow down your attack speed (after brand). Body armour slows down attacks based on its encumbrance rating.

The formula is (encumbrance^2 / 2250) * (90 - 2 * ar,_skill) / (3 + str) aut.

Values for armour encumbrance can be found on the Armour page. Unlike shields, the penalty cannot be fully eliminated with skill.

Shields

Shields encumber their wielder, slowing down weapon speed (after brands are applied).

Shields will slow down attacks by 1d(2/5 * encumbrance^2 / (5 + str) * (27 - sh_skill) / 27) aut.[2][3] If the formula results a decimal amount of aut, then it is rounded in a weighted manner before 1d(x) is rolled. Divide by 10 to convert aut into decaAut.

The values for shield encumbrance can be found on the Shields page. The shield penalty can be reduced to zero with a maxed out shield skill of 27.

Statuses

  • Haste (including from berserk) reduces all action delays by a factor of 2/3
  • Okawaru's Finesse ability reduces weapon delay by half. This does not stack with haste.
  • Statue Form, Petrifying, and Slowness increase all delays by a factor of 3/2. These conditions do stack with haste and with each other.

Finally, there is a hard limit of 0.2 decaAut, which no action can go under.

Spells

Spells can be used for attacking, and are thus included on this page. The vast majority of spells have a base delay of 1.0 decaAut. It can be modified by statuses (Haste, Statue Form, Slow...).

A few spells attack with your weapon:

Also, Sandblast is cast at 1.5 delay, instead of 1.0.

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 the player to make attacks based on movement.

Under normal circumstances, movement takes the usual amount of time, and make attacks based on that time. For example, lets say you move at 1.0 decaAut. If you have a weapon delay of 0.7, you'll always perform 1 attack on a move (taking 0.7 / 1.0 of the time), and have a 3/7 (0.3 / 0.7) chance for a 2nd attack. As an extreme example, a Naga (1.4 move delay) with a quick blade (0.3 attack delay) would attack 4 times per move, with a 50% chance of a 5th attack.

Serpent's Lash treats your movement delay as 1.0 decaAut, regardless of your actual movement delay. Wall Jump counts as 2 actions, so doubles your movement delay.

Rampaging

The rampaging ego lets you take a free step before attacking. If you are 1 space from an enemy, you'll move instantly and then attack at your normal attack delay.

Detailed Calculations

The formulas above give you a very close approximation to the average attack delay. However, each individual attack is subject to multiple sources of randomness:

  • If your weapon delay is in fractional aut, then it is rounded in a weighted fashion. For example, if you "average" attack at 5.1 aut (0.51 decaAut), then you have a 10% chance to attack at 6 aut, and 90% chance to attack at 5 aut.
  • If you wear a shield, the penalty is randomized. First, the EV penalty (2/5 * encumbrance^2 / (5 + str) * (27 - sh_skill) / 27) is rounded in a weighted manner. Then, the game will roll 1d(EV_penalty), determining the actual aut delay per attack.

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.

Example

Take a human wielding a short sword and buckler. The human has a short blade skill of 7.5, shield skill of 4, and strength of 15. The buckler's encumbrance is 5.

  • The short sword has a base delay of 11 aut, which is reduced to 7.25 aut from skill. -> (75% for 7 aut, 25% for 8 aut)
  • The shield gives a penalty of 1d(0.40) -> (40% chance of +1d1, else 0).
Delays
Explanation 6 7 8 9 11 Total Weight
Base delay 1 1
Skill reduction 15 5 20
Shield penalty 15*12 15*8
5*12
5*8 0
Final 180 180 20 380

The final probabilities are {delay=7, 47.4%}, {delay=8, 47.4%}, {delay=9, 5.3%}.

Note that there are 3 possible delays, not just 2 based on 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.

History

  • In 0.28, the shield penalty formula changed; before, certain skill thresholds (4 skill for buckler, 15 for kite shield, 25 for tower shield) negated it.
  • In 0.27, the shield penalty was increased and became less random.
  • Prior to 0.16, the amount of skill required to negate penalties for wearing a shield was more complex.

References