Ejemplo n.º 1
0
         $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()) {
Ejemplo n.º 2
0
    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).
Ejemplo n.º 3
0
$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 ***
Ejemplo n.º 4
0
 $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')) {
Ejemplo n.º 5
0
$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)) {