What I want to do is loop the battle until one or the other runs out of their guards, and then put the actual player into the battle using their hitpoints. So like their guards will be there protecting their main character, but when the guards are gone, they have to enter the fight with their hitpoints. And loop this scenario until they are out of guards AND out of hitpoints. One or the other anyway. If the attack runs out first, or if the defender runs out first.
Sounds sooooo complicated, but is there a way? Right now I have it single attacked based. Code below:
Code: Select all
<?php
if($attack_effect < $defense_effect){
$gun_lost = rand(3,8) + $enemy_stats['level'];
$guard_lost = rand(3,8) + $enemy_stats['level'];
$turnsused = rand(1,5);
$currentturns = $stats['turns'];
$newturns = $currentturns - $turnsused;
echo "<font color='red'>You have lost the battle</font>"; ?><br /><br />
<?php echo "You<font color='red'> lost</font> <font color='lime'>$gun_lost gunmen</font> and <font color='lime'>$guard_lost guards!</font> You used " . $turnsused . " turns this round." ?>
<br />
<?php echo "You have $unit[guards] guards remaining before you enter the arena!"; ?>
<br /><br />
<?php
$guard_lost = rand(1,2) + $stats['level'];
$gun_lost = rand(1,2) + $stats['level'];
echo "$u_name[username] <font color='red'>lost</font> <font color='lime'> " . $guard_lost . " guards</font> and <font color='lime'>$gun_lost gunmen!</font>"; ?>
<br />
<?php echo "$u_name[username] has $e_guards[guards] guards remaining before they enter the arena!";
}else{