# Crystal Shield (perk)/Proof of the simplification

Regarding Crystal Shield

We start from the main equation:

$r_{avg}={\frac {\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{n}d_{i,n}^{(0)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }\left(d_{i,n}^{(1)}-\left\lfloor {.05\times R\times d_{i,n}^{(1)}}\right\rfloor \right)+\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(2)}\right]}{\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{n}d_{i,n}^{(0)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(1)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(2)}\right]}}$ The second summation within the brackets in the numerator can be split up.

$r_{avg}={\frac {\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{n}d_{i,n}^{(0)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(1)}-\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }\left\lfloor {.05\times R\times d_{i,n}^{(1)}}\right\rfloor +\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(2)}\right]}{\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{n}d_{i,n}^{(0)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(1)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(2)}\right]}}$ Split up the damage reduction component.

$r_{avg}={\frac {\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{n}d_{i,n}^{(0)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(1)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(2)}\right]-\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }\left\lfloor {.05\times R\times d_{i,n}^{(1)}}\right\rfloor \right]}{\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{n}d_{i,n}^{(0)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(1)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(2)}\right]}}$ The first term of the numerator is equal to the denominator.

$r_{avg}=1-{\frac {\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }\left\lfloor {.05\times R\times d_{i,n}^{(1)}}\right\rfloor \right]}{\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{n}d_{i,n}^{(0)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(1)}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }d_{i,n}^{(2)}\right]}}$ If we want to know the damage reduction over a large number of hits, we could use the statistical average of the received damage, this means $d_{i,n}^{(j)}$ becomes a constant value ${\bar {d}}$ . We also drop the floor function in the numerator and add a value $\phi \in [0,1)$ to correct for the error.

$d_{i,n}^{(j)}\Rightarrow {\bar {d}}$ $\Rightarrow r_{avg}=1-{\frac {\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }(.05\times R\times {\bar {d}}-\phi )\right]}{\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{n}{\bar {d}}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }{\bar {d}}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }{\bar {d}}\right]}}$ The second summation in the numerator has no terms that change on increasing $i$ , the summation can thus be simplified to a product of the range of the index and the summands.

$r_{avg}=1-{\frac {\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil \left(.05\times R\times {\bar {d}}-\phi \right)}{\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}p\left[\sum \limits _{i=1}^{n}{\bar {d}}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }{\bar {d}}+\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }{\bar {d}}\right]}}$ Place terms not dependent on $n$ outside of the summations.

{\begin{aligned}r_{avg}&=1-{\frac {p\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil \left(.05\times R\times {\bar {d}}-\phi \right)\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}}{p\;{\bar {d}}\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}\left[\sum \limits _{i=1}^{n}1+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }1+\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }1\right]}}\\&=1-{\frac {p\;{\bar {d}}\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil \left(.05\times R-{\frac {\phi }{\bar {d}}}\right)\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}}{p\;{\bar {d}}\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}\left[\sum \limits _{i=1}^{n}1+\sum \limits _{i=1}^{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil }1+\sum \limits _{i=1}^{\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil }1\right]}}\end{aligned}} Drop common term in numerator and denominator.

$r_{avg}=1-{\frac {\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil \left(.05\times R-{\frac {\phi }{\bar {d}}}\right)\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}}{\sum \limits _{n=0}^{\infty }\left(1-p\right)^{n}\left[n+\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil +\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil \right]}}\qquad \qquad (1)$ To simplify even further we need to find the infinite sum equivalents of the remaining summations. Since $(1-p)=x<1$ (p = perk proc chance), the following is true[math 1]

$\sum \limits _{n=0}^{\infty }ax^{n}={\frac {a}{1-x}}\qquad \qquad (2)$ Take the derivative of (2):

{\begin{aligned}\sum \limits _{n=0}^{\infty }anx^{n-1}&={\frac {a}{(1-x)^{2}}}\\\sum \limits _{n=0}^{\infty }a(n+1)x^{n}&={\frac {a}{(1-x)^{2}}}\\\sum \limits _{n=0}^{\infty }anx^{n}+\sum \limits _{n=0}^{\infty }ax^{n}&={\frac {a}{(1-x)^{2}}}\end{aligned}}\qquad \qquad (3) The second term in (3) is equal to (2):

{\begin{aligned}\sum \limits _{n=0}^{\infty }anx^{n}&={\frac {a}{(1-x)^{2}}}-{\frac {a}{1-x}}\\&={\frac {ax}{(1-x)^{2}}}\end{aligned}} Combine (2) and (3) with diffent constants:

{\begin{aligned}\sum \limits _{n=0}^{\infty }anx^{n}+\sum \limits _{n=0}^{\infty }bx^{n}&={\frac {ax}{(1-x)^{2}}}+{\frac {b}{1-x}}\\\sum \limits _{n=0}^{\infty }x^{n}(an+b)&={\frac {ax+b(1-x)}{(1-x)^{2}}}\end{aligned}}\qquad \qquad (4) If we take $x=(1-p)$ and $a=1$ in (2) we get:

$\sum \limits _{n=0}^{\infty }(1-p)^{n}={\frac {1}{p}}\qquad \qquad (5)$ For $x=(1-p)$ , $a=1$ and $b=\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil +\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil$ in (4), we get:

$\sum \limits _{n=0}^{\infty }(1-p)^{n}\left[n+\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil +\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil \right]={\frac {(1-p)+\left(\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil +\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil \right)p}{p^{2}}}\qquad \qquad (6)$ The summations (5) and (6) occur in (1) and can be substituted:

{\begin{aligned}\Rightarrow r_{avg}&=1-{\frac {\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil \left(.05\times R-{\frac {\phi }{\bar {d}}}\right){\frac {1}{p}}}{\frac {p\left(\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil +\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil \right)-p+1}{p^{2}}}}\\&=1-{\frac {\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil \left(.05\times R-{\frac {\phi }{\bar {d}}}\right)}{\left\lceil {\frac {t_{abs}}{t_{AS}}}\right\rceil +\left\lceil {\frac {t_{cd}-t_{abs}}{t_{AS}}}\right\rceil -1+{\frac {1}{p}}}}\end{aligned}} Where $\phi =.05\times R\times {\bar {d}}-\left\lfloor {.05\times R\times {\bar {d}}}\right\rfloor$ . This represents the rounding error introduced by dropping the floor function. $\phi \in [0,1)$ , so for ${\bar {d}}>500$ we have <4% error for ignoring $\phi$ and can therefor safely be ignored for most practical situations.