Ejemplo n.º 1
0
 /**
  * @return void
  */
 private function logDuel($attacker, $target, $winner, $killpoints)
 {
     $duel_log_msg = "%s has dueled {$target->name()} and ";
     if ($attacker !== $winner) {
         $duel_log_msg .= "lost at " . date("F j, Y, g:i a");
     } else {
         if ($killpoints > 1 || $killpoints < 0) {
             $duel_log_msg .= "won {$killpoints} killpoints.";
         } else {
             $duel_log_msg = '';
         }
     }
     if ($duel_log_msg !== '') {
         Event::create((int) "SysMsg", (int) "SysMsg", sprintf($duel_log_msg, $attacker->name(), $target->name()));
         GameLog::sendLogOfDuel($attacker->name(), $target->name(), $attacker === $winner, $killpoints);
     }
 }
Ejemplo n.º 2
0
     }
     if ($attackerHealthRemaining < 1) {
         // *** DEFENDER KILLS ATTACKER! ***
         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 " . date("F j, Y, g:i a");
             sendMessage("SysMsg", "SysMsg", $duel_log_msg);
             GameLog::sendLogOfDuel($attacker, $target, 0, $killpoints);
             // *** Makes a loss in the duel log. ***
         }
         $target_player->addKills($defenderKillpoints);
         // Adds a kill for the defender
         $attacking_player->death();
         if (!$simultaneousKill) {
             $loot = floor($gold_mod * $attacking_player->gold());
             //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);
     }
 }