Damage

## Damage calculation

Damage in the Dungeon is calculated using the following formula:

b
a
s
e
D
a
m
a
g
e
∗
f
l
a
t
D
a
m
a
g
e
∗
u
n
i
q
u
e
F
l
a
t
D
a
m
a
g
e
∗
a
v
a
t
a
r
A
t
t
a
c
k
e
d
∗
d
o
d
g
e
∗
c
r
i
t
i
c
a
l

{\displaystyle baseDamage\*flatDamage\*uniqueFlatDamage\*avatarAttacked\*dodge\*critical}

where:

b
a
s
e
D
a
m
a
g
# e
(
111
∗
d
a
m
a
g
e
M
u
l
t
i
p
l
i
e
r
25
)
∗
r
n
g
R
o
l
l
∗
a
t
t
a
c
k
M
o
d
i
f
i
e
r

{\displaystyle baseDamage=(111\*damageMultiplier+25)\*rngRoll\*attackModifier}

 rounded up

* damageMultiplier is calculated based on the relation between the attack of the attacker and defense of the defender,

a
t
k

d
e
f

{\textstyle {\frac {atk}{def}}}

. If this relation less than or equal to one, then damageMultiplier is calculated by

0.5
∗
r
e
l
a
t
i
o

n

2

0.5
∗
r
e
l
a
t
i
o
n

{\textstyle 0.5\*relation^{2}+0.5\*relation}

. If the relation is greater than one, the damageMultiplier is calculated using diminishing returns - each gap between numbers (1-2, 2-3, etc.) has its own multiplier that is applied to it. damageMultiplier starts at 1, and the multiplier for the range 1-2 is 0.7, and for every successive step, the multiplier is

0.3

s
t
e
p

n
u
m
b
e
r
−
1

{\textstyle {\frac {0.3}{step\ number-1}}}

, so the 2-3 multiplier is

0.3

2
−
1

=
0.3

{\textstyle {\frac {0.3}{2-1}}=0.3}

, and the 3-4 multiplier is

0.3

3
−
1

=
0.15

{\textstyle {\frac {0.3}{3-1}}=0.15}

. For examples, see below.
* rngRoll is a random number between 0.85 and 1.
* attackModifier is based on whether the attacker is an avatar with genre buffs or a defender with genre weaknesses - it is equal to

1
0.2
∗
n
u
m
b
e
r

o
f

g
e
n
r
e
s

{\textstyle 1+0.2\*number\ of\ genres}

