ok i'm workin on a swr 1.0 downloaded from this site. Going for something slightly more realistic than the stock code. anyhow i'm putting in a health command and taking HP out of the score command. this is the code that i wrote for health:
anyway i'm sure it's obvious to someone out there what i'm doing wrong, the command will function but it always returns a "healthy" result even when badly wounded. Any ideas?
void do_health(CHAR_DATA * ch, char *argument)
{
char *hpt;
int hitpct;
int chmax = ch->max_hit;
int chhit = ch->hit;
hitpct = ((chmax / chhit) * 100);
if (hitpct > 100 && hitpct != 100) { hpt = "envigorated"; }
else if ((hitpct = 100) || hitpct >= 95) { hpt = "healthy"; }
else if (hitpct < 95 && hitpct >= 90) { hpt = "scuffed"; }
else if (hitpct < 90 && hitpct >= 80) { hpt = "bruised"; }
else if (hitpct < 80 && hitpct >= 70) { hpt = "scratched"; }
else if (hitpct < 70 && hitpct >= 60) { hpt = "injured"; }
else if (hitpct < 60 && hitpct >= 50) { hpt = "beat up"; }
else if (hitpct < 50 && hitpct >= 40) { hpt = "wounded"; }
else if (hitpct < 40 && hitpct >= 30) { hpt = "mauled"; }
else if (hitpct < 30 && hitpct >= 20) { hpt = "maimed"; }
else if (hitpct < 20 && hitpct >= 10) { hpt = "in bad shape"; }
else if (hitpct < 10 && hitpct >= 0) { hpt = "at death's door"; }
else { hpt = "DEAD"; }
ch_printf(ch, "You currently feel %s\n\r", hpt);
return;
}
anyway i'm sure it's obvious to someone out there what i'm doing wrong, the command will function but it always returns a "healthy" result even when badly wounded. Any ideas?