Generates land, ranging 3% - 6% of your total current land (but never above 12,000 acres), at a cost of 1% - 6% magic users, 1% - 8% grains, 1% - 5% gold, and 12 points of health (though you gain back 2 points for the taken turns). You cannot cast this spell until you have a total of at least 10,000 acres. - This is what the spell should do.
This is the code I use
Code:
function SpellEmminentDomain ()
{
global $users, $urace, $lratio, $config;
if ($lratio >= 3)
{
$trandland1 = ceil($users[freeland] * .06);
$trandland2 = $trandland1 + 1;
$trandland3 = ceil($trandland2);
$trandland4 = mt_rand(0, $trandland3);
$randland = ceil($trandland4);
if ($randland < ($users[land] * .03)) { $randland = ceil($users[land] * .03); }
if ($randland > ($users[land] * .06)) { $randland = ceil($users[land] * .06); }
$newland=$randland;
if ($newland > $config[edcap]) {$newland=$config[edcap];}
$mageloss= (100-($newland/250))/100;
if ($mageloss < .94) {$mageloss=.94;}
$foodloss= (100-($newland/150))/100;
if ($foodloss < .92) {$foodloss=.92;}
$cashloss= (100-($newland/750))/100;
if ($cashloss < .95) {$cashloss=.95;}
$land = $newland;
$users[land] = $users[land] + $land;
$users[freeland] = $users[freeland] + $land;
$users[health] -= 12;
$users[wizards]=round($users[wizards]*$mageloss);
$users[food]=round($users[food]*$foodloss);
$users[cash]=round($users[cash]*$cashloss);
$cashloss = ceil($cashloss);
$foodloss = ceil($foodloss);
$mageloss = ceil($mageloss);
$cashloss = commas($cashloss);
$foodloss = commas($foodloss);
$mageloss = commas($mageloss);
SpellSucceed($land." acres was made by your Wizards, however the magic that surrounded the area made you lose many wizards, cash and grain in the process!");
saveUserData($users,"health land freeland cash food wizards");
}
else SpellFail2();
taketurns(2,attack);
}
This is the result i get =lose of 10% of health which is ok,no mana,no cash,no grain lose ,no land increase .
EDIT : A friend of mine suggested me to do this :
Check the function "saveUserData" in you main functions include file. Try adding some
OR EXIT() statements to make sure various calls are not silentlly failing. Also,
var_dump() is very handy. Just be sure to wrap it in a
<pre></pre> html block for readability.
Still I don't know how to do this ..if you know I will add you ftp user to my site so you fix that ..