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


PHP Player::getStrength方法代码示例

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


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

示例1: rand

         $generic_skill_result_message = 'You do not have the necessary ginsengroots or energy to create any Kampo formulas.';
     }
 } else {
     if ($command == 'Poison Touch') {
         $covert = true;
         $target->addStatus(POISON);
         $target->addStatus(WEAKENED);
         // Weakness kills strength.
         $target_damage = rand($poisonMinimum, $poisonMaximum);
         $victim_alive = $target->subtractHealth($target_damage);
         $generic_state_change = "__TARGET__ has been poisoned!";
         $generic_skill_result_message = "__TARGET__ has taken {$target_damage} damage!";
         $msg = "You have been poisoned by {$attacker_id}";
         send_event($attacker_char_id, $target->id(), $msg);
     } elseif ($command == 'Fire Bolt') {
         $target_damage = 5 * ceil($player->level() / 3) + rand(1, $player->getStrength());
         $generic_skill_result_message = "__TARGET__ has taken {$target_damage} damage!";
         $victim_alive = $target->harm($target_damage);
         $msg = "You have had fire bolt cast on you by " . $player->name();
         send_event($player->id(), $target->id(), $msg);
     } else {
         if ($command == 'Heal' || $command == 'Harmonize') {
             // This is the starting template for self-use commands, eventually it'll be all refactored.
             $harmonize = false;
             if ($command == 'Harmonize') {
                 $harmonize = true;
             }
             $hurt = $target->is_hurt_by();
             // Check how much the TARGET is hurt (not the originator, necessarily).
             // Check that the target is not already status healing.
             if ($target->hasStatus(HEALING) && !$player->isAdmin()) {
开发者ID:NinjaWars,项目名称:ninjawars,代码行数:31,代码来源:skills_mod.php

示例2: in

    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;
        $attacker_gold = $player->vo->gold;
        // Perform a random encounter (currently only oni).
开发者ID:reillo,项目名称:ninjawars,代码行数:31,代码来源:npc.php

示例3: array

$ignores_stealth = false;
foreach ($attack_type as $type) {
    $ignores_stealth = $ignores_stealth || $skillListObj->getIgnoreStealth($type);
    $required_turns += $skillListObj->getTurnCost($type);
}
// *** Attack Legal section ***
$params = array('required_turns' => $required_turns, 'ignores_stealth' => $ignores_stealth);
$attack_legal = new AttackLegal($attacking_player, $target_player, $params);
$attack_is_legal = $attack_legal->check();
$attack_error = $attack_legal->getError();
// ***  MAIN BATTLE ALGORITHM  ***
if ($attack_is_legal) {
    // *** Target's stats. ***
    $target_health = $target_player->health;
    $target_level = $target_player->level;
    $target_str = $target_player->getStrength();
    // *** Attacker's stats. ***
    $attacker_health = $attacking_player->health;
    $attacker_level = $attacking_player->level;
    $attacker_turns = $attacking_player->turns;
    $attacker_str = $attacking_player->getStrength();
    $starting_target_health = $target_health;
    $starting_turns = $attacker_turns;
    $stealthAttackDamage = $attacker_str;
    $level_check = $attacker_level - $target_level;
    $loot = 0;
    $victor = null;
    $loser = null;
    // *** ATTACKING + STEALTHED SECTION  ***
    if (!$duel && $attacking_player->hasStatus(STEALTH)) {
        // *** Not dueling, and attacking from stealth ***
开发者ID:NinjaWars,项目名称:ninjawars,代码行数:31,代码来源:attack_mod.php

示例4: nearLevelPowerIncrease

 $near_level_power_increase = nearLevelPowerIncrease($level_difference, $max_power_increase);
 // Sets the page to link back to.
 if ($target_id && ($link_back == "" || $link_back == 'player') && $target_id != $user_id) {
     $return_to = 'player';
 } else {
     $return_to = 'inventory';
 }
 // Exceptions to the rules, using effects.
 if ($item->hasEffect('wound')) {
     // Minor damage by default items.
     $item->setTargetDamage(rand(1, $item->getMaxDamage()));
     // DEFAULT, overwritable.
     // e.g. Shuriken slices, for some reason.
     if ($item->hasEffect('slice')) {
         // Minor slicing damage.
         $item->setTargetDamage(rand(1, max(9, $player->getStrength() - 4)) + $near_level_power_increase);
     }
     // Piercing weapon, and actually does any static damage.
     if ($item->hasEffect('pierce')) {
         // Minor static piercing damage, e.g. 1-50 plus the near level power increase.
         $item->setTargetDamage(rand(1, $item->getMaxDamage()) + $near_level_power_increase);
     }
     // Increased damage from damaging effects, minimum of 20.
     if ($item->hasEffect('fire')) {
         // Major fire damage
         $item->setTargetDamage(rand(20, $player->getStrength() + 20) + $near_level_power_increase);
     }
 }
 // end of wounds section.
 // Exclusive speed/slow turn changes.
 if ($item->hasEffect('slow')) {
开发者ID:reillo,项目名称:ninjawars,代码行数:31,代码来源:inventory_mod.php

示例5: Player

$attack_is_legal = $AttackLegal->check();
$attack_error = $AttackLegal->getError();
// *** There's a same-domain problem with this attack-legal now that it's been modified for skills ***
$target_player = new Player($target_id);
$attacking_player = new Player($attacker_id);
// ***  MAIN BATTLE ALGORITHM  ***
if ($attack_is_legal) {
    // *** Target's stats. ***
    $target_health = $target_player->vo->health;
    $target_level = $target_player->vo->level;
    $target_str = $target_player->getStrength();
    // *** Attacker's stats. ***
    $attacker_health = $attacking_player->vo->health;
    $attacker_level = $attacking_player->vo->level;
    $attacker_turns = $attacking_player->vo->turns;
    $attacker_str = $attacking_player->getStrength();
    $class = $attacking_player->vo->class;
    $starting_target_health = $target_health;
    $starting_turns = $attacker_turns;
    $stealthAttackDamage = $attacker_str;
    $level_check = $attacker_level - $target_level;
    $loot = 0;
    $victor = null;
    $loser = null;
    // *** ATTACKING + STEALTHED SECTION  ***
    if (!$duel && $attacking_player->hasStatus(STEALTH)) {
        // *** Not dueling, and attacking from stealth ***
        $attacking_player->subtractStatus(STEALTH);
        $turns_to_take = 1;
        $stealthed_attack = true;
        if (!subtractHealth($target_id, $stealthAttackDamage)) {
开发者ID:reillo,项目名称:ninjawars,代码行数:31,代码来源:attack_mod.php


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