PDA

View Full Version : thief actions


Baudman
02-12-2006, 12:57 AM
can someone explain this section of code to me? I want to change it to make it easier to have a success instead of a fail.

// Process their chance of failure.
$failure = 50;
if ($action['maxrep'] >= $thefted['reputation'])
{
$addfailure = (($thefted['reputation'] / $action['maxrep']) * 50);
$failure = ($failure + $addfailure);
}
else
{
$fail = 1;
}

$random = rand(0, 100);
if ($random <= $failure)
{
$fail = 1;
}

if ($fail == 1)
{
$failtext = "Failed";
}
else
{
$failtext = "Success!";
}

if ($fail == 1) {