Esempio n. 1
0
//Si le joueur est dans une ville, on regarde si il est actuellement en combat
if (verif_battle()) {
    if (request_confirm('End_Magics')) {
        if (user_data('Account_MP_Remaining') >= $Magic_MP_Cost) {
            $Magic_Choice = request_post('Magic');
            $Magic_MP_Cost = request_post('Magic_MP_Cost');
            $Magic = get_db("edit_admin", array('table' => 'Caranille_Magics', 'ID' => 'Magic_Name', 'value' => $Magic_Choice));
            extract($Magic);
            $MIN_Magic = user_data('Level_Magic') / $bonus_malus_battle;
            $MAX_Magic = user_data('Level_Magic') * $bonus_malus_battle;
            $Remaining_MP = user_data('Account_MP_Remaining') - htmlspecialchars(addslashes($Magic_MP_Cost));
            user_set('Account_MP_Remaining', $Remaining_MP);
            user_record();
            if ($Magic_Type == "Attack") {
                $Negative_Magic_Damage_Player = getMonsterDefense();
                //mt_rand($Monster_MIN_Defense, $Monster_MAX_Defense);
                $Positive_Magic_Damage_Player = mt_rand($MIN_Magic, $MAX_Magic) + $Magic_Effect;
                $Player_Total_Magic_Damage = htmlspecialchars(addslashes($Positive_Magic_Damage_Player)) - htmlspecialchars(addslashes($Negative_Magic_Damage_Player));
                if ($Player_Total_Magic_Damage <= 0) {
                    $Player_Total_Magic_Damage = 0;
                }
                $_SESSION['Monster_HP'] = monster_data('HP') - htmlspecialchars(addslashes($Player_Total_Magic_Damage));
                $message = "{$Magic_Choice} a infligé {$Player_Total_Magic_Damage} HP de dégat au " . monster_data('Name') . "<br /><br />";
                add_diary($message);
            } elseif ($Magic_Type == "Health") {
                //non utilisé ???
                //$Monster_MIN_Defense = htmlspecialchars(addslashes($_SESSION['Monster_Defense'])) / $bonus_malus_battle;
                //$Monster_MAX_Defense = htmlspecialchars(addslashes($_SESSION['Monster_Defense'])) * $bonus_malus_battle;
                $Player_Health = mt_rand($MIN_Magic, $MAX_Magic) + $Magic_Effect;
                $Life_Difference = perso_data('HP_Total') - htmlspecialchars(addslashes($_SESSION['HP']));
Esempio n. 2
0
/** return les degats causé par le joueur dans un tour **/
function getPlayerDamage()
{
    if (request_confirm('Attack')) {
        $MIN_Strength = perso_data('Strength_Total') / $bonus_malus_battle;
        $MAX_Strength = perso_data('Strength_Total') * $bonus_malus_battle;
        $Positive_Damage_Player = mt_rand($MIN_Strength, $MAX_Strength);
        $Negative_Damage_Player = getMonsterDefense();
        //mt_rand($Monster_MIN_Defense, $Monster_MAX_Defense);
        $Total_Damage_Player = htmlspecialchars(addslashes($Positive_Damage_Player)) - htmlspecialchars(addslashes($Negative_Damage_Player));
        //Si les dégats du joueurs ou du monstre sont égal ou inférieur à zero
        if ($Total_Damage_Player <= 0) {
            $Total_Damage_Player = 0;
        }
        $_SESSION['Monster_HP'] = monster_data('HP') - htmlspecialchars(addslashes($Total_Damage_Player));
    }
    if (request_confirm('End_Invocations')) {
        $Invocation_Choice = htmlspecialchars(addslashes($_POST['Invocation']));
        $MP_Choice = htmlspecialchars(addslashes($_POST['MP_Choice']));
        if ($_SESSION['MP'] >= $MP_Choice) {
            $Invocation = get_db("edit_admin", array('table' => 'Caranille_Invocations', 'ID' => 'Invocation_Name', 'value' => $Invocation_Choice));
            $Invocation_Damage = $Invocation['Invocation_Damage'];
            // non utilisé ???
            //$Monster_MIN_Defense = htmlspecialchars(addslashes($_SESSION['Monster_Defense'])) / $bonus_malus_battle;
            //$Monster_MAX_Defense = htmlspecialchars(addslashes($_SESSION['Monster_Defense'])) * $bonus_malus_battle;
            $Invocation_Total_Damage = htmlspecialchars(addslashes($Invocation_Damage)) * htmlspecialchars(addslashes($MP_Choice));
            $_SESSION['Monster_HP'] = monster_data('HP') - htmlspecialchars(addslashes($Invocation_Total_Damage));
        } else {
            $message = 'Vous n\'avez pas assez de MP';
        }
    }
}