本文整理汇总了PHP中Shadowrun4::getDummyPlayer方法的典型用法代码示例。如果您正苦于以下问题:PHP Shadowrun4::getDummyPlayer方法的具体用法?PHP Shadowrun4::getDummyPlayer怎么用?PHP Shadowrun4::getDummyPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shadowrun4
的用法示例。
在下文中一共展示了Shadowrun4::getDummyPlayer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkNPCLang
private function checkNPCLang(SR_NPC $npc)
{
if ($npc instanceof SR_TalkingNPC) {
$npc->setChatPartner(Shadowrun4::getDummyPlayer());
$npc->langNPC('default');
}
}
示例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: createItemDataFile
private static function createItemDataFile()
{
$out = '<?php' . "\n\$lang = array(\n";
$player = Shadowrun4::getDummyPlayer();
$data = array();
foreach (SR_Item::getAllItems() as $item) {
$item instanceof SR_Item;
$data[(int) $item->getItemUUID()] = $player->lang($item->displayPacked($player));
}
ksort($data);
foreach ($data as $uuid => $type) {
$out .= sprintf("'%d'=>'%s',\n", $uuid, $type);
}
$out .= ");\n?>\n";
$outfile = Shadowrun4::getShadowDir() . 'data/itemdata/itemdata_en.php';
@mkdir(dirname($outfile), 0700, true);
file_put_contents($outfile, $out);
return true;
}
示例4: checkLocation
public function checkLocation()
{
foreach ($this->getSubwayTargets(Shadowrun4::getDummyPlayer()) as $data) {
$target = $data[0];
if (false === ($location = Shadowrun4::getLocationByTarget($target))) {
die(sprintf('The subway %s has an invalid target: %s.', $this->getName(), $target));
}
}
}
示例5: checkLocation
public function checkLocation()
{
$player = Shadowrun4::getDummyPlayer();
$items = $this->getStoreItems($player);
foreach ($items as $data) {
$iname = $data[0];
if (false === SR_Item::createByName($iname, 1, false)) {
die(sprintf('%s has an invalid item: %s.', $this->getName(), $iname));
}
}
return parent::checkLocation();
}
示例6: checkLocationNPCs
/**
* Validate if all NPC exist.
*/
private function checkLocationNPCs()
{
# Dummy player
$player = Shadowrun4::getDummyPlayer();
# Validate talking NPCs
foreach ($this->getNPCS($player) as $tt => $classname) {
if (false === ($npc = Shadowrun4::getNPC($classname))) {
die(sprintf('Location %s is missing talking NPC %s.', $this->getName(), $classname));
return false;
}
}
return true;
}