I understand that there is no correct or incorrect way of doing this, and its all down to a matter of trial and error in terms of perfecting the system.
What I am after is some advice or even get thoughts on how others have tackled a situation like this.
Right now I have a very basic attack formula
$attackPower = $baseAttack * 4;
$percent = $attackPower / 100;
$percent1 = $percent * 10; // Gets 10% of the users attack power
Using the above code I then use rand to work out a users attack power, so it varies rather than a single number
$power = rand($attackPower - $percent1, $attackPower + $percent1)
So that's the users attack power calculated.
However if I used the same formula to calculate the opponents defense, and then calculated the Attack minus Defense equals the damage
$totalDamage = $power - $defense;
This may sometimes result in a negative value (especially if the opponent has a considerably higher defense stat to the users attack)
Above I have used
$attackPower = $baseAttack * 4;
For calculating the defense would this be efficient?
$defensePower = $baseDefense * 2; // Could have this set to rand? 1 - 3??
Is there anything that could be changed to balance the stats out a bit more? Could there be a much simpler formula?
$power = $baseAttack * rand(3.6, 4.4)
. – Marcks Thomas Sep 01 '14 at 19:27