if ($give == "on" || $give == "Give") { echo render_give_item($username, $target, $item->getName()); } else { // *** HP Altering *** if ($item->getTargetDamage() > 0) { $result = "lose " . $item->getTargetDamage() . " HP"; $victim_alive = subtractHealth($target, $item->getTargetDamage()); } else { if ($item === $stealthScroll) { addStatus($target, STEALTH); echo "<br>{$target} is now Stealthed.<br>\n"; $result = false; $victim_alive = true; } else { if ($item === $dimMak) { setHealth($target, 0); $victim_alive = false; $result = "be drained of your life-force and die!"; $gold_mod = 0.25; //The Dim Mak takes away 25% of a targets' gold. } else { if ($item->getTurnChange() <= 0) { $turns_change = $item->getTurnChange(); if ($turns_change == 0) { echo 'You fail to take any turns from ' . $target . '.'; } $result = "lose " . -1 * $turns_change . " turns"; changeTurns($target, $turns_change); $victim_alive = true; } else { if ($item->getTurnChange() > 0) {
echo "You have gained {$samurai_gold} gold.<br>\n"; echo "You gain a kill point.<br>\n"; if ($samurai_damage_array[3] > 100) { // *** If samurai damage was over 100, but the ninja lived, give a speed scroll. *** addItem($username, 'Speed Scroll', $quantity = 1); echo "The Samurai had a speed scroll on him. You have a new Speed Scroll in your inventory.\n"; } if ($samurai_damage_array[3] == $ninja_str * 3) { // *** If the final damage was the exact max damage... *** addItem($username, "Dim Mak", 1); echo "You have gained a Dim Mak from the Samurai.<br>\n"; } setHealth($username, $ninja_health); } else { // *** Cheaty trickery from the samurai kills the ninja. *** setHealth($username, 0); } // *** End samurai trickery *** } } // *** End valid turns and kills for the attack. *** } else { if ($victim == "merchant") { echo "Merchant sees you and prepares to defend!<br><br>\n"; echo "<img src=\"images/characters/merchant.png\" alt=\"Merchant\">"; $merchant_attack = rand(15, 35); // *** Merchant Damage *** if (!subtractHealth($username, $merchant_attack)) { echo "The Merchant has slain you!<br>\n"; echo "Go to the <a href=\"shrine.php\">shrine</a> to resurrect.<br>\n"; } else {
add_item($char_id, 'amanita', 1); } else { $drop = true; $drop_display = 'a strange herb'; add_item($char_id, 'ginsengroot', 1); } } if ($samurai_damage_array[2] == $ninja_str * 3) { // *** If the final damage was the exact max damage... *** $drop = true; $drop_display = 'a black scroll'; add_item($char_id, "dimmak", 1); } $player->vo->health = setHealth($char_id, $ninja_health); } else { $player->vo->health = setHealth($char_id, 0); $victory = false; $ninja_str = $samurai_gold = 0; } } // *** End valid turns and kills for the attack. *** $npc_template = 'npc.samurai.tpl'; $combat_data = array(); if (!$error) { $combat_data = array('samurai_damage_array' => $samurai_damage_array, 'gold' => $samurai_gold, 'victory' => $victory, 'ninja_str' => $ninja_str, 'level' => $attacker_level, 'attacker_kills' => $attacker_kills, 'drop' => $drop, 'drop_display' => $drop_display); } } else { if ($victim == 'merchant') { $merchant_attack = rand(15, 35); // *** Merchant Damage *** $added_bounty = 0;
// *** HP Altering *** $alternateResultMessage .= " __TARGET__ takes " . $item->getTargetDamage() . " damage."; if ($self_use) { $result .= "You take " . $item->getTargetDamage() . " damage!"; } else { if (strlen($targetResult) > 0) { $targetResult .= " You also"; // Join multiple targetResult messages. } $targetResult .= " take " . $item->getTargetDamage() . " damage!"; } $targetObj->vo->health = $victim_alive = $targetObj->subtractHealth($item->getTargetDamage()); // This is the other location that $victim_alive is set, to determine whether the death proceedings should occur. } if ($item->hasEffect('death')) { $targetObj->vo->health = setHealth($target_id, 0); $resultMessage = "The life force drains from __TARGET__ and they drop dead before your eyes!"; $victim_alive = false; $targetResult = " be drained of your life-force and die!"; $gold_mod = 0.25; //The Dim Mak takes away 25% of a targets' gold. } if ($turns_change !== null) { // Even if $turns_change is set to zero, let them know that. if ($turns_change > 0) { $resultMessage .= "__TARGET__ has gained back {$turns_change} turns!"; } else { if ($turns_change === 0) { $resultMessage .= "__TARGET__ did not lose any turns!"; } else { $resultMessage .= "__TARGET__ has lost " . abs($turns_change) . " turns!";
subtractStatus($username, STEALTH + POISON + FROZEN + CLASS_STATE); // *** FREE STEALTHING FOR BLACK CLASS UPON NON-FREE RESURRECTION if ($players_class == "Black" && !$freeResurrection) { addStatus($username, STEALTH); } echo "What once was dead shall rise again.<br>\n"; echo "Current Kills: " . $startingKills . "<br>\n"; echo "Adjusted Kills after returning to life: " . getKills($username) . "<br>\n"; } elseif ($startingTurns > 0) { echo "What once was dead shall rise again.<br>\n"; if ($startingTurns < $lostTurns && $startingTurns > 0) { $lostTurns = $startingTurns; } subtractTurns($username, $lostTurns); // *** Takes away necessary turns. setHealth($username, 100); subtractStatus($username, STEALTH + POISON + FROZEN + CLASS_STATE); echo "Since you have no kills, your resurrection will cost you part of your life time."; echo "Current Turns: " . $startingTurns . "<br>\n"; echo "Adjusted Turns after returning to life: " . getTurns($username) . "<br>\n"; } else { echo "You must wait for time to pass before you can return to life."; echo "Current Turns: " . $startingTurns . "<br>\n"; } } } // *** end of resurrection *** if ($healed == 1 || $max_heal == 1) { //If the user tried to heal themselves. // *** HEALING SECTION *** $max_health = 150 + ($userLevel - 1) * 25;
function kill($killer, $victim, $how, $what) { echo "{$killer} has killed {$victim}!<br>\n"; global $sql, $today; setHealth($victim, 0); subtractStatus($victim, STEALTH + POISON + FROZEN + CLASS_STATE); $kill_point = 1; $_killer = $killer; if ($how == "combat") { $msg = "{$killer} has killed you in combat on {$today}"; $gold_mod = 0.2; if ($what == "duel") { $msg = "{$killer} has killed you in a duel on {$today}"; $gold_mod = 0.25; } else { if ($what == "stealth") { $msg = "A stealthed player has killed you in combat on {$today}"; $gold_mod = 0.1; $kill_point = 0; $_killer = "A stealthed player"; } } } else { if ($how == "item") { $msg = "{$killer} has killed you using {$what} on {$today}"; $gold_mod = 0.15; } else { if ($how == "skill") { $msg = "{$killer} has killed you using {$what} on {$today}"; $gold_mod = 0.15; } } } $gold_won = takeGold($victim, $killer, $gold_mod); $msg .= " and taken {$gold_won} gold."; if ($kill_point) { addKills($killer, $kill_point); } sendMessage($_killer, $victim, $msg); sendMessage($victim, $killer, str_replace($_killer . " has", "You have", str_replace("you", $victim, $msg))); }