# Death Ward/Analysis

Let the player's current life points be defined as ${\displaystyle {\text{LP}}_{\text{current}}}$, the player's maximum life points be ${\displaystyle {\text{LP}}_{\text{max}}}$, and the base damage taken by the player be ${\displaystyle D}$. Define the half life point threshold as ${\displaystyle {\text{LP}}_{50\%}=\lfloor {\text{LP}}_{\text{max}}/2\rfloor }$ and the quarter life point threshold as ${\displaystyle {\text{LP}}_{25\%}=\lfloor {\text{LP}}_{\text{max}}/4\rfloor }$. The damage taken by the player due to the Death Ward relic power, ${\displaystyle D_{\text{DW}}}$, is then
{\displaystyle {\begin{aligned}D_{\text{DW}}&={\text{max}}\left[0,H\left({\text{LP}}_{\text{current}}-{\text{LP}}_{50\%}\right){\bigg \lceil }{\text{max}}{\big (}0,{\text{min}}\left({\text{LP}}_{\text{current}}-{\text{LP}}_{50\%},D\right){\big )}{\bigg \rceil }\right]\\&+{\text{max}}{\bigg [}0,{\text{max}}{\big (}H\left({\text{LP}}_{\text{current}}-{\text{LP}}_{50\%}\right),H\left({\text{LP}}_{\text{current}}-{\text{LP}}_{25\%}\right){\big )}\times \\&\qquad \qquad {\bigg \lceil }{\text{max}}{\bigg (}0,{\text{min}}{\bigg \{}{\text{min}}\left({\text{LP}}_{\text{current}},{\text{LP}}_{50\%}\right)-{\text{LP}}_{25\%},{\text{min}}{\bigg (}D,{\text{max}}{\big (}0,D-\left({\text{LP}}_{\text{current}}-{\text{LP}}_{50\%}\right){\big )}{\bigg )}{\bigg \}}{\bigg )}\cdot 0.95{\bigg \rceil }{\bigg ]}\\&+{\text{max}}{\bigg [}0,{\bigg \lceil }{\text{max}}{\bigg (}0,{\big (}D-{\text{max}}\left(0,{\text{LP}}_{\text{current}}-{\text{LP}}_{25\%}\right){\big )}{\bigg )}\cdot 0.90{\bigg \rceil }{\bigg ]}\end{aligned}}}
where ${\displaystyle H(x-a)}$ is the Heaviside step function[1] with the step occurring at ${\displaystyle a}$, with
${\displaystyle H(x-a)={\begin{cases}0&{\text{for}}~x