当前位置: 首页>>代码示例>>PHP>>正文


PHP SR_Player::isNPC方法代码示例

本文整理汇总了PHP中SR_Player::isNPC方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::isNPC方法的具体用法?PHP SR_Player::isNPC怎么用?PHP SR_Player::isNPC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SR_Player的用法示例。


在下文中一共展示了SR_Player::isNPC方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isKillProtectedB

 /**
  * Check the database for a recent kill.
  * @param SR_Player $killer
  * @param SR_Player $victim
  * @return false|int timestamp
  */
 private static function isKillProtectedB(SR_Player $killer, SR_Player $victim)
 {
     if (true === $killer->isNPC() || true === $victim->isNPC()) {
         return false;
     }
     foreach (self::$CACHE as $entry) {
         $search = $killer->getID() . ':' . $victim->getID() . ':';
         $pos = strpos($entry, $search);
         if ($pos !== false) {
             return (int) substr($entry, strlen($search));
         }
     }
     return false;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:20,代码来源:SR_KillProtect.php

示例2: reply

 public static function reply(SR_Player $player, $message)
 {
     return $player->isNPC() || $player->isFighting() && self::isCombatCommand() ? $player->message($message) : Dog::reply($message);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:4,代码来源:Shadowcmd.php

示例3: gotKilledByNPC

 public function gotKilledByNPC(SR_Player $killer)
 {
     // 		$this->looseItem($killer);
     if ($this->isRunner()) {
         # Forever a dead?
         if ($killer->isNPC() || $killer->isRunner()) {
             $this->saveOption(self::DEAD, true);
         }
     }
     // 		$this->announceKilled($killer);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:SR_Player.php

示例4: multiDamage

 /**
  * Do damage to multiple targets and announce the kills and damage in a compressed way.
  * @param SR_Player $player
  * @param array $damage
  */
 public static function multiDamage(SR_Player $player, array $damage, $spellname = 'Spell')
 {
     $p = $player->getParty();
     $mc = $p->getMemberCount();
     $ep = $p->getEnemyParty();
     $loot_xp = array();
     $loot_ny = array();
     foreach ($p->getMembers() as $member) {
         $loot_xp[$member->getID()] = 0;
         $loot_ny[$member->getID()] = 0;
     }
     $out = array();
     // 		$out = '';
     // 		$out_ep = '';
     foreach ($damage as $pid => $dmg) {
         if ($dmg <= 0) {
             continue;
         }
         $target = $ep->getMemberByPID($pid);
         $target->dealDamage($dmg);
         if (true === $target->isDead()) {
             $xp = $target->isHuman() ? 0 : $target->getLootXP();
             //				$xp = $target->getLootXP();
             $nuyen = $target->getLootNuyen();
             if ($player->isNPC()) {
                 $target->resetXP();
             }
             $target->giveNuyen(-$nuyen);
             // 				$app = Shadowrun4::lang('kills', array($target->getName(), $dmg));
             $out[$target->getID()] = array($target, $dmg, true);
             // 				$out .= $app;
             // 				$out_ep .= $app;
             // 				$out .= sprintf(', kills %s with %s', $target->getName(), $dmg);
             // 				$out_ep .= sprintf(', kills %s with %s', $target->getName(), $dmg);
             $pxp = 0;
             foreach ($p->getMembers() as $member) {
                 $lxp = $xp / $mc;
                 $leveldiff = ($target->getBase('level') + 1) / ($member->getBase('level') + 1);
                 $lxp *= $leveldiff;
                 $lxp = round(Common::clamp($lxp, 0.01), 2);
                 $pxp += $lxp;
                 $loot_xp[$member->getID()] += $lxp;
                 $loot_ny[$member->getID()] += $nuyen / $mc;
             }
             $p->givePartyXP($pxp);
         } else {
             $out[$target->getID()] = array($target, $dmg, false);
             // 				$out .= Shadowrun4::lang('hits1', array($target->getName(), $dmg));
             // 				$out_ep .= Shadowrun4::lang('hits2', array($target->getName(), $dmg, $target->getHP(), $target->getMaxHP()));
             // 				$out .= sprintf(', hits %s with %s damage', $target->getName(), $dmg);
             // 				$out_ep .= sprintf(', hits %s with %s(%s/%s)HP left', $target->getName(), $dmg, $target->getHP(), $target->getMaxHP());
         }
     }
     ### OUTPUT
     if (count($out) === 0) {
         $p->ntice('1057', array($spellname, $player->getName()));
         // 			$p->notice($failmsg);
         return;
     }
     ### FRIEND PARTY
     // 		$out = substr($out, 2);
     foreach ($p->getMembers() as $member) {
         $member instanceof SR_Player;
         $loot_out = '';
         $ny = $loot_ny[$member->getID()];
         $xp = $loot_xp[$member->getID()];
         // 			$xp = round($xp, 2);
         if ($ny > 0 || $xp > 0) {
             $loot_out = $member->lang('loot_nyxp', array(Shadowfunc::displayNuyen($ny), $xp));
             // 				$loot_out = sprintf('. You loot %s and %.02f XP', Shadowfunc::displayNuyen($ny), $xp);
             $member->giveNuyen($ny);
             $member->giveXP($xp);
         }
         $msg = $player->getName();
         foreach ($out as $pid => $data) {
             list($target, $dmg, $is_kill) = $data;
             $target instanceof SR_Player;
             $key = true === $is_kill ? 'kills' : 'hits1';
             // 				$app = Shadowrun4::lang('kills', array($target->getName(), $dmg));
             $msg .= $member->lang($key, array($target->getName(), $dmg));
         }
         $member->message($msg . $loot_out . '.');
     }
     # ENEMY PARTY
     // 		$out_ep = substr($out_ep, 2);
     // 		$ep->message($player, $out_ep.'.');
     foreach ($ep->getMembers() as $member) {
         $msg = '';
         foreach ($out as $pid => $data) {
             list($target, $dmg, $is_kill) = $data;
             $target instanceof SR_Player;
             $key = true === $is_kill ? 'kills' : 'hits2';
             $msg .= $member->lang($key, array($target->getName(), $dmg, $target->getHP(), $target->getMaxHP()));
         }
         $member->message($msg . $loot_out . '.');
//.........这里部分代码省略.........
开发者ID:sinfocol,项目名称:gwf3,代码行数:101,代码来源:Shadowfunc.php


注:本文中的SR_Player::isNPC方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。