本文整理汇总了PHP中SR_Player::getEnemyParty方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::getEnemyParty方法的具体用法?PHP SR_Player::getEnemyParty怎么用?PHP SR_Player::getEnemyParty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SR_Player
的用法示例。
在下文中一共展示了SR_Player::getEnemyParty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: getOffensiveTarget
/**
* @param SR_Player $player
* @param string $arg
* @return SR_Player
*/
public static function getOffensiveTarget(SR_Player $player, $arg)
{
return self::getTarget($player->getEnemyParty()->getMembers(), $arg);
}
示例4: getSmallestDistance
/**
* Calculate the smallest distance the player has from any enemy.
* @param $player
*/
private function getSmallestDistance(SR_Player $player)
{
$d1 = $this->distance[$player->getID()];
$ep = $player->getEnemyParty();
$back = 1000;
foreach ($ep->distance as $pid => $d2) {
$d3 = abs($d1 - $d2);
if ($d3 < $back) {
$back = $d3;
}
}
return $back;
}