コード例 #1
0
ファイル: skills_mod.php プロジェクト: NinjaWars/ninjawars
$alive = true;
if ($error = init($private, $alive)) {
    display_error($error);
    die;
}
// Template vars.
$display_sight_table = $generic_skill_result_message = $generic_state_change = $killed_target = $loot = $added_bounty = $bounty = $suicided = $destealthed = null;
//Get filtered info from input.
$target = in('target');
$command = in('command');
$stealth = in('stealth');
$skillListObj = new Skill();
$poisonMaximum = 100;
// *** Before level-based addition.
$poisonMinimum = 1;
$poisonTurnCost = $skillListObj->getTurnCost('poison touch');
// wut
$turn_cost = $skillListObj->getTurnCost(strtolower($command));
$ignores_stealth = $skillListObj->getIgnoreStealth($command);
$self_use = $skillListObj->getSelfUse($command);
$use_on_target = $skillListObj->getUsableOnTarget($command);
$ki_cost = 0;
// Ki taken during use.
$reuse = true;
// Able to reuse the skill.
$today = date("F j, Y, g:i a");
// Check whether the user actually has the needed skill.
$has_skill = $skillListObj->hasSkill($command);
$starting_turn_cost = $turn_cost;
assert($turn_cost >= 0);
$turns_to_take = null;
コード例 #2
0
ファイル: attack_mod.php プロジェクト: ninjajerry/ninjawars
// *** Not simultaneous by default. ***
$stealthAttackDamage = $attacker_str;
$turns_to_take = null;
// *** Even on failure take at least one turn. ***
$attack_type = 'attack';
// *** Default attack category type is single attack. ***
if ($blaze) {
    $attack_type = 'blaze';
} elseif ($deflect) {
    $attack_type = 'deflect';
} elseif ($duel) {
    $attack_type = 'duel';
}
$skillListObj = new Skill();
$ignores_stealth = $skillListObj->getIgnoreStealth($attack_type);
$required_turns = $skillListObj->getTurnCost($attack_type);
// *** Attack Legal section ***
$attacker = $username;
$params = array('required_turns' => $required_turns, 'ignores_stealth' => $ignores_stealth);
assert($attacker != $target);
$AttackLegal = new AttackLegal($attacker, $target, $params);
// *** There's a same-domain problem with this attack-legal now that it's been modified for skills ***
// ***  MAIN BATTLE ALGORITHM  ***
if (!$AttackLegal->check()) {
    // *** Display the reason the attack failed.
    echo "<div class='ninja-error centered'>" . $AttackLegal->getError() . "</div>";
} else {
    // *** ATTACKING + STEALTHED SECTION  ***
    if (!$duel && $attacker_status['Stealth']) {
        //Not dueling, and attacking from stealth
        subtractStatus($username, STEALTH);
コード例 #3
0
ファイル: skills.php プロジェクト: reillo/ninjawars
    // 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');
    $heal = $skillsListObj->hasSkill('heal');
    $heal_turn_cost = $skillsListObj->getTurnCost('heal');
    $clone_kill = $skillsListObj->hasSkill('clone kill');
    $clone_kill_turn_cost = $skillsListObj->getTurnCost('clone kill');
    $wrath = $skillsListObj->hasSkill('wrath');
    $can_harmonize = $starting_ki;
    display_page('skills.tpl', 'Your Skills', get_certain_vars(get_defined_vars(), array('status_list')), array('quickstat' => 'player'));
}
コード例 #4
0
ファイル: attack_mod.php プロジェクト: NinjaWars/ninjawars
if ($evade) {
    $attack_type['evade'] = 'evade';
}
if ($duel) {
    $attack_type['duel'] = 'duel';
} else {
    $attack_type['attack'] = 'attack';
}
$target_player = new Player($target);
$attacking_player = new Player(self_char_id());
$attacker = $attacking_player->name();
$skillListObj = new Skill();
$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;
コード例 #5
0
/**
 * Smarty plugin to determine turn cost of a skill
 *
 * @param Array $p_params Dictionary provided by Smarty
 * @return String
 */
function smarty_function_getTurnCost($p_params)
{
    $skillListObj = new Skill();
    return $skillListObj->getTurnCost($p_params['skillName']);
}
コード例 #6
0
ファイル: skills.php プロジェクト: ninjajerry/ninjawars
$class = getClass($username);
$status_array = getStatus($username);
$row = $sql->data;
echo "<p>You are a level {$level}, {$class} Ninja.</p>\n";
$status_output_list = render_status_section();
echo "<p>Your status is: " . $status_output_list . "</p>";
echo "<div id='skills-list'>";
$no_skills = true;
if ($skillsListObj->hasSkill('Stealth')) {
    echo "<div id='stealth-skills'>";
    echo "<p>By selecting Stealth you will go into a mode where enemies can not directly attack you for a short time.";
    echo "<a href=\"about.php#skills\">(help)</a></p><p>";
    echo "<form action=\"skills_mod.php\" method=\"post\">\n";
    echo "<div>\n";
    echo "<input type=\"submit\" name=\"command\" value=\"Stealth\" class=\"formButton\">\n";
    echo "</select> Turn Cost: " . $skillsListObj->getTurnCost('Stealth') . " to Stealth.\n";
    echo "</div>\n";
    echo "</form></p><p>";
    echo "<form action=\"skills_mod.php\" method=\"post\">\n";
    echo "<div>\n";
    echo "<input type=\"submit\" name=\"command\" value=\"Unstealth\" class=\"formButton\">\n";
    echo "Turn Cost: " . $skillsListObj->getTurnCost('Unstealth') . " to Unstealth.\n ";
    echo "</div>\n";
    echo "</form></p>";
    echo "</div>";
    $no_skills = false;
}
if ($skillsListObj->hasSkill('Chi')) {
    echo "<p id='chi-skill'>Your Chi skill increases the benefits of healing at the shrine.</p>";
}
if ($skillsListObj->hasSkill('speed')) {
コード例 #7
0
ファイル: player.php プロジェクト: reillo/ninjawars
 function getTurnCost($p_params, &$tpl)
 {
     $skillListObj = new Skill();
     return $skillListObj->getTurnCost($p_params['skillName']);
 }