Dragon-Scourge/fightmods.php
Jamin Blount d529178672 Beta 4 Build 17
8.09.2006 - Build 17 (Haiku):
- Moved stylesheets into .css files.
- Added javascript tooltips for the class info when creating a new
character.
- Changed doquery() format - rewrote all calls to this function to match
the new format.
- Various changes to the structure of lib.php.
- Implemented Anman's increased attack and defense spells (Blessed
Strike & Stone Skin).
- Fixed class display in profile view.
- Began admin control panel.
- Various little bitty fixes.
- You can no longer gamble 0 gold.
- Added new level stat type: life.
- Monsters can now do excellent hits, and you can now dodge monsters.
- Removed several columns from controlrow that are no longer used.
2017-02-05 11:57:55 -06:00

148 lines
5.1 KiB
PHP

<?php // fightmods.php :: functions for modifiers granted to you by items.
function hpleech($player) {
/***********
Description: A percentage of the final damage is given back to the player's HP.
Occurs: Per Turn.
Applies To: Player or Monster.
***********/
global $userrow, $fightrow, $monsterrow;
if ($player == "player") {
$userrow["currenthp"] += floor(($fightrow["playerphysdamage"]+$fightrow["playermagicdamage"]+$fightrow["playerfiredamage"]+$fightrow["playerlightdamage"]) * ($userrow["hpleech"]/100));
if ($userrow["currenthp"] > $userrow["maxhp"]) { $userrow["currenthp"] = $userrow["maxhp"]; }
} else {
$userrow["currentmonsterhp"] += floor(($fightrow["monsterphysdamage"]+$fightrow["monstermagicdamage"]+$fightrow["monsterfiredamage"]+$fightrow["monsterlightdamage"]) * ($monsterrow["hpleech"]/100));
if ($userrow["currentmonsterhp"] > $monsterrow["maxhp"]) { $userrow["currentmonsterhp"] = $monsterrow["maxhp"]; }
}
}
function mpleech() {
/***********
Description: A percentage of the final damage is given back to the player's MP.
Occurs: Per Turn.
Applies To: Player only.
***********/
global $userrow, $fightrow;
$userrow["currentmp"] += floor(($fightrow["playerphysdamage"]+$fightrow["playermagicdamage"]+$fightrow["playerfiredamage"]+$fightrow["playerlightdamage"]) * ($userrow["mpleech"]/100));
if ($userrow["currentmp"] > $userrow["maxmp"]) { $userrow["currentmp"] = $userrow["maxmp"]; }
}
function hpgain() {
/***********
Description: A fixed number is added to player's HP.
Occurs: Per Kill.
Applies To: Player only.
***********/
global $userrow, $fightrow;
$userrow["currenthp"] += $userrow["hpgain"];
if ($userrow["currenthp"] > $userrow["maxhp"]) { $userrow["currenthp"] = $userrow["maxhp"]; }
}
function mpgain() {
/***********
Description: A fixed number is added to player's MP.
Occurs: Per Kill.
Applies To: Player only.
***********/
global $userrow, $fightrow;
$userrow["currentmp"] += $userrow["mpgain"];
if ($userrow["currentmp"] > $userrow["maxmp"]) { $userrow["currentmp"] = $userrow["maxmp"]; }
}
function bonusattack() {
/***********
Description: Chance to deal extra damage.
Occurs: Per Turn.
Applies To: Player only.
Written By: Anman.
***********/
global $userrow, $fightrow;
$first = $userrow["bonusattack"] * 0.25;
$sec = $userrow["bonusattack"] * 0.5;
$third = $userrow["bonusattack"] * 0.75;
$rand = rand(0,100);
if ($rand <= $first) { $multiplier = 2; }
elseif ($rand <= $sec) { $multiplier = 1.75; }
elseif ($rand <= $third) { $multiplier = 1.5; }
elseif ($rand <= $userrow["bonusattack"] && $rand > $third) { $multiplier = 1.25; }
else { $multiplier = 1; }
$fightrow["playerphysdamage"] = floor($fightrow["playerphysdamage"] * $multiplier);
}
function bonusdefense() {
/***********
Description: Chance to reduce incurred damage.
Occurs: Per Turn.
Applies To: Player only.
Written By: Anman.
***********/
global $userrow, $fightrow;
$first = $userrow["bonusdefense"] * 0.25;
$sec = $userrow["bonusdefense"] * 0.5;
$third = $userrow["bonusdefense"] * 0.75;
$rand = rand(0,100);
if ($rand <= $first) { $multiplier = 0; }
elseif ($rand <= $sec) { $multiplier = 0.25; }
elseif ($rand <= $third) { $multiplier = 0.5; }
elseif ($rand <= $userrow["bonusdefense"] && $rand > $third) { $multiplier = 0.75; }
else { $multiplier = 1; }
$fightrow["monsterphysdamage"] = floor($fightrow["monsterphysdamage"] * $multiplier);
$fightrow["monstermagicdamage"] = floor($fightrow["monstermagicdamage"] * $multiplier);
$fightrow["monsterfiredamage"] = floor($fightrow["monsterfiredamage"] * $multiplier);
$fightrow["monsterlightdamage"] = floor($fightrow["monsterlightdamage"] * $multiplier);
}
function bonusdefense_pvp() {
/***********
Description: Chance to reduce incurred damage - PVP version.
Occurs: Per Turn.
Applies To: Player only.
Written By: Anman.
***********/
global $userrow, $monsterrow, $fightrow;
$first = $monsterrow["bonusdefense"] * 0.25;
$sec = $monsterrow["bonusdefense"] * 0.5;
$third = $monsterrow["bonusdefense"] * 0.75;
$rand = rand(0,100);
if ($rand <= $first) { $multiplier = 0; }
elseif ($rand <= $sec) { $multiplier = 0.25; }
elseif ($rand <= $third) { $multiplier = 0.5; }
elseif ($rand <= $monsterrow["bonusdefense"] && $rand > $third) { $multiplier = 0.75; }
else { $multiplier = 1; }
$fightrow["playerphysdamage"] = floor($fightrow["playerphysdamage"] * $multiplier);
$fightrow["playermagicdamage"] = floor($fightrow["playermagicdamage"] * $multiplier);
$fightrow["playerfiredamage"] = floor($fightrow["playerfiredamage"] * $multiplier);
$fightrow["playerlightdamage"] = floor($fightrow["playerlightdamage"] * $multiplier);
}
?>