.
* flatDamage is any flat percentage changes to the damage (apart from Valkyrie Miyu and High Priest Mizuki's abilities), such as Berserker Star and the Rampage rune. To get flatDamage, start with 1 and add the percentages, so Berserker Star is a 20% buff so would increase it to

1
# 0.2
1.2

{\textstyle 1+0.2=1.2}

 and then with Pipe of the Golden Fairy as well (a 50% buff) it would go to

1.2
# 0.5
1.7

{\textstyle 1.2+0.5=1.7}

. If flatDamage is less than 0, then it gets set to 0, having the effect of making the attack deal no damage.
* uniqueFlatDamage are any flat percentage changes that are not taken account of in flatDamage, namely Valkyrie Miyu's and High Priest Mizuki's abilities. If neither of these are active, uniqueFlatDamage is 1.
* avatarAttacked is 0.9 if an avatar is being attacked and 1 otherwise.
* dodge is 1 if dodging does not trigger, and 0.5 if it does. Dodging is calculated by doing

d
o
d
g
e

45

{\textstyle {\frac {\!\ dodge\ \!}{\ 45\ }}}

, and if this is greater than a random number between 0 and 20, then it is a dodge.
* critical is 1 if critting does not trigger, and

1.5
i
n
c
r
e
a
s
e
s

f
r
o
m

c
r
i
t

d
a
m
a
g
e

r
u
n
e
s

{\textstyle 1.5+increases\ from\ crit\ damage\ runes}

 if it does. Critting is calculated by doing

a
c
c
u
r
a
c
y

67.5

{\textstyle {\frac {accuracy}{67.5}}}

, and if this is greater than a random number between 0 and 20, then it is a crit.

### Examples

* Marine with no artifacts or runes and two genre weaknesses (defense of 80, dodge of 330) is getting attacked by an enemy with 300 attack.

a
t
k

d
e
f

{\textstyle {\frac {atk}{def}}}

 is

300
80

=
3.75

{\textstyle {\frac {300}{80}}=3.75}

, so damageMultiplier starts off at 1. Since the multiplier for between 1 and 2 is 0.7, you add 0.7 to 1 to get 1.7. The relation for between 2 and 3 is

0.3

2
−
1

{\textstyle {\frac {0.3}{2-1}}}

, which is 0.3, so you add 0.3 to 1.7 to get 2. Between 3 and 4 is

0.3

3
−
1

{\textstyle {\frac {0.3}{3-1}}}

, which is 0.15, so you do

0.15
∗
# 0.75
0.1125

{\textstyle 0.15\*0.75=0.1125}

 and add that to 2 to get a total of 2.1125. rngRoll in this case is 0.99, and attackModifier is 1.4 as Marine has two genre weaknesses. This means that baseDamage works out as

(
111
∗
2.1175
25
)
∗
0.99
∗
# 1.4
360.418

{\textstyle (111\*2.1175+25)\*0.99\*1.4=360.418}

 which rounds up to 361 as baseDamage rounds up.

flatDamage is 1 as there are no buffs of artifacts that would change the damage dealt. uniqueFlatDamage is also 1 as neither of the abilities that affect this are active. avatarAttacked is 0.9 as Marine is the one being attacked.

d
o
d
g
e

45

{\textstyle {\frac {dodge}{45}}}

 is

330
45

=
7.33
(
3
s
.
f
.
)

{\textstyle {\frac {330}{45}}=7.33(3s.f.)}

. The random number rolled between 1 and 20 is 17, and since

7.33
<
17

{\textstyle 7.33<17}

, Marine does not dodge so dodge is set to 1. Since enemies cannot crit, critical is set to 1. The final damage calculated is

361
∗
1
∗
1
∗
1
∗
1
∗
# 1
361

{\textstyle 361\*1\*1\*1\*1\*1=361}

.

* Knight Kyouko with Corruption Seal, Superior Defensive Counter and 2 debuffs, and no genre weaknesses (defense of 500, dodge of 50) is getting attacked by an enemy with 250 attack and an attack debuff.

a
t
k

d
e
f

{\textstyle {\frac {atk}{def}}}

 is

250
500

=
0.5

{\textstyle {\frac {250}{500}}=0.5}

. As this is less than 1, the relation is set to

0.5
∗
(
0.5

)

2

0.5
∗
(
0.5
)

{\textstyle 0.5\*(0.5)^{2}+0.5\*(0.5)}

, which is 0.375. rngRoll in this case is 0.85, and attackModifier is 1 as Kyouko has no genre weaknesses. This ends up with baseDamage being calculated as

(
111
∗
0.375
25
)
∗
0.85
∗
# 1
56.631

{\textstyle (111\*0.375+25)\*0.85\*1=56.631}

, which rounds up to 57.

flatDamage is affected by Corruption Seal, Superior Defensive Counter, and the attack debuff on the enemy. This in total makes it equal to

1
−
0.3
−
0.22
−
# 0.2
0.28

{\textstyle 1-0.3-0.22-0.2=0.28}

. uniqueFlatDamage is 1, as neither Ice Prison nor Magical Bombardment are being used. avatarAttacked is 0.9 as an avatar is being attacked.

d
o
d
g
e

45

{\textstyle {\frac {dodge}{45}}}

 is

50
45

=
1.11
(
3
s
.
f
.
)

{\textstyle {\frac {50}{45}}=1.11(3s.f.)}

. The random number rolled between 1 and 20 is 8, and since

1.11
<
8

{\textstyle 1.11<8}

, Kyouko does not dodge so dodge is set to 1. Since enemies cannot crit, critical is set to 1. The final damage calculated is

57
∗
0.28
∗
1
∗
0.9
∗
1
∗
# 1
14.364

{\textstyle 57\*0.28\*1\*0.9\*1\*1=14.364}

, which rounds to 14.

* High Priest Mizuki with Berserker Star active no runes or genre buffs (attack of 380, accuracy of 410) is attacking an enemy with a defense of 250, on whom she has used her ability, Ice Prison.

a
t
k

d
e
f

{\textstyle {\frac {atk}{def}}}

 is

380
250

=
1.52

{\textstyle {\frac {380}{250}}=1.52}

, so damageMultiplier starts off at 1. Since the multiplier for between 1 and 2 is 0.7, you do

1
0.7
∗
# 0.52
1.364

{\textstyle 1+0.7\*0.52=1.364}

, so damageMultiplier is 1.364. rngRoll is 0.94 in this situation, and attackModifier is 1 as Mizuki has no genre buffs. From this, baseDamage is calculated as

(
111
∗
1.364
25
)
∗
0.94
∗
# 1
165.819

{\textstyle (111\*1.364+25)\*0.94\*1=165.819}

, which rounds up to 166.

flatDamage is

1
# 0.2
1.2

{\textstyle 1+0.2=1.2}

 as Berserker Star is the only flatDamage item in this scenario. uniqueFlatDamage is 0.1 because Ice Prison is active on the enemy. Since an enemy is being attacked instead of an avatar, avatarAttacked is 1. Since enemies cannot dodge, dodge is 1.

a
c
c
u
r
a
c
y

67.5

{\textstyle {\frac {accuracy}{67.5}}}

 is

410
67.5

=
6.07
(
3
s
.
f
.
)

{\textstyle {\frac {410}{67.5}}=6.07(3s.f.)}

. The random number rolled between 0 and 20 is 5, and since

6.07
>
5

{\textstyle 6.07>5}

, the attack crits and critical is set to 1.5 as Mizuki has no crit damage runes. The final damage is then calculated as:

166
∗
1.2
∗
0.2
∗
1
∗
# 1.5
29.88

{\textstyle 166\*1.2\*0.2\*1\*1.5=29.88}

, which rounds to 30 so 30 damage is dealt.