本文整理汇总了PHP中SR_Player::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::getVar方法的具体用法?PHP SR_Player::getVar怎么用?PHP SR_Player::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SR_Player
的用法示例。
在下文中一共展示了SR_Player::getVar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onDealDamage
/**
* Poison the target.
* @see SR_Weapon::onDealDamage()
*/
public function onDealDamage(SR_Player $player, SR_Player $target, $hits, $damage)
{
$biotech = Common::clamp($target->getVar('biotech'), 0, 15);
$min = 0.1 - $biotech * 0.01;
$max = 0.3 - $biotech * 0.02;
$duration = rand(20, 40);
$per_sec = Shadowfunc::diceFloat($min, $max, 2);
if ($per_sec > 0) {
$modifiers = array('hp' => $per_sec);
$target->addEffects(new SR_Effect($duration, $modifiers));
$target->msg('5294', array(sprintf('%.02f', $per_sec), GWF_Time::humanDuration($duration)));
}
}
示例2: 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);
// }
}
示例3: getRandomName
public static function getRandomName(SR_Player $player)
{
static $rand = array('fairy_male' => array('Schwunkol'), 'fairy_female' => array('Ambra', 'Elina'), 'vampire_male' => array('Dracool', 'Vincent'), 'vampire_female' => array('Daria'), 'elve_male' => array('Filöen', 'Vincent'), 'elve_female' => array('Anja', 'Joanna'), 'darkelve_male' => array('Noplan'), 'darkelve_female' => array('Noplan'), 'woodelve_male' => array('Noplan'), 'woodelve_female' => array('Noplan'), 'halfelve_male' => array('Filöen', 'Alaster'), 'halfelve_female' => array('Anja'), 'human_male' => array('Lesley', 'Norman', 'Simon', 'Jessey', 'Tobias', 'Marcus', 'Oliver', 'Richard', 'Gandalf', 'Carsten', 'Mike', 'Paul', 'Wesley', 'Mathew', 'Jersey', 'Stephen'), 'human_female' => array('Mary', 'Tanny'), 'gnome_male' => array('Garry'), 'gnome_female' => array('Sabine'), 'dwarf_male' => array('Roon', 'Reiner', 'Oscar'), 'dwarf_female' => array('Alisa'), 'ork_male' => array('Grunt', 'Bruno'), 'ork_female' => array('Broga'), 'halfork_male' => array('Bren', 'Diego'), 'halfork_female' => array('Yuly'), 'halftroll_male' => array('Roon', 'Rodrigo'), 'halftroll_female' => array('Björk'), 'troll_male' => array('Roog'), 'troll_female' => array('Gunda'), 'gremlin_male' => array('gizmo'), 'gremlin_female' => array('gizma'));
$r = $rand[$player->getVar('sr4pl_race') . '_' . $player->getVar('sr4pl_gender')];
return GWF_Random::arrayItem($r);
}