and can you make it take account of stun weapons. say 10% chance with stun rod of taking alien, 50% with laser, 75% with gas.
how about some randoms.
aliens = 1 to 15? (sets number of aliens)
difficulty = -2 -1 0 1 2 (damage/defence modifier?)
humans = set as whatever was sent...
defenceP = 0 to 100 (chance that a soldier is hiding behind a wall)
defenceA = 0 to 100 (alien chance of taking cover)
attackP= 0 to 100 (chance a soldier will fire)
attackA= 0 to 100 (alien chance of firing)
hit chanceP= player's soldiers accuracy added together then divided between them (average...)
hit chanceA= alien version of hit chance
so the working out would be like this
[1] means the number the random got, for readability
begin loop humanturn( upto value of humans )
attackP [10] so run random between 0 and 100, if equals 0 to 10, player attacked.
hitchanceP [50] random between 0 and 100. if equals between 0 and 50. player aimed at alien.
defenceA [20] random between 0 and 100. if equals between 0 and 20. the alien was behind cover...
if begin loop less then humans value (how any humans were sent...)
then goto humanturn...
else continue to alienturn
begin loop alienturn ( upto value of aliens )
attackA [30] random between 0 and 100, if equals 0 to 30, attack happening
hitchanceA [5] random between 0 and 100, if equals 0 to 5, alien aimed at player
defenceP [20] random between 0 and 100, if equals 0 to 20, the human was behind cover...
if alienturn equals aliens,
set humanturn 0
set alienturn 0
goto humanturn
if aliens dead, show victory
if humans dead, show defeat
this should of course help for the basics. you of course need to take note of weapons, if a team can even attack, how much ammo used, what weapon used, the armor... you know the rest. hope it helps...