Jump to content

Stop script


Minase

Recommended Posts

hmm did try lots of variants ,but without success

i work now on a battle system (my first battle system) and it seem that i cant make it stop the attack if attacker or defender HP <= 0...

 

echo "Round 1 <br>";
$rounds1 = rand(5,10);
for($r = 1; $r <= $rounds1 ; $r++){
if ($r % 2 == 0) {
$d_attack = rand((($defender->Strenght - $attacker->Endurance) / 4),($defender->Strenght - $attacker->Endurance));
$hitchance = rand(0,($defender->Dexterity + $attacker->Defence));
if ($hitchance >= $defender->Dexterity) {
$d_attack = 0;
} else {
}
  $round1->Attack .= "defender : ".$d_attack."<br>";
  $d_total1 += $d_attack;
} else {
  $a_attack = rand((($attacker->Strenght - $defender->Endurance) / 4),($attacker->Strenght - $defender->Endurance));
  $hitchance = rand(0,($attacker->Dexterity + $defender->Defence));
if ($hitchance >= $attacker->Dexterity) {
$a_attack = 0;
} else {
}
  $round1->Attack .= "attacker : ".$a_attack."<br>";
  $a_total1 += $a_attack;

}

}

 

can someone help me ? thanks

Link to comment
https://forums.phpfreaks.com/topic/120520-stop-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.