コード例 #1
0
function adr_use_hp_amulet()
{
    global $bat, $challeneger, $hp_regen, $battle_message;
    // Check if user a Amulet for HP regen this turn
    if ($bat['battle_challenger_hp'] != 0) {
        if ($challenger['character_hp'] < $challenger['character_hp_max']) {
            $hp_regen = intval(adr_hp_regen_check($user_id, $bat['battle_challenger_hp']));
            $battle_message .= sprintf($lang['Adr_battle_regen_xp'], intval($hp_regen)) . '<br />';
        }
        //$challenger['character_hp'] < $challenger['character_hp_max']
    }
    //$bat['battle_challenger_hp'] != 0
}
コード例 #2
0
function adr_pet_special()
{
    global $monster, $bat, $adr_user, $opponent_element, $item, $db, $lang, $user_id, $power;
    global $challenger, $battle_message, $user_action, $monster_action, $attack_img, $attackwith_overlay;
    global $rabbit_user;
    if ($rabbit_user['creature_attack'] < 1 || $rabbit_user['creature_health'] < 1) {
        adr_previous('Adr_battle_pet_dead_or_limitattack', 'adr_battle', '');
    }
    $poison = '0';
    $pet_regen = '0';
    $mp_consumned = '0';
    $pet_damage = '0';
    $health_give = '0';
    $mana_give = '0';
    if ($rabbit_user['creature_ability'] == '0') {
        adr_previous(Adr_battle_pet_noability, 'adr_battle', '');
    }
    //$rabbit_user['creature_ability'] == '0'
    if ($rabbit_user['creature_ability'] == '1') {
        adr_previous(Adr_battle_pet_regeneration_mess, 'adr_battle', '');
    }
    //$rabbit_user['creature_ability'] == '1'
    if ($rabbit_user['creature_ability'] == '2') {
        $health_give = $rabbit_user['creature_health'] * $rabbit_general['health_transfert_percent'] / 100;
        $battle_message .= sprintf($lang['Rabbitoshi_Adr_battle_pet_health_transfert'], intval($health_give)) . '<br />';
    }
    //$rabbit_user['creature_ability'] == '2'
    if ($rabbit_user['creature_ability'] == '3') {
        $mana_give = $rabbit_user['creature_mp'] * $rabbit_general['mana_transfert_percent'] / 100;
        $battle_message .= sprintf($lang['Rabbitoshi_Adr_battle_pet_mana_transfert'], intval($mana_give)) . '<br />';
    }
    //$rabbit_user['creature_ability'] == '3'
    if ($rabbit_user['creature_ability'] == '4') {
        $pet_damage = $rabbit_user['creature_power'] * $rabbit_user['creature_level'] + $rabbit_user['creature_health'] * rand(1, 3);
        $battle_message .= sprintf($lang['Rabbitoshi_Adr_battle_pet_sacrifice'], intval($pet_damage)) . '<br />';
    }
    //$rabbit_user['creature_ability'] == '4'
    rabbit_pet_regen();
    // Check if pet is poisonned
    if ($rabbit_user['creature_statut'] == '3') {
        if ($rabbit_user['creature_health'] > 0) {
            $poison = rand(1, 3);
            if ($rabbit_user['creature_health'] - $poison < 0) {
                $poison = $rabbit_user['creature_health_max'] - $rabbit_user['creature_health'];
            }
            //($rabbit_user['creature_health'] - $poison) < 0
            $battle_message .= sprintf($lang['Adr_battle_pet_poison'], intval($poison)) . '<br />';
        }
        //$rabbit_user['creature_health'] > 0
    }
    //$rabbit_user['creature_statut'] == '3'
    // Check if user a Amulet for HP regen this turn
    if ($bat['battle_challenger_hp'] != 0) {
        if ($challenger['character_hp'] < $challenger['character_hp_max']) {
            $hp_regen = intval(adr_hp_regen_check($user_id, $bat['battle_challenger_hp']));
            $battle_message .= sprintf($lang['Adr_battle_regen_xp'], intval($hp_regen)) . '<br />';
        }
        //$challenger['character_hp'] < $challenger['character_hp_max']
    }
    //$bat['battle_challenger_hp'] != 0
    // Check if user a Ring for MP regen this turn
    if ($bat['battle_challenger_mp'] != 0) {
        if ($challenger['character_mp'] < $challenger['character_mp_max']) {
            $mp_regen = intval(adr_mp_regen_check($user_id, $bat['battle_challenger_mp']));
            $battle_message .= sprintf($lang['Adr_battle_regen_mp'], intval($mp_regen)) . '<br />';
        }
        //$challenger['character_mp'] < $challenger['character_mp_max']
    }
    //$bat['battle_challenger_mp'] != 0
    $hp_changes = $poison + $health_give - $pet_regen;
    $mp_changes = $mp_consumned + $mana_give;
    if ($hp_changes < 0) {
        $hp_changes = $rabbit_user['creature_health_max'] - $rabbit_user['creature_health'];
    }
    //$hp_changes < 0
    if ($mp_changes < 0) {
        $mp_changes = $rabbit_user['creature_max_mp'] - $rabbit_user['creature_mp'];
    }
    //$mp_changes < 0
    if ($rabbit_user['creature_ability'] == '4') {
        $hp_changes = $rabbit_user['creature_health_max'] - $rabbit_user['creature_health'];
    }
    //$rabbit_user['creature_ability'] == '4'
    $sql = "UPDATE " . RABBITOSHI_USERS_TABLE . "\n\t\tSET creature_health = creature_health - {$hp_changes},\n\t\t    creature_mp = creature_mp - {$mp_changes}\n\t\tWHERE owner_id = {$user_id} ";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not update pet info', '', __LINE__, __FILE__, $sql);
    }
    //!$result = $db->sql_query($sql)
    if ($challenger['character_hp'] + $health_give > $challenger['character_hp_max']) {
        $health_give = $challenger['character_hp_max'] - $challenger['character_hp'];
    }
    //($challenger['character_hp'] + $health_give) > $challenger['character_hp_max']
    if ($challenger['character_mp'] + $mana_give > $challenger['character_mp_max']) {
        $mana_give = $challenger['character_mp_max'] - $challenger['character_mp'];
    }
    //($challenger['character_mp'] + $mana_give) > $challenger['character_mp_max']
    $sql = " UPDATE  " . ADR_CHARACTERS_TABLE . "\n            \tSET character_hp = character_hp + {$health_give},\n            \t    character_mp = character_mp + {$mana_give}\n            \tWHERE character_id = {$user_id} ";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not update character', '', __LINE__, __FILE__, $sql);
    }
    //!($result = $db->sql_query($sql))
    // Update the database
    $sql = "UPDATE " . ADR_BATTLE_LIST_TABLE . "\n\t\tSET battle_opponent_hp = battle_opponent_hp - '{$pet_damage}',\n\t\t    battle_turn = 2 ,\n\t\t    battle_challenger_dmg = '{$pet_damage}'\n\t\tWHERE battle_challenger_id = {$user_id}\n\t\tAND battle_result = 0\n\t\tAND battle_type = 1 ";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not update battle', '', __LINE__, __FILE__, $sql);
    }
    //!($result = $db->sql_query($sql))
}
コード例 #3
0
ファイル: adr_battle.php プロジェクト: ZerGabriel/adr-rpg
                     $battle_message .= sprintf($lang['Adr_battle_defend'], $challenger['character_name'], $monster['monster_name']) . '<br>';
                     // Update the database
                     $sql = "UPDATE " . ADR_BATTLE_LIST_TABLE . "\n\t\t\tSET\tbattle_turn = 2,\n\t\t\t\tbattle_round = (battle_round + 1)\n\t\t\tWHERE battle_challenger_id = {$user_id}\n\t\t\tAND battle_result = 0\n\t\t\tAND battle_type = 1 ";
                     if (!($result = $db->sql_query($sql))) {
                         message_die(GENERAL_ERROR, 'Could not update battle', '', __LINE__, __FILE__, $sql);
                     }
                 }
             }
         }
     }
 }
 // Get the user infos
 $challenger = adr_get_user_infos($user_id);
 ##=== START: additional status checks on user ===##
 if ($bat['battle_turn'] == '1' && ($attack || $item_spell || $item_potion || $defend || $flee || $equip)) {
     $hp_regen = adr_hp_regen_check($user_id, $bat['battle_challenger_hp']);
     $challenger['character_hp'] += $hp_regen;
     $mp_regen = adr_mp_regen_check($user_id, $bat['battle_challenger_mp']);
     $battle_message .= '<span class="gensmall"><font color="#FF0000">';
     // prefix new span class
     if ($hp_regen > '0' && $mp_regen == '0' || $mp_regen > '0' && $hp_regen == '0') {
         if ($hp_regen > '0') {
             $battle_message .= '&nbsp;&nbsp;>&nbsp;' . sprintf($lang['Adr_battle_regen_xp'], $challenger['character_name'], intval($hp_regen)) . '<br />';
         } elseif ($mp_regen > '0') {
             $battle_message .= '&nbsp;&nbsp;>&nbsp;' . sprintf($lang['Adr_battle_regen_mp'], $challenger['character_name'], intval($mp_regen)) . '<br />';
         }
     } elseif ($hp_regen > '0' && $mp_regen > '0') {
         $battle_message .= '&nbsp;&nbsp;>&nbsp;' . sprintf($lang['Adr_battle_regen_both'], $challenger['character_name'], intval($hp_regen), intval($mp_regen)) . '<br />';
     }
     $battle_message .= '</font></span>';
     // reset span class to default