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


PHP SR_Player::isFighting方法代码示例

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


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

示例1: showDistances

 private static function showDistances(SR_Player $player)
 {
     $p = $player->getParty();
     $format = $player->lang('fmt_sumlist');
     $key = $player->isFighting() ? '5123' : '5124';
     $out = '';
     foreach ($p->getMembers() as $member) {
         $member instanceof SR_Player;
         $val = $player->isFighting() ? $p->getDistance($member) : $member->getBase('distance');
         $out .= sprintf($format, $member->getEnum(), $member->getName(), $val);
         // 			$out .= sprintf(', %s:%s(%s)', $member->getName(), $member->getBase('distance'), $p->getDistance($member));
     }
     return self::rply($player, $key, array(ltrim($out, ',; ')));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:14,代码来源:set_distance.php

示例2: execute

 public static function execute(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->msg('1036');
         // 			$player->message('This does not work in combat');
         return false;
     }
     $argc = count($args);
     if ($argc < 1 || $argc > 2) {
         $player->message(Shadowhelp::getHelp($player, 'givekw'));
         return false;
     }
     if ($argc === 2) {
         if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0]))) {
             $player->msg('1028', array($args[0]));
             #$player->message(sprintf('%s is not here or the name is ambigous.', $args[0]));
             return false;
         }
         $word = $args[1];
         $targets = array($target);
     } else {
         $word = $args[0];
         $targets = $player->getParty()->getMembers();
     }
     if (false === $player->hasKnowledge('words', $word)) {
         $player->msg('1023');
         # You don`t have this knowledge.
         return false;
     }
     return self::giveKnow($player, $targets, 'words', $args[1]);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:31,代码来源:givekw.php

示例3: onItemUse

 public function onItemUse(SR_Player $player, array $args)
 {
     $busy = $player->isFighting() ? $this->getItemUseTime() : 0;
     //		if ($this->isBroken())
     //		{
     //			$player->message(sprintf('Your %s is broken and cannot get consumed.', $this->getItemName()));
     //			return false;
     //		}
     # Consume it
     if ($this->useAmount($player, 1, false)) {
         $this->onConsume($player);
         SR_Feelings::consume($player, $this);
         $player->modify();
     }
     if ($busy > 0) {
         $busy = $player->busy($busy);
     }
     # Announce Usage
     $pname = $player->getName();
     $p = $player->getParty();
     $p->ntice('5201', array($pname, $this->getName(), $busy));
     if ($p->isFighting()) {
         $ep = $p->getEnemyParty();
         $ep->ntice('5201', array($pname, $this->getName(), $busy));
     }
     # Announce Usage
     // 		$message = $this->getConsumeMessage($busy);
     // 		$p = $player->getParty();
     // 		$p->message($player, $message);
     // 		if ($p->isFighting()) {
     // 			$player->getEnemyParty()->message($player, $message);
     // 		}
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:33,代码来源:SR_Consumable.php

示例4: onItemUse

 public function onItemUse(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->message('You cannot use this item in combat.');
         return false;
     }
     $bot = Shadowrap::instance($player);
     $mods = $this->getItemModifiersB();
     $field = key($mods);
     $level = array_shift($mods);
     $key = "__SLMSCR_{$field}";
     if (false !== SR_PlayerVar::getVal($player, $key)) {
         return $bot->reply('You already read this master scroll.');
     }
     if ($player->getBase($field) < 0) {
         return $bot->reply("You have to learn {$field} in order to read a master scroll.");
     }
     if (!$this->useAmount($player, 1)) {
         return $bot->reply('Database error!');
     }
     if (false === $player->increaseField($field)) {
         return $bot->reply('Database error 2!');
     }
     if (false === SR_PlayerVar::setVal($player, $key, '1')) {
         return $bot->reply('Database error 3!');
     }
     $player->modify();
     return $bot->reply(sprintf('You read the %s and got your %s increased by 1.', $this->getItemName(), $field));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:29,代码来源:MasterScroll.php

示例5: execute

 public static function execute(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->msg('1036');
         // 			$player->message('This does not work in combat');
         return false;
     }
     $argc = count($args);
     if ($argc < 1 || $argc > 2) {
         $player->message(Shadowhelp::getHelp($player, 'givekp'));
         return false;
     }
     if ($argc === 2) {
         if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0]))) {
             $player->msg('1028', array($args[0]));
             // 			$player->message(sprintf('%s is not here or the name is ambigous.', $args[0]));
             return false;
         }
         $place = $args[1];
         $targets = array($target);
     } else {
         $place = $args[0];
         $targets = $player->getParty()->getMembers();
     }
     if (false === ($tlc = Shadowcmd_goto::getTLCByArgMulticity($player, $place))) {
         $player->msg('1023');
         return false;
     }
     return self::giveKnow($player, $targets, 'places', $tlc);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:30,代码来源:givekp.php

