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


PHP Shadowrun4::getDummyPlayer方法代码示例

本文整理汇总了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');
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:SR_City.php

示例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);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:77,代码来源:SR_Spell.php

示例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;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:19,代码来源:SR_Install.php

示例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));
         }
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:SR_Subway.php

示例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();
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:12,代码来源:SR_Store.php

示例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;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:16,代码来源:SR_Location.php


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