} } echo "<hr><br>\n"; // *** 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 {
$counter = 1; } $counter = $counter + 1; SESSION::set('counter', $counter); // Save the current state of the counter. if ($counter > 20 && rand(1, 3) == 3) { // Only after many attacks do you have the chance to be attacked back by the group of theives. SESSION::set('counter', 0); // Reset the counter to zero. $group_attack = rand(50, 150); if ($player->vo->health = $victory = subtractHealth($char_id, $group_attack)) { // The den of thieves didn't accomplish their goal $group_gold = rand(100, 300); if ($group_attack > 120) { // Powerful attack gives an additional disadvantage subtractKills($char_id, 1); } add_gold($char_id, $group_gold); add_item($char_id, 'phosphor', $quantity = 1); } else { // If the den of theives killed the attacker. $group_gold = 0; } $npc_template = 'npc.thief-group.tpl'; $combat_data = array('attack' => $group_attack, 'gold' => $group_gold, 'victory' => $victory); } else { // Normal attack on a single thief. $thief_attack = rand(0, 35); // *** Thief Damage *** if ($player->vo->health = $victory = subtractHealth($char_id, $thief_attack)) { $thief_gold = rand(0, 40);
// Reset the counter to zero. echo "<img src='images/scenes/KunitsunaTrainingWithTengu.jpg' alt='' style='width:1000px'>"; echo "<p>A group of tengu thieves is waiting for you. They seem to be angered by your attacks on their brethren.</p>"; $group_attack = rand(50, 150); if (!subtractHealth($username, $group_attack)) { // If the den of theives killed the attacker. echo "<p>The group of theives does {$group_attack} damage to you!</p>"; echo "<p>The group of thieves have avenged their brotherhood and beaten you to a bloody pulp.</p>"; echo "<p>Go to the <a href=\"shrine.php\">shrine</a> to resurrect.</p>"; } else { // The den of thieves didn't accomplish their goal $group_gold = rand(100, 300); if ($group_attack > 120) { // Powerful attack gives an additional disadvantage echo "<p>You overpowered the swine, but the blow to the head they gave you before they ran made you lose some of your memories!</p>"; subtractKills($username, 1); } echo "<p>The group of theives does {$group_attack} damage to you, but you rout them in the end!</p>"; echo "<p>You have gained {$group_gold} gold.</p> <p>You have found a firescroll on the body of one of the thieves!</p>"; addGold($username, $group_gold); addItem($username, 'Fire Scroll', $quantity = 1); } } else { // Normal attack on a single thief. echo "Thief sees you and prepares to defend!<br><br>\n"; echo "<img src=\"images/characters/thief.png\" alt=\"Thief\">\n"; $thief_attack = rand(0, 35); // *** Thief Damage *** if (!subtractHealth($username, $thief_attack)) { echo "Thief has slain you!<br>\n"; echo "Go to the <a href=\"shrine.php\">shrine</a> to resurrect.<br>\n";
/** * End-user resurrect operation, incurs costs and revives the dead player * * @param p_player Player the player to resurrect * @return int The value of the resurrect cost type * @throws RuntimeException Player is not dead * * @par Side Effects: * The health attribute of $p_player is changed in memory and database * * @par Preconditions: * Player must be dead to resurrect * * @note * If the Player qualifies for enhanced resurrection effects, enhancedResurrect will be called * * @see enhancedResurrect */ private function _resurrect($p_player) { if ($p_player->health() <= 0) { $costType = $this->calculateResurrectionCost($p_player); if ($costType === self::RES_COST_TYPE_KILL) { $this->enhancedResurrect($p_player); } else { $p_player->death(); $p_player->heal($this->calculateResurrectionHP($p_player)); } if ($costType === self::RES_COST_TYPE_KILL) { $p_player->vo->kills = subtractKills($p_player->id(), ShrineController::RES_COST_KILLS); } else { if ($costType === self::RES_COST_TYPE_TURN) { $p_player->vo->turns = subtractTurns($p_player->id(), min(ShrineController::RES_COST_TURNS, $p_player->turns)); } } return $costType; } else { throw new \RuntimeException('You are not dead.'); } }