示例6: onScanLevel5

 public function onScanLevel5(SR_Player $player, SR_Player $target)
 {
     $message = Shadowfunc::getSpells($target, '5307');
     if ($player->isFighting()) {
         $player->message($message);
     } else {
         Shadowrap::instance($player)->reply($message);
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:Scanner_v5.php

示例7: reply

 protected function reply(SR_Player $player, $message)
 {
     if ($player->isFighting()) {
         $player->message($message);
     } else {
         Shadowrap::instance($player)->reply($message);
     }
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:Holostick.php

示例8: announceUsage

 public function announceUsage(SR_Player $player, SR_Player $target, $message = '', $message2 = '', $useamt = 1)
 {
     if ($player->isFighting()) {
         $busy = $player->busy($this->getItemUsetime());
         $busymsg = $player->lang('busy', array($busy));
         #sprintf(' %ds busy.', $busy);
     } else {
         $busymsg = '';
     }
     $player->getParty()->ntice('5228', array($player->displayNameNB(), $this->getName(), $target->displayNameNB(), $busymsg, $message));
     // 		$player->getParty()->notice(sprintf('%s used %s on %s.%s%s', $player->getName(), $this->getName(), $target->getName(), $busymsg, $message));
     if ($player->isFighting()) {
         $player->getEnemyParty()->ntice('5229', array($player->displayNameNB(), $this->getName(), $target->displayNameNB(), $busymsg, $message2));
         // 			$player->getEnemyParty()->notice(sprintf('%s used %s on %s.%s', $player->getName(), $this->getName(), $target->getName(), $message2));
     }
     if ($useamt > 0) {
         return $this->useAmount($player, $useamt);
     }
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:20,代码来源:SR_Usable.php

示例9: onScanLevel1

 public function onScanLevel1(SR_Player $player, SR_Player $target)
 {
     #$message = $target->getName().': '.Shadowfunc::getStatus($target);
     $message = Shadowfunc::getStatus($target, '5301');
     $message2 = Shadowfunc::getEquipment($target, '5303');
     if ($player->isFighting()) {
         $player->message($message);
         $player->message($message2);
     } else {
         Shadowrap::instance($player)->reply($message);
         Shadowrap::instance($player)->reply($message2);
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:13,代码来源:Scanner_v1.php

示例10: execute

 public static function execute(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->msg('1036');
         // 			$player->message('This does not work in combat');
         return false;
     }
     if (count($args) !== 2) {
         $player->message(Shadowhelp::getHelp($player, 'giveny'));
         return false;
     }
     if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0]))) {
         $player->msg('1028', array($args[0]));
         // 			$player->message(sprintf('%s is not here or the name is ambigous.', $args[0]));
         return false;
     }
     return self::giveNuyen($player, $target, 'nuyen', $args[1]);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:18,代码来源:giveny.php

示例11: 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

示例12: onCast

 public function onCast(SR_Player $player, array $args, $wanted_level = true)
 {
     if ($this instanceof SR_CombatSpell) {
         if ($this->mode === self::MODE_BREW) {
         } elseif (!$player->isFighting()) {
             $player->msg('1052', array($this->getName()));
             // 				$player->message(sprintf('The spell %s works in combat only.', $this->getName()));
             return false;
         } elseif (count($args) === 0) {
             $members = $player->getEnemyParty()->getMembers();
             if (count($members) === 0) {
                 $player->msg('1052', array($this->getName()));
                 return false;
             }
             $member = $members[array_rand($members)];
             $args[] = $member->getEnum();
             //				$args[] = rand(1, $player->getEnemyParty()->getMemberCount());
         }
     } else {
         if (count($args) === 0) {
             $args[] = $player->getName();
         }
     }
     if ($this->mode === self::MODE_BREW) {
         # Dummy player
         $target = Shadowrun4::getDummyPlayer();
     } elseif (false === ($target = $this->getTarget($player, $args))) {
         return false;
     }
     $level = $this->getLevel($this->getCaster());
     if ($this->mode === self::MODE_BREW) {
         $level = $wanted_level;
     } elseif ($wanted_level !== true) {
         $wanted_level = (int) $wanted_level;
         if ($wanted_level < 0) {
             $player->msg('1053');
             // 				$player->message('You cannot cast a spell with a level smaller than 0.');
             return false;
         } elseif ($wanted_level > $level) {
             $player->msg('1054', array($this->getName(), $wanted_level, $level));
             // 				$player->message(sprintf('You cannot cast %s level %s because your spell level is only %s.', $this->getName(), $wanted_level, $level));
             return false;
         } else {
             $level = $wanted_level;
         }
     }
     $mp_faktor = $this->mode === self::MODE_BREW ? 1.5 : 1.0;
     $need = round($this->getManaCost($player, $level) * $mp_faktor, 1);
     $need = Common::clamp($need, 1, 1000000);
     $have = $player->getMP();
     if ($need > $have && false === $this->isPotionMode()) {
         $player->msg('1055', array($need, $this->getName(), $level, $have));
         // 			$player->message(sprintf('You need %s MP to cast %s, but you only have %s.', $need, $this->getName(), $have));
         return false;
     }
     $hits = $this->dice($this->getCaster(), $target, $level);
     echo "!!! CASTED {$hits} hits !!!\n";
     $busy = '';
     if ($player->isFighting()) {
         $busy = Shadowfunc::displayBusy($player->busy($this->getCastTime($level)));
     }
     // 		if ($hits < $target->get('essence'))
     // 		{
     // 			$waste = round($need/2, 1);
     // 			$player->healMP(-$waste);
     // 			$player->msg('1056', array($this->getName(), $waste, $busy));
     // // 			$player->message(sprintf('You failed to cast %s. %s MP wasted.%s', $this->getName(), $waste, $busy));
     // 			return false;
     // 		}
     if (false === $this->isPotionMode()) {
         $player->healMP(-$need);
     }
     if ($this->mode === self::MODE_BREW) {
         return true;
     }
     return $this->cast($player, $target, $level, $hits, $player);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:77,代码来源:SR_Spell.php


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