View Source: /source/healer.php

Click here for the source, OR
Other files that you may wish to view the source of:

Source of: /source/healer.php

<?
require_once "common.php";
page_header("Healer's Hut");
output("`#`b`cHealer's Hut`c`b`n");
$loglev log($session[user][level]);
$cost = ($loglev * ($session[user][maxhitpoints]-$session[user][hitpoints])) + ($loglev*10);
$cost round($cost,0);
if (
$HTTP_GET_VARS[op]==""){
  
checkday();
    
output("`3You duck in to the small smoke filled grass hut.  The pungent aroma ");
    
output("makes you cough, attracting the attention of a grizzled old person ");
    
output("that does a remarkable job of reminding you of a rock, which probably ");
    
output("explains why you didn't notice them until now.  Couldn't be your failure ");
    
output("as a warrior.  Nope, definitely not.`n`n");
    if (
$session[user][hitpoints] < $session[user][maxhitpoints]){
        
output("\"`6See you, I do.  Before you did see me, I think, hmm?`3\" the old ");
        
output("thing remarks.  \"`6Know you, I do; healing you seek.  Willing to heal ");
        
output("am I, but only if willing to pay are you.`3\"`n`n\"`5Uh, um.  How much?`3\" ");
        
output("you ask, ready to be rid of the smelly old thing.`n`n");
        
output("The old being thumps your ribs with a gnarly staff.  \"`6For you... `$`b");
        
output$cost );
        
output("`b`6 gold pieces for a complete heal!!`3\" it says as it bends over and pulls a clay vial from behind");
        
output(" a pile of skulls sitting in the corner.  The view of the thing bending over to remove ");
        
output("the vial almost does enough mental damage to require a larger potion.");
        
output("  \"`6I also have some, erm... 'bargain' potions available,`3\" it says as it gestures at ");
        
output("a pile of dusty, cracked vials.  \"`6They'll heal a certain percent of your `idamage`i.`3\"");
        
addnav("Potions");
        
addnav("`^Complete Healing`0","healer.php?op=buy&pct=100");
        for (
$i=90;$i>0;$i-=10){
            
addnav("$i% - ".round($cost*$i/100,0)."gp","healer.php?op=buy&pct=$i");
        }
    }else if(
$session[user][hitpoints] == $session[user][maxhitpoints]){
        
output("`3The old creature grunts as it looks your way. \"`6Need a potion, you do not.  ");
        
output("Wonder why you bother me, I do.`3\" says the hideous thing.  The aroma of its ");
        
output("breath makes you wish you hadn't come in here in the first place.  You think ");
        
output("you had best leave.");
    }else{
        
output("`3The old creature glances at you, then in a `^whirlwind of movement`3 that catches ");
        
output(" you completely off guard, brings its gnarled staff squarely in contact with the back ");
        
output("of your head.  You gasp as you collapse to the ground.");
        
output("`n`nSlowly you open your eyes and realize the beast is emptying the last drops of a ");
        
output("clay vial down your throat.`n`n\"`6No charge for that potion.`3\" is all it has to say.  ");
        
output("You feel a strong urge to leave as quickly as you can.");
        
$session[user][hitpoints] = $session[user][maxhitpoints];
    }
}else{
    
$cost=round($HTTP_GET_VARS[pct]*$cost/100,0);
    if (
$session[user][gold]>=$cost){
        
$session[user][gold]-=$cost;
        
$diff round(($session[user][maxhitpoints]-$session[user][hitpoints])*$HTTP_GET_VARS[pct]/100,0);
        
$session[user][hitpoints] += $diff;
        
output("`3With a grimace, you up-end the potion the creature hands you, and despite the foul ");
        
output("flavor, you feel a warmth spreading through your veins as your muscles knit back together. ");
        
output("Staggering some, you hand it your gold and are ready to be out of here.");
        
output("`n`n`#You have been healed for $diff points!");
    }else{
        
output("`3The old creature pierces you with a gaze hard and cruel.  Your lightning quick ");
        
output("reflexes enable you to dodge the blow from its gnarled staff.  Perhaps you should ");
        
output("get some more money before you attempt to engage in local commerce.");
        
output("`n`nYou recall that the creature had asked for `b`\$$cost`3`b gold.");
    }
}
addnav("`bReturn`b");
addnav("Back to the forest","forest.php");
addnav("Back to the village","village.php");
page_footer();
?>