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) { echo "{$attackee} has taken {$loot} gold from you.<br>\n"; }
public function subtractStatus($status_in_caps) { subtractStatus($status_in_caps); }
} else { echo "You cannot heal with zero gold.<br>\n"; } } else { echo "You must resurrect before you can heal.<br>\n"; } } else { if ($poisoned == 1) { // *** POISON SECTION *** if (getHealth($username) > 0) { $cost = 50; // the cost of curing poison is set here. if ($startingGold >= $cost) { if (getStatus($username) && $status_array['Poison']) { subtractGold($username, $cost); subtractStatus($username, POISON); echo "You have been cured!<br>\n"; } else { echo "You are not ill.<br><br>\n"; } } else { echo "You need more gold to remove poison.<br>\n"; } } else { echo "You must resurrect before you can heal.<br>\n"; } } } ?> </div> <!-- End of heal-result div -->
$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); } } $turns_to_take = 1; // *** remove Item *** echo "<br>Removing {$item->getName()} from your inventory.<br>\n"; $sql->Update("UPDATE inventory set amount = amount-1 WHERE owner = '" . $username . "' AND item ='{$item->getName()}' AND amount>0"); // *** Decreases the item amount by 1. // Unstealth if (!$item->isCovert() && $give != "on" && $give != "Give" && getStatus($username) && $status_array['Stealth']) { //non-covert acts subtractStatus($username, STEALTH); echo "Your actions have revealed you. You are no longer stealthed.<br>\n"; } if ($victim_alive == true && $using_item == true) { $self_targetting = $selfTarget ? '&selfTarget=1' : ''; echo "<br><a href=\"inventory_mod.php?item=" . urlencode($item->getName()) . "&target={$target}{$self_targetting}\">Use {$item->getName()} again?</a><br>\n"; //Repeat Usage } } } } // *** Take away at least one turn even on attacks that fail. *** if ($turns_to_take < 1) { $turns_to_take = 1; } $ending_turns = subtractTurns($username, $turns_to_take);
function addStatus($who, $what) { global $sql; $status = $sql->QueryItem("SELECT status FROM players WHERE uname = '{$who}'"); if ($what < 0) { return subtractStatus($who, abs($what)); } if (!($status & $what)) { $sql->Update("UPDATE players SET status = status+{$what} WHERE uname = '{$who}'"); if ($who == $_SESSION['username']) { $_SESSION['status'] += $what; } } return getStatus($who); }