Ejemplo n.º 1
0
$attacked = in('attacked');
// boolean for attacking again
$target = $attackee = either(in('target'), in('attackee'));
$username = get_username();
// Pulls from an internal source.
$attacker = $username;
// *** Target's stats. ***
$attackee_health = getHealth($target);
$attackee_level = getLevel($target);
$attackee_str = getStrength($target);
$attackee_status = getStatus($target);
// *** Attacker's stats. ***
$attacker_health = getHealth($username);
$attacker_level = getLevel($username);
$user_turns = getTurns($username);
$attacker_str = getStrength($username);
$attacker_status = getStatus($username);
$class = getClass($username);
// *** Attack System Initialization ***
$starting_attackee_health = $attackee_health;
$starting_turns = $user_turns;
$killpoints = 0;
// *** Starting state for killpoints. ***
$attack_turns = 1;
// *** Default cost, will go to zero if an error prevents combat. ***
$required_turns = $attack_turns;
$level_check = $attacker_level - $attackee_level;
$what = "";
// *** This will be the attack type string, e.g. "duel". ***
$loot = 0;
$duel = in('duel') ? true : NULL;
Ejemplo n.º 2
0
    $dimMak->setIgnoresStealth(true);
    $dimMak->setCovert(true);
} else {
    if ($item == 'Speed Scroll') {
        $item = $speedScroll = new Item('Speed Scroll');
        $speedScroll->setIgnoresStealth(true);
        $speedScroll->setTurnChange(6);
        $speedScroll->setCovert(true);
    } else {
        if ($item == 'Fire Scroll') {
            $item = $fireScroll = new Item('Fire Scroll');
            $fireScroll->setTargetDamage(rand(20, getStrength($username) + 20) + $near_level_power_increase);
        } else {
            if ($item == 'Shuriken') {
                $item = $shuriken = new Item('Shuriken');
                $shuriken->setTargetDamage(rand(1, getStrength($username)) + $near_level_power_increase);
            } else {
                if ($item == 'Ice Scroll') {
                    $item = $iceScroll = new Item('Ice Scroll');
                    $iceScroll->setTurnChange(-1 * ice_scroll_turns($targets_turns, $near_level_power_increase));
                    // ice scroll turns comes out negative already, apparently.
                } else {
                    if ($item == 'Stealth Scroll') {
                        $item = $stealthScroll = new Item('Stealth Scroll');
                        $stealthScroll->setCovert(true);
                    }
                }
            }
        }
    }
}
Ejemplo n.º 3
0
         }
     }
 } else {
     if ($victim == "samurai") {
         $turn_cost = 1;
         echo "<img src=\"images/characters/samurai.png\" alt=\"Samurai\">\n";
         if (getLevel($username) < 6) {
             echo "You are too weak to take on the Samurai.<br>\n";
             $turn_cost = 0;
         } else {
             if (getKills($username) < 1) {
                 echo "You are too exhausted to take on the Samurai.<br>\n";
                 $turn_cost = 0;
             } else {
                 echo "The Samurai was waiting for your attack.<br><br>\n";
                 $ninja_str = getStrength($username);
                 $ninja_health = getHealth($username);
                 $samurai_damage_array[1] = rand(1, $ninja_str);
                 $samurai_damage_array[2] = rand(10, 10 + round($ninja_str * 1.2));
                 $does_ninja_succeed = rand(1, 2);
                 if ($does_ninja_succeed == 1) {
                     $samurai_damage_array[3] = rand(30 + round($ninja_str * 0.2), 30 + round($ninja_str * 1.7));
                 } else {
                     $samurai_damage_array[3] = $ninja_health - $samurai_damage_array[1] - $samurai_damage_array[2];
                     //Instant death.
                 }
                 $samurai_attack[1] = "The Samurai cuts you for " . $samurai_damage_array[1] . " damage.<br>\n";
                 $samurai_attack[2] = "The Samurai slashes you mercilessly for " . $samurai_damage_array[2] . " damage.<br>\n";
                 $samurai_attack[3] = "The Samurai thrusts his katana into you for " . $samurai_damage_array[3] . " damage.<br>\n";
                 for ($i = 1; $i < 4 && $ninja_health > 0; ++$i) {
                     echo "{$samurai_attack[$i]}\n";
Ejemplo n.º 4
0
function preBattleStats()
{
    global $attackee, $attackee_health, $attacker_health, $attackee_str, $username;
    echo "<table border=\"0\">\n";
    echo "<tr>\n";
    echo "  <th colspan=\"3\">\n";
    echo "  Before the Attack\n";
    echo "  </th>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "  <td>\n";
    echo "  Name\n";
    echo "  </td>\n";
    echo "  <td>\n";
    echo "  STR\n";
    echo "  </td>\n";
    echo "  <td>\n";
    echo "  HP\n";
    echo "  </td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "  <td>\n";
    echo "  {$username}\n";
    echo "  </td>\n";
    echo "  <td>\n";
    echo getStrength($username) . "\n";
    echo "  </td>\n";
    echo "  <td>\n";
    echo "<span style=\"color:brown;font-weight:normal;\">";
    echo $attacker_health . "\n";
    echo "</span>";
    echo "  </td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "  <td>\n";
    echo $attackee . "\n";
    echo "  </td>\n";
    echo "  <td>\n";
    echo $attackee_str . "\n";
    echo "  </td>\n";
    echo "  <td>\n";
    echo $attackee_health . "\n";
    echo "  </td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    echo "<hr>\n";
}
Ejemplo n.º 5
0
     $covert = true;
     if ($starting_turns >= $turn_cost) {
         addStatus($target, POISON);
         $target_damage = rand($poisonMinimum, $poisonMaximum);
         $victim_alive = subtractHealth($target, $target_damage);
         echo "{$target} has beeen poisoned!<br>\n";
         echo "{$target}'s HP reduced by {$target_damage}!<br>\n";
         $msg = "You have been poisoned by {$attacker_id} at {$today}";
         sendMessage($attacker_id, $target, $msg);
     } else {
         $turn_cost = 0;
         echo "You do not have enough turns to cast {$command}.\n";
     }
 } elseif ($command == "Fire Bolt") {
     if ($starting_turns >= $turn_cost) {
         $target_damage = 5 * ceil($level / 3) + rand(1, getStrength($username));
         echo "{$target}'s HP reduced by {$target_damage}!<br>\n";
         if ($victim_alive = subtractHealth($target, $target_damage)) {
             $attacker_id = $username;
         }
         $msg = "You have had fire bolt cast on you by {$attacker_id} at {$today}";
         sendMessage($attacker_id, $target, $msg);
     } else {
         $turn_cost = 0;
         echo "You do not have enough turns to cast {$command}.\n";
     }
 } else {
     if ($command == "Ice Bolt") {
         if ($starting_turns >= $turn_cost) {
             $turns_decrease = rand(1, 5);
             subtractTurns($target, $turns_decrease);
Ejemplo n.º 6
0
function changeStrength($who, $amount)
{
    if (abs($amount) > 0) {
        global $sql;
        $sql->Update("UPDATE players SET strength = strength+{$amount} WHERE uname = '{$who}'");
        $new_strength = getStrength($who);
        return $new_strength;
    } else {
        return getStrength($who);
    }
}