295 lines
9.6 KiB
Plaintext
295 lines
9.6 KiB
Plaintext
#include <daemons.h>
|
|
|
|
inherit "/lib/std/room";
|
|
|
|
#define COST money/bonus
|
|
#define MAX_DONATION 600
|
|
|
|
mapping blood;
|
|
|
|
void init() {
|
|
::init();
|
|
add_action("new_body", "renew");
|
|
add_action("clean_poison", "clean");
|
|
add_action("regenerate", "regenerate");
|
|
add_action("read", "read");
|
|
add_action("donate", "donate");
|
|
add_action("transfuse", "transfuse");
|
|
}
|
|
|
|
void create() {
|
|
seteuid(getuid());
|
|
SetProperty("light", 2);
|
|
SetProperty("indoors", 1);
|
|
SetShort("Cleric's Hospital of Praxis");
|
|
SetLong(
|
|
"You are in the local hospital run by the town's clerics.\n"+
|
|
"Here they specialize in the regeneration of lost limbs.\n"+
|
|
"A list of all services they perform is posted on the wall.\n"
|
|
);
|
|
set_item_descriptions(
|
|
({
|
|
"list", "hospital", "clerics", "cleric"
|
|
}),
|
|
({
|
|
"You can read all the services by typing <read list>.\n",
|
|
"The clerics here specialize in regenerating lost limbs.\n",
|
|
"They are mending the wounds of patients.\n",
|
|
"He is mending a patient's wounds.\n"
|
|
})
|
|
);
|
|
SetExits( ([
|
|
"east" : "/domains/Praxis/n_centre2" ,
|
|
]) );
|
|
blood = ([ "who": ([]), "hp":200, "mp":200 ]);
|
|
SetProperty("no teleport", 1);
|
|
}
|
|
|
|
int new_body(string str) {
|
|
object *inv;
|
|
int i;
|
|
|
|
|
|
if( (int)this_player()->query_level() != 1) {
|
|
notify_fail("The clerics only perform this service for the inexperienced.\n");
|
|
return 0;
|
|
}
|
|
inv = all_inventory(this_player());
|
|
for(i=0; i<sizeof(inv); i++) {
|
|
inv[i]->unequip();
|
|
}
|
|
write("A cleric comes over to you and mutters a small prayer.\n");
|
|
write("You again have the all the limbs you were born with!\n");
|
|
say("A cleric mutters a small prayer for the novice "+this_player()->query_cap_name()+".\n", this_player());
|
|
this_player()->new_body();
|
|
return 1;
|
|
}
|
|
|
|
int read(string str) {
|
|
if(!str) {
|
|
notify_fail("Read what?\n");
|
|
return 0;
|
|
}
|
|
if(str != "list") {
|
|
notify_fail("That is not here for reading.\n");
|
|
return 0;
|
|
}
|
|
write("Welcome to the Cleric's Hospital of Praxis!\n"+
|
|
"The clerics perform the following services:\n"+
|
|
"------------------------------------------------------------------\n"+
|
|
"<renew body>: This is a charity service the clerics perform for\n"+
|
|
" novice adventurers who have lost limbs while adventuring.\n"+
|
|
" All limbs are replaced.\n\n"+
|
|
"<regenerate [limb]>: This service is for the experienced adventurer\n"+
|
|
" who has lost limbs. The limb is replaced and acts like new.\n"+
|
|
" Tithe schedule for regeneration:\n"+
|
|
" hands and feet- 400 gold\n");
|
|
write(" arms and legs- 600 gold\n"+
|
|
"<clean poison>: Helps remove some of the poison from your body.\n"+
|
|
"\ttithe: 50 gold\n"+
|
|
"<donate # (hp or mp) of blood>: Donates some of your blood in\n"+
|
|
"\texchange for gold.\n"+
|
|
"<transfuse # (hp or mp)>: Transfuse some blood int hp or mp into your body\n"+
|
|
"\ttithe: amount * 3 gold coins.\n"+
|
|
"Currently: "+blood["hp"]+" hp blood and "+blood["mp"]+" mp blood free.\n"+
|
|
"------------------------------------------------------------------\n"+
|
|
"Half off all regenerations with the severed limb!\n"+
|
|
"Your tithe is used only toward good causes.\n");
|
|
return 1;
|
|
}
|
|
|
|
int clean_poison(string str) {
|
|
object tp;
|
|
|
|
if(!str) return 0;
|
|
if(str != "poison") return 0;
|
|
tp = this_player();
|
|
if((int)tp->query_poisoning()<1) {
|
|
notify_fail("A cleric whispers to you: But you are not poisoned!\n");
|
|
return 0;
|
|
}
|
|
if((int)tp->query_money("gold") < 50) {
|
|
notify_fail("You do not have enough gold for the tithe.\n");
|
|
return 0;
|
|
}
|
|
tp->add_money("gold", -50);
|
|
tp->add_poisoning(-10);
|
|
write("A cleric casts a spell of healing upon you.\n");
|
|
say("A cleric casts a spell of healing on "+tp->query_cap_name()+".\n", tp);
|
|
return 1;
|
|
}
|
|
|
|
int regenerate(string limb) {
|
|
int money, bonus;
|
|
mapping limb_info;
|
|
object tp;
|
|
string *there, *missing;
|
|
|
|
tp = this_player();
|
|
if(present(limb, this_player())) bonus = 2;
|
|
else bonus = 1;
|
|
there = (string *)tp->query_limbs();
|
|
missing = (string *)this_player()->query_severed_limbs() +
|
|
(string *)RACE_D->query_limbs((string)this_player()->query_race());
|
|
/*
|
|
checking with the race_d is allowing compatibility with old
|
|
versions of the mudlib
|
|
*/
|
|
if(!missing) {
|
|
notify_fail("You aren't missing any limbs!\n");
|
|
return 0;
|
|
}
|
|
if(member_array(limb, missing) == -1) {
|
|
notify_fail("You are not missing that limb!\n");
|
|
return 0;
|
|
}
|
|
if(member_array(limb, there) != -1) {
|
|
notify_fail("You already have that one back!\n");
|
|
return 0;
|
|
}
|
|
limb_info= (mapping)RACE_D->query_limb_info(limb,(string)tp->query_race());
|
|
if(!limb_info) {
|
|
notify_fail("That limb cannot be replaced!\n");
|
|
return 0;
|
|
}
|
|
if(limb_info["ref"] != "") {
|
|
if(member_array(limb_info["ref"], there) == -1) {
|
|
notify_fail("You would need a "+limb_info["ref"]+" for that!\n");
|
|
return 0;
|
|
}
|
|
}
|
|
if((string)this_player()->query_class() == "cleric") money = 1200;
|
|
else money = 1600;
|
|
money = money / limb_info["max"];
|
|
if((int)tp->query_money("gold") < COST) {
|
|
notify_fail("The cleric tells you: You do not have enough gold.\n");
|
|
return 0;
|
|
}
|
|
tp->AddLimb(limb, limb_info["ref"], (int)tp->query_max_hp()/limb_info["max"], 0, 0);
|
|
if(member_array(limb, (string *)RACE_D->query_wielding_limbs((string)tp->qyery_race())) != -1)
|
|
tp->add_wielding_limb(limb);
|
|
tp->add_money("gold", -COST);
|
|
if(limb == "left hand") {
|
|
if(member_array("left arm", there) == -1) {
|
|
notify_fail("You would need a left arm for that!\n");
|
|
return 0;
|
|
}
|
|
money = 400;
|
|
if((int)tp->query_money("gold") < COST) {
|
|
notify_fail("The cleric tells you: You do not have enough gold for that.\n");
|
|
return 0;
|
|
}
|
|
tp->AddLimb(limb, "", (int)tp->query_max_hp()/4, 0, 0);
|
|
tp->add_wielding_limb(limb);
|
|
tp->add_money("gold", -COST);
|
|
}
|
|
else if(limb == "left foot" || limb == "right foot") {
|
|
money = 400;
|
|
if((int)tp->query_money("gold") < COST) {
|
|
notify_fail("The cleric says: You don't have enough gold for the tithe.\n");
|
|
return 0;
|
|
}
|
|
if( (limb == "left foot" && member_array("left leg", there) == -1) || (limb == "right foot" && member_array("right leg", there) == -1) ) {
|
|
notify_fail("You need a limb to attatch it to!\n");
|
|
return 0;
|
|
}
|
|
tp->AddLimb(limb, "", (int)tp->query_max_hp()/4, 0, 0);
|
|
tp->add_money("gold", -COST);
|
|
}
|
|
else if(limb == "left arm" || limb == "left leg" || limb == "right arm" || limb == "right leg") {
|
|
money = 600;
|
|
if((int)tp->query_money("gold") < COST) {
|
|
notify_fail("The cleric tells you: You do not have enough gold for the tithe.\n");
|
|
return 0;
|
|
}
|
|
if(limb == "left arm") tp->AddLimb(limb, "left hand", (int)tp->query_max_hp()/3, 0, 0);
|
|
else if(limb == "left leg") tp->AddLimb(limb, "left foot", (int)tp->query_max_hp()/3, 0, 0);
|
|
else if(limb == "right leg") tp->AddLimb(limb, "right foot", (int)tp->query_max_hp()/3, 0, 0);
|
|
else tp->AddLimb(limb, "right hand", (int)tp->query_max_hp()/3, 0, 0);
|
|
tp->add_money("gold", -COST);
|
|
}
|
|
else {
|
|
write("The cleric says: Sorry, but we do not have the ability to do that.\n");
|
|
say("A cleric looks sadly at "+tp->query_cap_name()+".\n", tp);
|
|
return 1;
|
|
}
|
|
say(tp->query_cap_name()+" asks the clerics for some help with "+tp->query_possessive()+" missing "+limb+".\n", tp);
|
|
write("The clerics restore your "+limb+"!\n");
|
|
return 1;
|
|
}
|
|
|
|
int donate(string str) {
|
|
string what;
|
|
int amount, tmp;
|
|
|
|
if(!str) {
|
|
notify_fail("Donate what?\n");
|
|
return 0;
|
|
}
|
|
if(sscanf(str, "%d %s of blood", amount, what) !=2) {
|
|
notify_fail("Correct syntax: <donate [#] [hp | mp] of blood>\n");
|
|
return 0;
|
|
}
|
|
if(what != "mp" && what != "hp") {
|
|
notify_fail("Donate what?\n");
|
|
return 0;
|
|
}
|
|
if(blood[(string)this_player()->query_name()]+amount > MAX_DONATION) {
|
|
write("You will have to wait before giving that much blood.\n");
|
|
return 1;
|
|
}
|
|
tmp = (int)call_other(this_player(), "query_"+what);
|
|
if(tmp < amount + 5) {
|
|
notify_fail("You must have at least 5 more than you plan to give!\n");
|
|
return 0;
|
|
}
|
|
call_other(this_player(), "add_"+what, -amount);
|
|
this_player()->add_money("gold", amount/2);
|
|
blood[what] += amount;
|
|
blood["who"][(string)this_player()->query_name()] += amount;
|
|
write("You donate some blood for "+(amount/2)+" gold coins.\n");
|
|
say(this_player()->query_cap_name()+" donates some blood for some gold.\n", this_player());
|
|
call_out("reduce_donation", 900, ({ this_player(), amount }));
|
|
return 1;
|
|
}
|
|
|
|
int transfuse(string str) {
|
|
string what;
|
|
int amount;
|
|
|
|
if(!str) {
|
|
notify_fail("Transfuse what?\n");
|
|
return 0;
|
|
}
|
|
if(sscanf(str, "%d %s", amount, what) != 2) {
|
|
notify_fail("Correct syntax: <transfuse [#] [mp | hp]>\n");
|
|
return 0;
|
|
}
|
|
if(what != "hp" && what != "mp") {
|
|
notify_fail("You cannot do that!\n");
|
|
return 0;
|
|
}
|
|
if(amount < 1) {
|
|
notify_fail("Are you crazy?!?\n");
|
|
return 0;
|
|
}
|
|
if(blood[what] < amount) {
|
|
notify_fail("We do not have that much blood in right now.\n");
|
|
return 0;
|
|
}
|
|
if((int)this_player()->query_money("gold") < amount*3) {
|
|
notify_fail("You do not have enough gold for the tithe.\n");
|
|
return 0;
|
|
}
|
|
this_player()->add_money("gold", -(amount*3));
|
|
call_other(this_player(), "add_"+what, amount);
|
|
write("You receive a blood transfusion\n");
|
|
say(this_player()->query_cap_name()+" receives a blood transfusion.\n", this_player());
|
|
return 1;
|
|
}
|
|
|
|
void reduce_donation(mixed *tmp) {
|
|
blood["who"][tmp[0]] -= tmp[1];
|
|
if(blood["who"][tmp[0]] < 1) map_delete(blood, tmp[0]);
|
|
}
|