本文整理汇总了PHP中SR_Player::isHuman方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::isHuman方法的具体用法?PHP SR_Player::isHuman怎么用?PHP SR_Player::isHuman使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SR_Player
的用法示例。
在下文中一共展示了SR_Player::isHuman方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: combatTimer
public static function combatTimer(SR_Player $player)
{
$ai = $player->getVar('sr4pl_combat_ai');
if ($ai === NULL) {
if ($player->isHuman()) {
return;
} else {
$ai = self::DEFAULT_COMBAT_AI;
}
}
// $data = array();
// $total = 0;
$decisions = array();
$ai = explode(';', $ai);
foreach ($ai as $func) {
$func = trim($func);
if (preg_match('/([a-z_]+)(\\([^\\)]+\\))?([-+*\\/]\\d+)?/i', $func, $matches)) {
$funcname = $matches[1];
$classname = 'ShadowAI_' . $funcname;
if (class_exists($classname)) {
$args = isset($matches[1]) ? explode(',', $matches[1]) : NULL;
$multi = isset($matches[2]) ? $matches[2] : '*1';
$decision = call_user_func(array($classname, 'decideCombat'), $player, $args);
if ($decision !== NULL) {
$command = $decision[0];
$prefer = $decision[1];
$prefer = eval("{$prefer}{$multi};");
// $chance = (int)($prefer*100);
// $total += $chance;
// $data[] = array($command, $chance);
$decisions[$command] = $prefer;
}
} else {
Dog_Log::debug(sprintf('%s has an invalid AI method: %s.', $player->getName(), $funcname));
}
} else {
Dog_Log::debug(sprintf('PREG MATCH FAILED: %s.', $func));
}
}
# Best
if (count($decisions) > 0) {
arsort($decisions);
$command = key($decisions);
$player->combatPush($command);
}
# Rand
// if (false !== ($command = Shadowfunc::randomData($data, $total)))
// {
// $player->combatPush($command);
// }
}
示例2: onKill
public static function onKill(SR_Player $killer, SR_Player $victim)
{
if (!$killer->isHuman()) {
return true;
}
if ($victim instanceof SR_HireNPC) {
$column = 'npc';
} elseif ($victim instanceof SR_NPC) {
$column = 'mob';
} else {
if ($victim->isRunner()) {
$column = 'runner';
} else {
$column = 'human';
}
}
if (false === ($stats = self::getOrCreateStats($killer))) {
return false;
}
return $stats->increase('sr4ps_kill_' . $column, 1);
}
示例3: announceKilled
private function announceKilled(SR_Player $killer)
{
$famous = $this->isRunner() ? 'famous' : 'newbie';
$famous2 = $killer->isRunner() ? 'famous' : 'newbie';
$npchuman = $killer->isHuman() ? 'runner' : 'NPC';
$message = sprintf('[Shadowlamb] - The %s runner %s got killed by the %s %s %s', $famous, $this->getName(), $famous2, $npchuman, $killer->getName());
Shadowshout::sendGlobalMessage($message);
}
示例4: diceHits
public static function diceHits($mindmg, $arm, $atk, $def, SR_Player $player, SR_Player $target)
{
$ep = $target->getParty();
if ($player->isHuman()) {
if ($target->isHuman()) {
// $oops = rand(80, 250) / 10;
$oops = self::diceFloat(6.0, 9.0, 1);
} else {
// $oops = rand(80, 190) / 10;
$oops = $player->getBase('level') * 0.1;
$oops = self::diceFloat(6.0 + $oops, 9.0 + $oops, 1);
}
} else {
if ($target->isHuman()) {
// $rand = rand(12, 20) / 10;
// $oops = $rand + $ep->getMemberCount()*0.3; # + $ep->getMax('level', true)*0.01;
$oops = 0.2 + $target->getBase('level') * 0.05;
$oops *= Common::pow(1.28, $ep->getMemberCount());
} else {
// $oops = rand(80, 250) / 10;
$oops = self::diceFloat(0.8, 2.5, 1);
}
}
// $chances = (($atk*10 + $mindmg*5) / ($def*5 + $arm*2)) * $oops * 0.65;
$chances = ($atk * 20 + $mindmg * 50) / ($def * 5 + $arm * 2) * $oops * 0.7;
// echo "OOOOOOOPS: $oops\n";
// return Shadowfunc::dicePool(round($chances), round($def)+1, round(sqrt($def)));
return Shadowfunc::dicePoolB($chances, $def);
}