Join the forums now, and start posting to receive access to our Scripts Vault!
$attacker_str = ( sum up attacker's str ) $defender_str = ( sum up defender's str ) // Attacker has 25% more attack strength then defender's defense strength, success rate for attacker 95%if( $attacker_str >= ( $defender_str + ($defender_str * .25) ) ) { if( mt_rand(1,100) <= 95 ) { // Attacker wins } else { // Defender wins }// Attacker has 12.5% more attack strength then defender's defense strength, success rate for attacker 85%elseif( $attacker_str >= ( $defender_str + ($defender_str * .125) ) ) { if( mt_rand(1,100) <= 85 ) { // Attacker wins } else { // Defender wins }}// Attacker has more attack strength then defender's defense strength, success rate for attacker 75%elseif( $attacker_str > $defender_str ) { if( mt_rand(1,100) <= 75 ) { // Attacker wins } else { // Defender wins }}// Attacker has equal attack strength to defender's defense strength, success rate for attacker 50%elseif( $attacker_str == $defender_str ) { if( mt_rand(1,100) <= 50 ) { // Attacker wins } else { // Defender wins }}// Attacker attack strength less then 50% of defender's defense strength success rate for attacker 5%elseif( ( $attacker_str + ($attacker_str * .5) ) <= $defender_str ) { if( mt_rand(1,100) <= 5 ) { // Attacker wins } else { // Defender wins }}// Attacker attack strength less then 25% of defender's defense strength success rate for attacker 15%elseif( ( $attacker_str + ($attacker_str * .25) ) <= $defender_str ) { if( mt_rand(1,100) <= 15 ) { // Attacker wins } else { // Defender wins }}// Attacker attack strength less defender's defense strength success rate for attacker 25%else { if( mt_rand(1,100) <= 25 ) { // Attacker wins } else { // Defender wins }}
I wish I had a moral to this set of articles but I don't.
$winner=$attacker-$defender+rand(-max($attacker,$defender)/10,max($attacker,$defender)/10);$critical=rand(1,100); if($critical<=5) $winner=1; if($critical>=95) $winner=-1;
accept it won't be 100% what you wanted and move on to more important tasks.
When you allow for tactics either all parties must be available online at that time or the battle must be drawn out over a much longer time frame
I find it difficult to say one system is 'better' than the other, they suit different styles of game, and probably appeal to slightly different player populations as well.
...and the best you could hope for against an unknown opponent...