Propability of M-faced dice rolling a greater result than an N-faced dice ( MHello I have a game-mechanic which goes like this: 
Two-sides are rolling numbers. The defender rolls between [1,Armor_Value] , attacker rolls between [1,Damage_Value]. 
If the attacker_roll> defender_roll the damage is equal to attacker_roll - defender_roll. If not, no damage is dealt. Given


*

*Armour Value of defender

*Damage Value of attacker


What is the average damage that the attacker deals?
 A: [It is unfortunate that armor and attack both begin with "A" while damage and defender both begin with "D". I will use different letters to avoid this confusion.]
Let $N_1$ and $N_2$ be the damage and armor values respectively, and let $X_1$ and $X_2$ be the random variable representing the roll of the attacker and the defender respectively. You are interested in the random variable
$$Y:=\max(X_1-X_2,0).$$
The expected value is
\begin{align*}
\mathbb{E}[Y]
&= \sum_{x_2=1}^{N_2} \sum_{x_1=1}^{N_1} \max(x_1-x_2,0) \cdot \mathbb{P}(X_1=1, X_2=x_2)\\
&= \sum_{x_2=1}^{\min(N_1,N_2)} \sum_{x_1=x_2}^{N_1} (x_1-x_2) \frac{1}{N_1N_2} &\text{only consider $x_1$ when it is $\ge x_2$}\\
&= \frac{1}{N_1 N_2} \sum_{x_2=1}^{\min(N_1,N_2)}\sum_{z=0}^{N_1-x_2} z\\
&= \frac{1}{N_1 N_2} \sum_{x_2=1}^{\min(N_1,N_2)}\frac{(N_1-x_2)(N_1-x_2+1)}{2}\\
&= \frac{1}{N_1 N_2} \sum_{k=N_1-\min(N_1,N_2)}^{N_1-1} \frac{k(k+1)}{2}\\
\end{align*}
The last sum is the sum of triangular numbers. You can use the formula for the sum of the first $n$ triangular numbers $n(n+1)(n+2)/6$ to help compute. For example, if $N_1 \le N_2$, then $N_1-\min(N_1,N_2)=0$, so the sum is the sum of the first $N_1-1$ triangular numbers, so the expected value is $\frac{1}{N_1N_2} \frac{(N_1-1)N_1 (N_1+1)}{6}$. If $N_1 > N_2$ you will need to do an extra step to subtract out the first few triangular numbers.
It will probably be easier to write out a table of all the possible outcomes and notice the pattern. For instance, when $N_1=4$ and $N_2=5$,
$$\begin{array}{c|cccccccc}
& 1 & 2 & 3 & 4\\ \hline
1 & 0 & 1 & 2 & 3\\
2 & 0 & 0 & 1 & 2\\
3 & 0 & 0 & 0 & 1\\
4 & 0 & 0 & 0 & 0\\
5 & 0 & 0 & 0 & 0\\
\end{array}$$
so the expected value is
$$\frac{1}{4 \cdot 3} ((1+2+3)+(1+2)+1) = \frac{1}{12} \left(6+3+1\right)=\frac{5}{6}$$
This is consistent with our above formula in the case $N_1 \le N_2$: $$\frac{1}{N_1N_2} \frac{(N_1-1)N_1 (N_1+1)}{6}= \frac{1}{12} \frac{3\cdot 4 \cdot 5}{6}=\frac{5}{6}.$$
