Example #1
0
         echo "You have taken {$loot} gold from {$attackee}.<br>\n";
     }
     runBountyExchange($username, $attackee);
     // *** Determines bounty for dueling. ***
 }
 if ($attackerHealthRemaining < 1) {
     // *** DEFENDER KILLS ATTACKER! ***
     $defenderKillpoints = 1;
     if ($duel) {
         // *** if they were dueling when they died ***
         $duel_log_msg = "{$username} has dueled {$attackee} and lost at {$today}.";
         sendMessage("SysMsg", "SysMsg", $duel_log_msg);
         sendLogOfDuel($username, $attackee, 0, $killpoints);
         // *** Makes a loss in the duel log. ***
     }
     addKills($attackee, $defenderKillpoints);
     // *** Adds a kill for the defender. ***
     subtractStatus($username, STEALTH + POISON + FROZEN + CLASS_STATE);
     if (!$simultaneousKill) {
         $loot = round($gold_mod * getGold($username));
         //Loot for defender if he lives.
         addGold($attackee, $loot);
         subtractGold($username, $loot);
     }
     $attackee_msg = "<div class='ninja-notice'>\n\t\t\t\tYou have killed {$username} in combat and taken {$loot} gold on {$today}.\n\t\t\t\t</div>";
     $attacker_msg = "DEATH: You have been killed by {$attackee} in combat and lost {$loot} gold on {$today}!";
     sendMessage($username, $attackee, $attackee_msg);
     sendMessage($attackee, $username, $attacker_msg);
     echo "<div class='ninja-error'>{$attackee} has killed you!</div>\n";
     echo "<div class='ninja-notice'>\n\t\t\t\tYou have been slain!  Go to the <a href=\"shrine.php\">Shrine</a> to return to the living.<br>\n\t\t\t\t</div>\n";
     if (!$simultaneousKill) {
Example #2
0
             }
         }
     }
 }
 if (!$victim_alive) {
     // Target was killed by the item.
     if (getStatus($username) && $target != $username) {
         // *** SUCCESSFUL KILL ***
         $attacker_id = $status_array['Stealth'] ? "A Stealthed Ninja" : $username;
         if (!$gold_mod) {
             $gold_mod = 0.15;
         }
         $loot = round($gold_mod * getGold($target));
         subtractGold($target, $loot);
         addGold($username, $loot);
         addKills($username, 1);
         echo "You have killed {$target} with {$article} {$item->getName()}!<br>\n";
         echo "You receive {$loot} gold from {$target}.<br>\n";
         runBountyExchange($username, $target);
         //Rewards or increases bounty.
     } else {
         $loot = 0;
         echo "You have comitted suicide!<br>\n";
     }
     send_kill_mails($username, $target, $attacker_id, $article, $item->getName(), $today, $loot);
 } else {
     $attacker_id = $username;
 }
 if ($target != $username) {
     $target_email_msg = "{$attacker_id} has used {$article} {$item->getName()} on you at {$today} and caused you to {$result}.";
     sendMessage($attacker_id, $target, $target_email_msg);
Example #3
0
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)));
}
Example #4
0
 $does_ninja_succeed = rand(0, 1);
 if ($does_ninja_succeed) {
     $samurai_damage_array[2] = rand(30 + round($ninja_str * 0.2), 30 + round($ninja_str * 1.7));
 } else {
     $samurai_damage_array[2] = abs($ninja_health - $samurai_damage_array[0] - $samurai_damage_array[1]);
     //Instant death.
 }
 for ($i = 0; $i < 3 && $ninja_health > 0; ++$i) {
     $ninja_health = $ninja_health - $samurai_damage_array[$i];
 }
 if ($ninja_health > 0) {
     // *** Ninja still has health after all three attacks. ***
     $victory = true;
     $samurai_gold = rand(50, 50 + $samurai_damage_array[2] + $samurai_damage_array[1]);
     add_gold($char_id, $samurai_gold);
     addKills($char_id, 1);
     if ($samurai_damage_array[2] > 100) {
         // *** If samurai damage was over 100, but the ninja lived, give some extra rewards. ***
         if (rand(0, 1)) {
             $drop = true;
             $drop_display = 'mushroom powder';
             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;
Example #5
0
             if ($simultaneousKill = $attackerHealthRemaining < 1) {
                 // *** If both died at the same time. ***
             } else {
                 $victor = $target;
                 $loser = $attacker;
             }
             $attacker_died = true;
             $defenderKillpoints = 1;
             if ($duel) {
                 // *** if they were dueling when they died ***
                 $duel_log_msg = "{$attacker} has dueled {$target} and lost at {$today}.";
                 sendMessage("SysMsg", "SysMsg", $duel_log_msg);
                 sendLogOfDuel($attacker, $target, 0, $killpoints);
                 // *** Makes a loss in the duel log. ***
             }
             addKills($target_id, $defenderKillpoints);
             // *** Adds a kill for the defender. ***
             $attacking_player->death();
             if (!$simultaneousKill) {
                 $loot = round($gold_mod * get_gold($attacker_id));
                 //Loot for defender if he lives.
             }
             $target_msg = "You have killed {$attacker} in combat and taken {$loot} gold.";
             $attacker_msg = "DEATH: You've been killed by {$target} and lost {$loot} gold!";
             sendMessage($attacker, $target, $target_msg);
             sendMessage($target, $attacker, $attacker_msg);
         }
     }
     // *** END MAIN ATTACK AND DUELING SECTION ***
 }
 if ($loot) {