Dragon-Scourge/spells.php
Jamin Blount e1b9948505 Beta 2 Build 12
12.10.2005 - Build 12 (Eggs):
- Members can now leave the Guild without requiring an officer to demote
them to zero.
- Rank 5 members can now edit/update Guild settings.
- # of Members is now set to 1 when a Guild is created, and updated
correctly when an application is approved.
- The Guild founder is now notified via the Post Office when someone
applies to join.
- Members can now arbitrarily deposit money to the Guild bank.
- You can no longer send guild money to yourself. Checks and balances,
man!
- Fixed image format selection so that it actually works.
- Removed Language selection from account registration/settings.
2017-02-05 11:51:02 -06:00

97 lines
3.8 KiB
PHP

<?php // spells.php :: functions for spells.
function heal($id) {
global $userrow, $spells;
$failed = 0;
if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "<span class=\"red\"><b>Spell Failed:</b> You do not have enough MP to cast that spell.</span><br />"; $failed = 1; }
if ($failed == 0) {
$userrow["currenthp"] += $spells[$id]["value"];
$userrow["currentmp"] -= $spells[$id]["mp"];
if ($userrow["currenthp"] > $userrow["maxhp"]) { $userrow["currenthp"] = $userrow["maxhp"]; }
$return = $userrow["charname"] . " casts " . $spells[$id]["name"] . " and gains " . $spells[$id]["value"] . " HP.<br />";
}
return($return);
}
function hurt($id) {
global $userrow, $monsterrow, $fightrow, $spells;
$failed = 0;
if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "<span class=\"red\"><b>Spell Failed:</b> You do not have enough MP to cast that spell.</span><br />"; $failed = 1; }
if ($failed == 0) {
$userrow["currentmp"] -= $spells[$id]["mp"];
$magichit = ceil(rand($spells[$id]["value"]*.75, $spells[$id]["value"]));
$magicblock = ceil(rand($monsterrow["magicdefense"]*.75, $monsterrow["magicdefense"]) / 5);
$fightrow["playermagicdamage"] = max($magichit - $magicblock, 0);
$return = $userrow["charname"] . " casts " . $spells[$id]["name"] . " for " . $fightrow["playermagicdamage"] . " damage.<br />";
}
return($return);
}
function fire($id) {
global $userrow, $monsterrow, $fightrow, $spells;
$failed = 0;
if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "<span class=\"red\"><b>Spell Failed:</b> You do not have enough MP to cast that spell.</span><br />"; $failed = 1; }
if ($failed == 0) {
$userrow["currentmp"] -= $spells[$id]["mp"];
$magichit = ceil(rand($spells[$id]["value"]*.75, $spells[$id]["value"]));
$magicblock = ceil(rand($monsterrow["firedefense"]*.75, $monsterrow["firedefense"]) / 5);
$fightrow["playerfiredamage"] = max($magichit - $magicblock, 0);
$return = $userrow["charname"] . " casts " . $spells[$id]["name"] . " for " . $fightrow["playerfiredamage"] . " damage.<br />";
}
return($return);
}
function light($id) {
global $userrow, $monsterrow, $fightrow, $spells;
$failed = 0;
if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "<span class=\"red\"><b>Spell Failed:</b> You do not have enough MP to cast that spell.</span><br />"; $failed = 1; }
if ($failed == 0) {
$userrow["currentmp"] -= $spells[$id]["mp"];
$magichit = ceil(rand($spells[$id]["value"]*.75, $spells[$id]["value"]));
$magicblock = ceil(rand($monsterrow["lightdefense"]*.75, $monsterrow["lightdefense"]) / 5);
$fightrow["playerlightdamage"] = max($magichit - $magicblock, 0);
$return = $userrow["charname"] . " casts " . $spells[$id]["name"] . " for " . $fightrow["playerlightdamage"] . " damage.<br />";
}
return($return);
}
function prism($id) {
global $userrow, $monsterrow, $fightrow, $spells;
$failed = 0;
if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "<span class=\"red\"><b>Spell Failed:</b> You do not have enough MP to cast that spell.</span><br />"; $failed = 1; }
if ($failed == 0) {
$userrow["currentmp"] -= $spells[$id]["mp"];
$magichit = ceil(rand($spells[$id]["value"]*.75, $spells[$id]["value"]));
$magicblock = ceil(rand($monsterrow["lightdefense"]*.75, $monsterrow["lightdefense"]) / 5);
$fightrow["playerlightdamage"] = max($magichit - $magicblock, 0);
$return = $userrow["charname"] . " casts " . $spells[$id]["name"] . " for " . $fightrow["playerlightdamage"] . " damage.<br />";
}
return($return);
}
?>