Mathematical Formulas for Game Battle Calculations I am from a programming background and trying to write a game for fun.
I am trying to write a battle calculator and which ever way I think about it I seem to run into trouble.
Basically the scenario is this:
Both the attacking force and the defending force have, lets say soldiers.  Each side can have, but not always, lets say mercenaries to help.  Each side holds an arsenal of 10 possible weapons, each of which give a different hit force.  Each side also has a small random force to bring in an element of luck.
After the battle I need to work out how many of the total kills were made by both player and mercenaries (if they join in) on both sides.
My simple approach to this so far is to work out the best possible weapons each side can have.  That might be 50% weapon 7, 20% weapon 6 and the rest weapon 5 for example.  I then calculate the total hit force this give and divide by the total number of soldier to give an average.  I add any other hit mods the player qualifies for and use that to work out the kill amount.  So if the total hit force is 3.6 I divide 3.6 by 100 then use number of soldiers * my hit force to give number of kills.  I am sure this isn't the best way to do it though.
I am not expecting anyone to do this for me however handy that might be. On the face of it it seems a relatively simple calculation and maybe it is for someone who totally understands maths. I am at a loss to know what kind of maths I should be looking at.  Can anyone make a suggestion as to how to approach this? 
If anyone know of a website I can go to pay for this to be done for me I would be interested.
 A: Suppose $w_1, w_2, \ldots, w_{10}$ are the weapon effectiveness numbers, and $m_j$ are the amount of people equipped with $w_j$.
To calculate the total effectiveness of a force, first calculate the total number of combatants $M$, which with the notation I use is
$$M = m_1 + \ldots + m_{10} = \sum_{j=1}^{10} m_j.$$
According to Lanchester's square law http://en.wikipedia.org/wiki/Lanchester%27s_laws, the effectiveness of a force is proportional to the square of combatants, so we use $M^2$.
We want to involve the weapon technology in a linear manner. The simplest way that comes to mind is to multiply $M^2$ by the weighted average of weapon effectiveness, which would be
$$\frac{1}{M} (m_1 w_1 + \ldots + m_{10}w_{10}) = \frac{1}{M}\sum_{j=1}^{10}m_j w_j,$$
so the total effectiveness $E$ of a force would be
$$E = M^2 \frac{1}{M}\sum_{j=1}^{10}m_j w_j = M\sum_{j=1}^{10}m_j w_j.$$
An alternative, and I think theoretically nicer, way of using weapon effectiveness would be to have
$$E = (\sum_{j=1}^{10} \sqrt{w_j} m_j)^2.$$
There are other fairly similar methods. You would need to be more precise with what you want in order to get more specific answers.
You can add other factors (random factors, morale, etc.) in similar way to weapon effectiveness - just add more multipliers.

You also asked for the ratio of kills between the main force and the mercenaries. To get it, first calculate the effectiveness of the main force (I write it as $E_s$) and the mercenaries $E_m$ as above. Then figure out the total number of kills in whatever way you do; let us write it as $K$.
The number of kills committed by the main force would then be
$$\frac{E_s}{E_s+E_m}K$$
and the number of kills by mercenaries would be
$$\frac{E_m}{E_s+E_m}K.$$
