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


PHP Player::turns方法代码示例

本文整理汇总了PHP中Player::turns方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::turns方法的具体用法?PHP Player::turns怎么用?PHP Player::turns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player::turns方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testPCHasVariousAttributesAndCanSetSome

 public function testPCHasVariousAttributesAndCanSetSome()
 {
     $char = new Player($this->char_id);
     $this->assertTrue(is_int($char->gold()));
     $this->assertTrue(is_int($char->turns()));
     $this->assertTrue(is_int($char->set_gold(45)));
     $this->assertTrue(is_int($char->set_turns(32)));
     $this->assertEquals(444, $char->set_bounty(444));
     $char->save();
     $char_dup = new Player($this->char_id);
     $this->assertEquals(444, $char_dup->bounty());
     $this->assertEquals(32, $char_dup->turns());
     $this->assertEquals(45, $char_dup->gold());
 }
开发者ID:NinjaWars,项目名称:ninjawars,代码行数:14,代码来源:player_test.php

示例2: in

$private = true;
if ($error = init($private, $alive)) {
    display_error($error);
} else {
    $turn_cost = 1;
    $health = 1;
    $victim = in('victim');
    $random_encounter = rand(1, 400) == 1;
    $combat_data = array();
    $char_id = self_char_id();
    $player = new Player($char_id);
    $error_template = 'npc.no-one.tpl';
    // Error template also used down below.
    $npc_template = $error_template;
    // Error condition by default.
    $turns = $player->turns();
    $is_villager = false;
    $ninja_str = $player->getStrength();
    $ninja_health = $player->vo->health;
    $static_npcs = array('peasant', 'thief', 'merchant', 'guard', 'samurai');
    $npcs = NpcFactory::npcsData();
    $possible_npcs = array_merge($static_npcs, array_keys($npcs));
    $victim = restrict_to($victim, $possible_npcs);
    // Filter to only the correct options.
    if ($turns > 0 && !empty($victim)) {
        // Strip stealth when attacking samurai or oni
        if ($player->hasStatus('stealth') && (strtolower($victim) == 'samurai' || strtolower($victim) == 'oni')) {
            $player->subtractStatus(STEALTH);
        }
        $attacker_str = $player->getStrength();
        $attacker_health = $player->vo->health;
开发者ID:reillo,项目名称:ninjawars,代码行数:31,代码来源:npc.php

示例3: Skill

$private = true;
$alive = false;
if ($error = init($private, $alive)) {
    display_error($error);
} else {
    require_once LIB_ROOT . "control/lib_status.php";
    // statuses for quickstats
    require_once LIB_ROOT . "control/lib_player.php";
    // Player info display pieces.
    require_once LIB_ROOT . "control/Skill.php";
    $skillsListObj = new Skill();
    $player = new Player(self_char_id());
    $level = $player->level();
    $class = $player->class_display_name();
    // Just to be displayed in the template.
    $starting_turns = $player->turns();
    $starting_ki = $player->ki();
    $status_list = get_status_list();
    $no_skills = true;
    $stealth = $skillsListObj->hasSkill('Stealth');
    if ($stealth) {
        $no_skills = false;
    }
    $stealth_turn_cost = $skillsListObj->getTurnCost('Stealth');
    $unstealth_turn_cost = $skillsListObj->getTurnCost('Unstealth');
    $chi = $skillsListObj->hasSkill('Chi');
    $speed = $skillsListObj->hasSkill('speed');
    $hidden_resurrect = $skillsListObj->hasSkill('hidden resurrect');
    $midnight_heal = $skillsListObj->hasSkill('midnight heal');
    $kampo_turn_cost = $skillsListObj->getTurnCost('Kampo');
    $kampo = $skillsListObj->hasSkill('kampo');
开发者ID:reillo,项目名称:ninjawars,代码行数:31,代码来源:skills.php

示例4: in

 $classes = classes_info();
 $in_upgrade = in('upgrade');
 // Level up request.
 $dimmak_sequence = in('dimmak_sequence', '');
 $classChangeSequence = in('classChangeSequence');
 $current_class_untrusted = in('current_class');
 // Untrusted courtesy check to prevent doubled class change in the event of a refresh.
 $requested_identity = in('requested_identity');
 // Untrusted class identity request.
 if (is_logged_in()) {
     // Get the character data.
     $char_id = self_char_id();
     $char = $player = new Player($char_id);
     $userLevel = $player->vo->level;
     $userKills = $player->vo->kills;
     $user_turns = $player->turns();
     $userClass = $player->class_identity();
     $user_class_display = $player->class_display_name();
     $user_class_theme = class_theme($userClass);
     // Pull info for the class requested to change to.
     $destination_class_identity = isset($requested_identity) && isset($classes[$requested_identity]) ? $requested_identity : null;
     $destination_class_info = $destination_class_display = $destination_class_theme = null;
     if ($destination_class_identity) {
         $destination_class_info = $classes[$destination_class_identity];
         $destination_class_display = $destination_class_info['class_name'];
         $destination_class_theme = $destination_class_info['theme'];
     }
     // Pull the number of kills required to get to the next level.
     $required_kills = required_kills_to_level($player->level());
     $current_class_untrusted = whichever($current_class_untrusted, $userClass);
     // Initialize the class record to prevent double change on refresh.
开发者ID:reillo,项目名称:ninjawars,代码行数:31,代码来源:dojo.php

示例5: testCloneKillKillingWipesHealthAndTurns

 public function testCloneKillKillingWipesHealthAndTurns()
 {
     $char_id = TestAccountCreateAndDestroy::char_id();
     $charObj = new Player($char_id);
     $char_id_2 = TestAccountCreateAndDestroy::char_id_2();
     $charObj_2 = new Player($char_id_2);
     // Will create characters with 127.0.0.1 ip, but that shouldn't be clone kill able.
     $this->assertFalse(CloneKill::canKill($char_id, $char_id_2));
     $this->syncIps('222.244.244.222', $char_id, $char_id_2);
     $this->assertTrue(CloneKill::canKill($char_id, $char_id_2), 'Should be able to clone kill similar and same ip characters!');
     CloneKill::kill($charObj, $charObj, $charObj_2);
     // Obliterate them.
     $pc1 = new Player($char_id);
     $pc2 = new Player($char_id_2);
     $this->assertEquals(0, $pc1->health());
     $this->assertEquals(0, $pc2->health());
     $this->assertEquals(0, $pc1->turns());
     $this->assertEquals(0, $pc2->turns());
 }
开发者ID:reillo,项目名称:ninjawars,代码行数:19,代码来源:skill_test.php


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