Beispiel #1
0
     // *** End of Class Changing Code. ***
 }
 //*/
 echo "<a href=\"chart.php\">Upgrade Chart</a><hr>\n";
 $MAX_LEVEL = 250;
 $nextlevel = getLevel($username) + 1;
 $in_upgrade = in('upgrade');
 if ($in_upgrade && $in_upgrade == 1) {
     if ($nextlevel > $MAX_LEVEL) {
         $msg = "There are no trainers that can teach you beyond your current skill. You are legend among the ninja.<br>\n";
     } else {
         if (getKills($username) >= getLevel($username) * 5) {
             subtractKills($username, getLevel($username) * 5);
             addLevel($username, 1);
             addStrength($username, 5);
             addTurns($username, 50);
             addHealth($username, 100);
         } else {
             echo "You do not have enough kills to proceed at this time.<br>\n";
         }
     }
 } else {
     if ($nextlevel > $MAX_LEVEL) {
         $msg = "You enter the dojo as one of the elite ninja. No trainer has anything left to teach you.<br>\n";
     } else {
         if (getKills($username) < getLevel($username) * 5) {
             $msg = "Your trainer finds you lacking. You are instructed to prove your might against more ninja before you return.<br>\n";
         } else {
             echo "<form id=\"level_up\" action=\"dojo.php\" method=\"post\" name=\"level_up\">\n";
             echo "<div>\n";
             echo "<br>Do you wish to upgrade to level " . $nextlevel . "?<br>\n";
Beispiel #2
0
         sendMessage($attacker_id, $target, $msg);
         $result = "{$target}'s turns reduced by {$turns_decrease}!<br>\n";
     } else {
         $turn_cost = 0;
         echo "You do not have enough turns to cast {$command}.\n";
     }
 } else {
     if ($command == "Cold Steal") {
         if ($starting_turns >= $turn_cost) {
             $critical_failure = rand(1, 100);
             if ($critical_failure > 7) {
                 // *** If the critical failure rate wasn't hit.
                 if ($target_turns >= 5) {
                     $turns_decrease = rand(2, 5);
                     subtractTurns($target, $turns_decrease);
                     addTurns($username, $turns_decrease);
                     $msg = "You have had Cold Steal cast on you for {$turns_decrease} by {$attacker_id} at {$today}";
                     sendMessage($attacker_id, $target, $msg);
                     $result = "You cast Cold Steal on {$target} and take {$turns_decrease} of his turns.<br>\n";
                 } else {
                     $turn_cost = 0;
                     $result = "The victim did not have enough turns to give you.<br>\n";
                 }
             } else {
                 // *** CRITICAL FAILURE !!
                 addStatus($username, FROZEN);
                 $unfreeze_time = date("F j, Y, g:i a", mktime(date("G") + 1, 0, 0, date("m"), date("d"), date("Y")));
                 $failure_msg = "You have experienced a critical failure while using Cold Steal on {$today}. You will be unfrozen on {$unfreeze_time}";
                 sendMessage("SysMsg", $username, $failure_msg);
                 $result = "Cold Steal has backfired! You have lost 3 turns and are now frozen until {$unfreeze_time}!<br>\n";
             }
Beispiel #3
0
function level_up_if_possible($char_id, $auto_level = false)
{
    // Setup values:
    $max_level = maximum_level();
    $health_to_add = 100;
    $turns_to_give = 50;
    $stat_value_to_add = 5;
    $char_kills = get_kills($char_id);
    if ($char_kills < 0) {
        // If the character doesn't have any kills, shortcut the levelling process.
        return false;
    } else {
        $char_obj = new Player($char_id);
        $username = $char_obj->name();
        $char_level = $char_obj->level();
        if ($auto_level && $char_obj->isAdmin()) {
            // If the character is an admin, do not auto-level them.
            return false;
        } else {
            // For normal characters, do auto-level them.
            // Check required values:
            $nextLevel = $char_level + 1;
            $required_kills = required_kills_to_level($char_level);
            // Have to be under the max level and have enough kills.
            $level_up_possible = $nextLevel <= $max_level && $char_kills >= $required_kills;
            if ($level_up_possible) {
                // ****** Perform the level up actions ****** //
                // Explicitly call for the special case of kill changing to prevent an infinite loop.
                $userKills = change_kills($char_id, -1 * $required_kills, $auto_level_check = false);
                $userLevel = addLevel($char_id, 1);
                change_strength($char_id, $stat_value_to_add);
                change_speed($char_id, $stat_value_to_add);
                change_stamina($char_id, $stat_value_to_add);
                change_karma($char_id, 1);
                // Only add 1 to karma via levelling.
                change_ki($char_id, 50);
                // Add 50 ki points via levelling.
                addHealth($char_id, $health_to_add);
                addTurns($char_id, $turns_to_give);
                // Send a level-up message, for those times when auto-levelling happens.
                send_event($char_id, $char_id, "You levelled up!  Your strength raised by {$stat_value_to_add}, speed by {$stat_value_to_add}, stamina by {$stat_value_to_add}, Karma by 1, and your Ki raised 50!  You gained some health and turns as well!  You are now a level {$userLevel} ninja!  Go kill some stuff.");
                return true;
            } else {
                return false;
            }
        }
    }
}
Beispiel #4
0
         }
     } else {
         $turn_cost = 0;
         $generic_skill_result_message = '__TARGET__ is already iced.';
     }
 } else {
     if ($command == 'Cold Steal') {
         if (!$target->hasStatus(SLOW)) {
             $critical_failure = rand(1, 100);
             if ($critical_failure > 7) {
                 // *** If the critical failure rate wasn't hit.
                 if ($target->vo->turns >= 10) {
                     $turns_decrease = rand(2, 7);
                     subtractTurns($target->vo->player_id, $turns_decrease);
                     $target->addStatus(SLOW);
                     addTurns($char_id, $turns_decrease);
                     $msg = "You have had Cold Steal cast on you for {$turns_decrease} by {$attacker_id}";
                     send_event($attacker_char_id, $target->id(), $msg);
                     $generic_skill_result_message = "You cast Cold Steal on __TARGET__ and take {$turns_decrease} turns.";
                 } else {
                     $turn_cost = 0;
                     $generic_skill_result_message = '__TARGET__ did not have enough turns to give you.';
                 }
             } else {
                 // *** CRITICAL FAILURE !!
                 $player->addStatus(FROZEN);
                 $unfreeze_time = date('F j, Y, g:i a', mktime(date('G') + 1, 0, 0, date('m'), date('d'), date('Y')));
                 $failure_msg = "You have experienced a critical failure while using Cold Steal. You will be unfrozen on {$unfreeze_time}";
                 sendMessage("SysMsg", $username, $failure_msg);
                 $generic_skill_result_message = "Cold Steal has backfired! You are frozen until {$unfreeze_time}!";
             }