PDA

View Full Version : Mend code snippet


Wiz
05-02-2002, 11:51 PM
Here's a mend code snippet. It has skill checks, 25% healing and skill advancement.

NOTE: This won't increase skill beyond 101, since skill above 100 is useless :p

Insert into client_process.cpp

(EDIT: Fixed a couple dumb errors)

case OP_Mend:
{
int mendhp = GetMaxHP() / 4;
int noadvance = (rand()%200);
int currenthp = GetHP();
if (rand()%100 <= GetSkill(MEND)) {
SetHP(GetHP() + mendhp);
SendHPUpdate();
Message(4, "You mend your wounds and heal some damage");
}
else if (noadvance > 175 && currenthp > mendhp) {
SetHP(GetHP() - mendhp);
SendHPUpdate();
Message(4, "You have worsened your wounds!"
}
else if (noadvance > 175 && currenthp <= mendhp) {
SetHP(1);
SendHPUpdate();
Message(4, "You have worsened your wounds!");
}
else {
Message(4, "You fail to mend your wounds");
}
if ((GetSkill(MEND) < noadvance) && (rand()%100 < 35) && (GetSkill(MEND) < 101))
this->SetSkill(MEND,++pp.skills[MEND]);
break;
}

05-03-2002, 07:58 PM
i think the text for a failed mend + hurting yourself is "you worsen your wounds." or "you have worsened your wounds."