From 5d7b3dedc6a18ff03cf7a45e7fe7c84ace7cb5c5 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Wed, 8 Feb 2012 04:23:51 +0000 Subject: [PATCH] - [+] change how poison works - [+] poisontype_t - [+] define them all - [+] ie. each poison type has a fixed damage amount. - [+] check poisonisfatal() - [+] check F_POISONED bit in startlfturn - [+] salmonella. like food poisoning but causes more damage. - [+] small chance of getting sick from raw meat? - [+] FIT check to avoid. - [+] raw meat = gastroenteritis. - [+] raw chicken = salmonella - [+] rotting food = either gastro (66%) or salmonella (33%) - [+] new monster-only jobs - [+] guard - [+] has lots of armour and f_noflee and f_stayinroom - [+] set climbing difficulty based on cell type as well as material --- data.c | 22 +++++++ defs.h | 15 +++++ io.c | 20 +++--- lf.c | 192 ++++++++++++++++++++++++++++++++++++++++---------------- lf.h | 5 ++ map.c | 34 +++++++++- map.h | 1 + nexus.c | 3 + spell.c | 4 +- text.c | 48 -------------- text.h | 4 +- 11 files changed, 235 insertions(+), 113 deletions(-) diff --git a/data.c b/data.c index d98049b..2c98a0e 100644 --- a/data.c +++ b/data.c @@ -15,6 +15,7 @@ extern map_t *firstmap; extern race_t *firstrace, *lastrace; extern raceclass_t *firstraceclass, *lastraceclass; extern job_t *firstjob, *lastjob; +extern poisontype_t *firstpoisontype,*lastpoisontype; extern skill_t *firstskill, *lastskill; extern objecttype_t *objecttype; extern objectclass_t *objectclass,*lastobjectclass; @@ -856,6 +857,16 @@ void initjobs(void) { addflag(lastjob->flags, F_CASTCHANCE, 30, NA, NA, NULL); // non-player jobs + addjob(J_GUARD, "Guard", "Guards are paid mercenaries employed to protect a certain area. Accordingly, they are generally outfitetd with high quality armour."); + addflag(lastjob->flags, F_NOPLAYER, B_TRUE, NA, NA, NULL); + addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "random good armour"); + addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "random good armour"); + addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "random good armour"); + addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "random good armour"); + addflag(lastjob->flags, F_STAYINROOM, NA, NA, NA, NULL); + addflag(lastjob->flags, F_STARTSKILL, SK_ARMOUR, PR_SKILLED, NA, NULL); + // 50% of guards are bribable + f = addflag(lastjob->flags, F_WANTS, OT_GOLD, NA, NA, NULL); addcondition(f, FC_IFMONSTER, 50); /* addjob(J_SHOPKEEPER, "Shopkeeper", "Shopkeepers make a living by selling goods to others. Always wary of thieves, most of them keep a shotgun under the counter."); addflag(lastjob->flags, F_NOPLAYER, B_TRUE, NA, NA, NULL); @@ -871,6 +882,14 @@ void initobjects(void) { flag_t *f; int i,n; + // init poison types + addpoisontype(P_COLD, "hypothermia", "Sick", "cough", B_FALSE, 1, 25, PS_DISEASE); + addpoisontype(P_FOOD, "gastroenteritis", "Poisoned", "vomit", B_TRUE, 1, 25, PS_POISON); + addpoisontype(P_FOODBAD, "salmonella poisoning", "Poisoned", "vomit", B_TRUE, 2, 33, PS_POISON); + addpoisontype(P_GAS, "gas inhalation", "Poisoned", "cough", B_FALSE, 1, 25, PS_POISON); + addpoisontype(P_VENOM, "venom poisoning", "Poisoned", "vomit", B_TRUE, 1, 25, PS_POISON); + addpoisontype(P_WEAKNESS, "weakening poison", "Poisoned", "cough", B_FALSE, 0, 0, PS_POISON); + // generate hidden name text for (n = 0; strlen(colour[n].name); n++) { char buf[BUFLEN]; @@ -8492,6 +8511,7 @@ void initrace(void) { addflag(lastrace->flags, F_MORALE, 10, NA, NA, NULL); addflag(lastrace->flags, F_CANINE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_FATALFOOD, OT_CHOCOLATE, NA, NA, NULL); + addflag(lastrace->flags, F_STARTJOB, 33, J_GUARD, NA, NULL); addrace(R_GNOLLHM, "gnoll hunter", 130, 'h', C_BROWN, MT_FLESH, RC_HUMANOID, "Hunters are gnolls tasked with obtaining food, but can also turn their ranged skills to combat."); setbodytype(lastrace, BT_HUMANOID); @@ -8765,6 +8785,7 @@ void initrace(void) { addflag(lastrace->flags, F_STARTSKILL, SK_PERCEPTION, PR_SKILLED, NA, NULL); addflag(lastrace->flags, F_NOCTURNAL, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_MORALE, 5, NA, NA, NULL); + addflag(lastrace->flags, F_STARTJOB, 33, J_GUARD, NA, NULL); addrace(R_HOBGOBLINWAR, "hobgoblin elite", 90, 'g', C_GREEN, MT_FLESH, RC_HUMANOID, "An exceptional hobgoblin commander who has achieved command of its own unit."); setbodytype(lastrace, BT_HUMANOID); @@ -9067,6 +9088,7 @@ void initrace(void) { addflag(lastrace->flags, F_NOCTURNAL, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_MORALE, 10, NA, NA, NULL); addflag(lastrace->flags, F_STARTJOB, 25, J_WARRIOR, NA, NULL); + addflag(lastrace->flags, F_STARTJOB, 25, J_GUARD, NA, NULL); addrace(R_ORK, "ork", 90, 'o', C_BROWN, MT_FLESH, RC_HUMANOID, "Orcs who have become fascinated with technology tend to become shunned by their peers, and have taken the name 'Orks' for themselves."); setbodytype(lastrace, BT_HUMANOID); diff --git a/defs.h b/defs.h index a2d3620..02a0a0f 100644 --- a/defs.h +++ b/defs.h @@ -1096,6 +1096,8 @@ enum JOB { J_ROGUE, //J_SHOPKEEPER, J_WIZARD, + // monster jobs + J_GUARD, }; #define J_RANDOM J_NONE @@ -2047,6 +2049,7 @@ enum POISONSEVERITY { enum POISONTYPE { P_COLD, P_FOOD, + P_FOODBAD, P_GAS, P_VENOM, P_WEAKNESS, @@ -3556,6 +3559,18 @@ typedef struct habitat_s { struct habitat_s *next, *prev; } habitat_t; +typedef struct poisontype_s { + enum POISONTYPE id; + char *name; + char *desc; + char *damverb; + int causesvomit; + int dam; + int dampct; + enum POISONSEVERITY severity; + struct poisontype_s *next, *prev; +} poisontype_t; + typedef struct room_s { int id; int x1,y1,x2,y2; diff --git a/io.c b/io.c index a572551..305c24e 100644 --- a/io.c +++ b/io.c @@ -1173,6 +1173,7 @@ int announceflaggain(lifeform_t *lf, flag_t *f) { char buf[BUFLEN]; char *buf2; char *p; + poisontype_t *pt; if (player && isdead(player)) { return B_FALSE; @@ -1554,11 +1555,12 @@ int announceflaggain(lifeform_t *lf, flag_t *f) { } break; case F_POISONED: + pt = findpoisontype(f->val[0]); if (isplayer(lf)) { - if (streq(getpoisondesc(f->val[0]), "Sick")) { - msg("^%cYou have contracted %s.", getlfcol(lf, CC_VBAD), getpoisonname(f->val[0])); + if (streq(pt->desc, "Sick")) { + msg("^%cYou have contracted %s.", getlfcol(lf, CC_VBAD), pt->name); } else { - msg("^%cYou are sick with %s.", getlfcol(lf, CC_VBAD), getpoisonname(f->val[0])); + msg("^%cYou are sick with %s.", getlfcol(lf, CC_VBAD), pt->name); } } else { msg("^%c%s looks very sick.", getlfcol(lf, CC_VBAD), lfname); @@ -9982,20 +9984,22 @@ void drawstatus(void) { f = ispoisoned(player); if (f) { + poisontype_t *pt; + pt = findpoisontype(f->val[0]); // find highest amount of poison if (getskill(player, SK_FIRSTAID) >= PR_ADEPT) { if (poisonthreatenslife(player, f)) { setcol(statwin, C_RED); - wprintw(statwin, " %s(bad)", getpoisondesc(f->val[0])); + wprintw(statwin, " %s(bad)", pt->desc); unsetcol(statwin, C_RED); } else { setcol(statwin, C_BROWN); - wprintw(statwin, " %s(mild)", getpoisondesc(f->val[0])); + wprintw(statwin, " %s(mild)", pt->desc); unsetcol(statwin, C_BROWN); } } else { setcol(statwin, C_RED); - wprintw(statwin, " %s", getpoisondesc(f->val[0])); + wprintw(statwin, " %s", pt->desc); unsetcol(statwin, C_RED); } } @@ -12148,6 +12152,8 @@ void showlfstats(lifeform_t *lf, int showall) { for (f = lf->flags->first ; f ; f = f->next ){ if (f->known && (f->id == F_POISONED)) { int knownfatal = B_FALSE; + poisontype_t *pt; + pt = findpoisontype(f->val[0]); if (getskill(player, SK_FIRSTAID) >= PR_ADEPT) { if (poisonthreatenslife(lf, f)) { @@ -12156,7 +12162,7 @@ void showlfstats(lifeform_t *lf, int showall) { } snprintf(buf, BUFLEN, "%s %s sick with %s%s.", you(lf), is(lf), - getpoisonname(f->val[0]), + pt->name, knownfatal ? ", potentially fatally" : ""); if (lfhasflag(lf, F_EXTRAINFO) || lfhasflag(lf, F_OMNIPOTENT) || (getskill(player, SK_FIRSTAID) >= PR_ADEPT) ) { diff --git a/lf.c b/lf.c index 84659ca..0f0e801 100644 --- a/lf.c +++ b/lf.c @@ -32,6 +32,7 @@ extern race_t *firstrace, *lastrace; extern raceclass_t *firstraceclass, *lastraceclass; extern job_t *firstjob, *lastjob; extern skill_t *firstskill, *lastskill; +extern poisontype_t *firstpoisontype,*lastpoisontype; extern objecttype_t *objecttype; extern lifeform_t *player; @@ -3510,9 +3511,10 @@ int eat(lifeform_t *lf, object_t *o) { addflag(lf->flags, F_EATING, NA, NA, NA, buf); } - if (isrotting(o)) { - if (!isimmuneto(lf->flags, DT_POISON, B_FALSE)) { + if (!isimmuneto(lf->flags, DT_POISON, B_FALSE)) { + if (isrotting(o)) { char dambuf[BUFLEN]; + enum POISONTYPE ptid; // lose hp if (isplayer(lf)) { msg("^BThat %s was bad!", drinking ? "liquid" : "food"); @@ -3523,7 +3525,44 @@ int eat(lifeform_t *lf, object_t *o) { } else { snprintf(dambuf, BUFLEN, "a bad %s",noprefix(obname)); } - poison(lf, rnd(20,40), P_FOOD, 1, dambuf); + if (onein(3)) { + ptid = P_FOODBAD; + } else { + ptid = P_FOOD; + } + poison(lf, rnd(20,40), ptid, 1, dambuf); + } else if (!drinking) { + char dambuf[BUFLEN]; + snprintf(dambuf, BUFLEN, "a bad %s",noprefix(obname)); + + // raw meat? + if (hasflag(o->flags, F_ISMEAT) && !hasflag(o->flags, F_PREPARED) && !lfhasflag(lf, F_CANEATRAW)) { + flag_t *cf; + race_t *corpserace = NULL; + cf = hasflag(o->flags, F_CORPSEOF); + if (cf) { + corpserace = findrace(cf->val[0]); + } + if (corpserace) { + int checkdiff; + enum POISONTYPE ptid; + int timemin,timemax; + if (hasflag(corpserace->flags, F_AVIAN)) { + checkdiff = 30; + ptid = P_FOODBAD; + timemin = 30; + timemax = 50; + } else { + checkdiff = 20; + ptid = P_FOOD; + timemin = 20; + timemax = 40; + } + if (!skillcheck(lf, SC_POISON, checkdiff, 0)) { + poison(lf, rnd(timemin,timemax), ptid, 1, dambuf); + } + } + } } } @@ -4537,6 +4576,17 @@ lifeform_t *findlfunique(enum RACE rid) { return NULL; } +poisontype_t *findpoisontype(enum POISONTYPE id) { + poisontype_t *pt; + for (pt = firstpoisontype; pt ; pt = pt->next) { + if (pt->id == id) { + return pt; + } + } + + return NULL; +} + race_t *findrace(enum RACE id) { race_t *r; for (r = firstrace; r ; r = r->next) { @@ -4547,6 +4597,7 @@ race_t *findrace(enum RACE id) { return NULL; } + race_t *findracebyname(char *name) { race_t *r; raceclass_t *rc; @@ -7758,35 +7809,6 @@ char *getplayernamefull(char *buf) { return buf; } - -int getpoisondamchance(enum POISONTYPE ptype) { - int chance = 0; - switch (ptype) { - case P_FOOD: - case P_GAS: - case P_VENOM: - case P_COLD: - chance = 25; - break; - default: - chance = 0; - break; - } - return chance; -} - - -enum POISONSEVERITY getpoisonseverity(enum POISONTYPE ptype) { - switch (ptype) { - case P_COLD: - return PS_DISEASE; - default: - break; - } - // default is not too bad. - return PS_POISON; -} - int getraceclass(lifeform_t *lf) { return lf->race->raceclass->id; } @@ -11450,6 +11472,37 @@ object_t *isstuck(lifeform_t *lf) { return NULL; } +poisontype_t *addpoisontype(enum POISONTYPE id, char *name, char *desc, char *damverb, int causesvomit, int dam, int dampct, enum POISONSEVERITY severity) { + poisontype_t *a; + + // add to the end of the list + if (firstpoisontype == NULL) { + firstpoisontype = malloc(sizeof(poisontype_t)); + a = firstpoisontype; + a->prev = NULL; + } else { + // go to end of list + a = lastpoisontype; + a->next = malloc(sizeof(poisontype_t)); + a->next->prev = a; + a = a->next; + } + lastpoisontype = a; + a->next = NULL; + + // props + a->id = id; + a->name = strdup(name); + a->desc = strdup(desc); + a->damverb = strdup(desc); + a->causesvomit = causesvomit; + a->dam = dam; + a->dampct = dampct; + a->severity = severity; + + return a; +} + job_t *addjob(enum JOB id, char *name, char *desc) { job_t *a; @@ -12642,6 +12695,34 @@ void killjob(job_t *job) { } +void killpoisontype(poisontype_t *pt) { + poisontype_t *nextone, *lastone; + + // free mem + free(pt->name); + free(pt->desc); + free(pt->damverb); + + // remove from list + nextone = pt->next; + if (nextone != NULL) { + nextone->prev = pt->prev; + } else { /* last */ + lastpoisontype = pt->prev; + } + + if (pt->prev == NULL) { + /* first */ + nextone = pt->next; + free(firstpoisontype); + firstpoisontype = nextone; + } else { + lastone = pt->prev; + free (lastone->next ); + lastone->next = nextone; + } +} + void killrace(race_t *r) { race_t *nextone, *lastone; @@ -14292,9 +14373,15 @@ void poison(lifeform_t *lf, int howlong, enum POISONTYPE ptype, int power, char enum POISONSEVERITY psev; flag_t *retflag[MAXCANDIDATES]; int nretflags; + poisontype_t *pt; + pt = findpoisontype(ptype); + + if (isimmuneto(lf->flags, DT_POISON, B_FALSE)) { + return; + } // are you immune to disease? - psev = getpoisonseverity(ptype); + psev = pt->severity; if ((psev == PS_DISEASE) && hasflag(lf->flags, F_DISEASEIMMUNE)) { return; } @@ -14346,27 +14433,21 @@ void poison(lifeform_t *lf, int howlong, enum POISONTYPE ptype, int power, char } } -int poisoncausesvomit(enum POISONTYPE ptype) { - switch (ptype) { - case P_FOOD: - case P_VENOM: - return B_TRUE; - default: - break; - } - return B_FALSE; -} int poisonthreatenslife(lifeform_t *lf, flag_t *f) { float time,dam,totaldam; + poisontype_t *pt; if (!f) return B_FALSE; + pt = findpoisontype(f->val[0]); + time = f->lifetime; - dam = f->val[1]; + dam = pt->dam * f->val[1]; + totaldam = time * dam; - totaldam = pctof(getpoisondamchance(f->val[0]), totaldam); + totaldam = pctof(pt->dampct, totaldam); if (totaldam >= lf->hp) { return B_TRUE; @@ -14935,12 +15016,13 @@ int startclimbing(lifeform_t *lf) { // climbing down a pit? if (pit) { - int mod; + int diff; // move there. movelf(lf, where); // make a skill check. - mod = (countadjwalls(where)+1)/2; - if (skillcheck(lf, SC_CLIMB, 20, mod)) { + //mod = (countadjwalls(where)+1)/2; + diff = getcellclimbdifficultyavg(where); + if (skillcheck(lf, SC_CLIMB, diff, 0)) { // if you pass, safely move down the pit. // usestairs() will announce this. usestairs(lf, pit, B_TRUE, B_TRUE); @@ -17272,13 +17354,15 @@ void startlfturn(lifeform_t *lf) { f = hasflag(lf->flags, F_POISONED); if (f) { + poisontype_t *pt; + pt = findpoisontype(f->val[0]); // chance of fighting it off - gets easier over time. // if (skillcheck(lf, SC_POISON, (f->lifetime * 9), 0 )) { killflag(f); } else { // chance of losing hp - if (rnd(1,100) <= getpoisondamchance(f->val[0])) { + if (pctchance(pt->dampct)) { char buf[BUFLEN]; flag_t *asleep; // being asleep helps. @@ -17286,20 +17370,20 @@ void startlfturn(lifeform_t *lf) { asleep = hasflag(lf->flags, F_ASLEEP); if (!asleep) { if (isplayer(lf)) { - msg("^bYou %s violently.", getpoisondamverb(f->val[0])); + msg("^bYou %s violently.", pt->damverb); } else if (cansee(player, lf)) { char lfname[BUFLEN]; getlfname(lf, lfname); - msg("^%c%s %ss violently.",getlfcol(lf, CC_BAD), lfname, getpoisondamverb(f->val[0])); + msg("^%c%s %ss violently.",getlfcol(lf, CC_BAD), lfname, pt->damverb); } taketime(lf, getactspeed(lf)); } - snprintf(buf, BUFLEN, "%s^from %s",getpoisonname(f->val[0]), f->text); - losehp(lf, f->val[1], DT_DIRECT, NULL, buf); + snprintf(buf, BUFLEN, "%s^from %s",pt->name, f->text); + losehp(lf, pt->dam * f->val[1], DT_DIRECT, NULL, buf); if (!asleep) { - if (poisoncausesvomit(f->val[0])) { + if (pt->causesvomit) { addobfast(lf->cell->obpile, OT_VOMITPOOL); } loseconcentration(lf); diff --git a/lf.h b/lf.h index 553eb49..b587877 100644 --- a/lf.h +++ b/lf.h @@ -3,6 +3,7 @@ void addbodypart(race_t *r, enum BODYPART bp, char *name); lifeform_t *addlf(cell_t *cell, enum RACE rid, int level); lifeform_t *real_addlf(cell_t *cell, enum RACE rid, int level, int controller); +poisontype_t *addpoisontype(enum POISONTYPE id, char *name, char *desc, char *damverb, int causesvomit, int dam, int dampct, enum POISONSEVERITY severity); job_t *addjob(enum JOB id, char *name, char *desc); race_t *addrace(enum RACE id, char *name, float weight, char glyph, int glyphcolour, enum MATERIAL mat, enum RACECLASS raceclass, char *desc); raceclass_t *addraceclass(enum RACECLASS id, char *name, char *pluralname, enum SKILL skill); @@ -101,6 +102,7 @@ job_t *findjob(enum JOB jobid); job_t *findjobbyname(char *name); lifeform_t *findlf(map_t *m, int lfid); lifeform_t *findlfunique(enum RACE rid); +poisontype_t *findpoisontype(enum POISONTYPE id); race_t *findrace(enum RACE id); race_t *findracebyname(char *name); raceclass_t *findraceclass(enum RACECLASS id); @@ -216,11 +218,13 @@ int getstamina(lifeform_t *lf); float getstamregen(lifeform_t *lf); char *getplayername(char *buf); char *getplayernamefull(char *buf); +/* int getpoisondamchance(enum POISONTYPE ptype); char *getpoisondamverb(enum POISONTYPE ptype); char *getpoisondesc(enum POISONTYPE ptype); char *getpoisonname(enum POISONTYPE ptype); enum POISONSEVERITY getpoisonseverity(enum POISONTYPE ptype); +*/ int getraceclass(lifeform_t *lf); int getracerarity(map_t *map, enum RACE rid, enum RARITY *rr); object_t *getrandomarmour(lifeform_t *lf, lifeform_t *attacker); @@ -335,6 +339,7 @@ int isweaponskill(enum SKILL skid); enum FLAG iswoozy(lifeform_t *lf); void killjob(job_t *job); void killlf(lifeform_t *lf); +void killpoisontype(poisontype_t *pt); void killrace(race_t *race); flag_t *levelabilityready(lifeform_t *lf); int loadfirearm(lifeform_t *lf, object_t *gun, object_t *ammo); diff --git a/map.c b/map.c index a22d090..5606398 100644 --- a/map.c +++ b/map.c @@ -272,7 +272,11 @@ lifeform_t *addmonster(cell_t *c, enum RACE rid, char *racename, int jobok, int if (wantjob == J_NONE) { if (jobok) { - for (f = lf->flags->first ; f ; f = f->next) { + int nretflags,i; + flag_t *retflag[MAXCANDIDATES]; + getflags(lf->flags, retflag, &nretflags, F_STARTJOB, F_NONE); + for (i = 0; i < nretflags; i++) { + f = retflag[i]; // has a job? if (f->id == F_STARTJOB) { if (rnd(1,100) <= f->val[0]) { @@ -1500,14 +1504,42 @@ int getcellclimbdifficulty(cell_t *c) { case MT_GLASS: diff = 26; break; case MT_DRAGONWOOD: diff = 20; break; case MT_METAL: diff = 20; break; + case MT_STONE: diff = 15; break; case MT_WAX: diff = 10; break; case MT_WOOD: diff = 8; break; case MT_PLANT: diff = 8; break; default: diff = 12; break; } + // modify for celltype + switch (c->type->id) { + case CT_WALLBRICK: diff -= 5; break; + default: break; + } + limit(&diff, 0, NA); return diff; } +int getcellclimbdifficultyavg(cell_t *c) { + int d; + int diff = 0; + int nwalls = 0; + + for (d = DC_N; d <= DC_NW; d++) { + cell_t *newcell; + newcell = getcellindir(c, d); + if (newcell && newcell->type->solid) { + diff += getcellclimbdifficulty(newcell); + } else { + diff += 30; // ie. v.high + } + nwalls++; + } + diff /= nwalls; + return diff; +} + + + int getcelldist(cell_t *src, cell_t *dst) { double xd,yd; // use pythag diff --git a/map.h b/map.h index a11c278..e03ad6e 100644 --- a/map.h +++ b/map.h @@ -26,6 +26,7 @@ int fix_unreachable_cell(cell_t *badcell); void floodfill(cell_t *startcell); cell_t *getcellat(map_t *map, int x, int y); int getcellclimbdifficulty(cell_t *c); +int getcellclimbdifficultyavg(cell_t *c); int getcelldist(cell_t *src, cell_t *dst); int getcelldistorth(cell_t *src, cell_t *dst); void getcellglyph(glyph_t *g, cell_t *c, lifeform_t *viewer); diff --git a/nexus.c b/nexus.c index 7b43eb5..e354b7b 100644 --- a/nexus.c +++ b/nexus.c @@ -33,6 +33,7 @@ race_t *firstrace = NULL,*lastrace = NULL; raceclass_t *firstraceclass = NULL,*lastraceclass = NULL; recipe_t *firstrecipe = NULL,*lastrecipe = NULL; job_t *firstjob = NULL,*lastjob = NULL; +poisontype_t *firstpoisontype = NULL,*lastpoisontype = NULL; skill_t *firstskill = NULL,*lastskill = NULL; habitat_t *firsthabitat = NULL,*lasthabitat = NULL; map_t *firstmap = NULL,*lastmap = NULL; @@ -718,6 +719,8 @@ void cleanup(void) { while (material) killmaterial(material); // free races while (firstrace) killrace(firstrace); + // free posiontypes + while (firstpoisontype) killpoisontype(firstpoisontype); // free celltypes while (firstcelltype) killcelltype(firstcelltype); /* diff --git a/spell.c b/spell.c index 8d7b79e..c020a2d 100644 --- a/spell.c +++ b/spell.c @@ -8969,6 +8969,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ for (f = target->flags->first ; f ; f = f->next) { if (f->id == F_POISONED) { + poisontype_t *pt; + pt = findpoisontype(f->val[0]); // slightly lower time if (f->lifetime > 1) { f->lifetime--; @@ -8976,7 +8978,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // cut power in half f->val[1] /= 2; if (f->val[1] < 1) f->val[1] = 1; if (isplayer(target)) { - msg("Your %s seems less intense.",getpoisonname(f->val[0])); + msg("Your %s seems less intense.",pt->name); } ndone++; } diff --git a/text.c b/text.c index f0c90cd..4e1abd7 100644 --- a/text.c +++ b/text.c @@ -850,54 +850,6 @@ char *getkillverb(lifeform_t *victim, object_t *wep, enum DAMTYPE damtype, int d return "kill"; } - -char *getpoisondamverb(enum POISONTYPE ptype) { - switch (ptype) { - case P_FOOD: - case P_VENOM: - return "vomit"; - case P_GAS: - case P_COLD: - return "cough"; - default: - break; - } - return ""; -} - -char *getpoisondesc(enum POISONTYPE ptype) { - switch (ptype) { - case P_FOOD: - case P_VENOM: - case P_GAS: - case P_WEAKNESS: - return "Poisoned"; - case P_COLD: - return "Sick"; - default: - break; - } - return "Poisoned"; -} - -char *getpoisonname(enum POISONTYPE ptype) { - switch (ptype) { - case P_COLD: - return "hypothermia"; - case P_FOOD: - return "food poisoning"; - case P_GAS: - return "gas inhalation"; - case P_VENOM: - return "venom poisoning"; - case P_WEAKNESS: - return "weakening poison"; - default: - break; - } - return ""; -} - char *getpossessive(char *text) { char lastchar; // you -> your diff --git a/text.h b/text.h index 51e3d85..342c3d5 100644 --- a/text.h +++ b/text.h @@ -20,8 +20,8 @@ char *getflagsourcetext(flag_t *f); int gethitconferlifetime(char *text, int *min, int *max); char *getkillverb(lifeform_t *victim, object_t *wep, enum DAMTYPE damtype, int dam, int maxhp); char *getpoisondamverb(enum POISONTYPE ptype); -char *getpoisondesc(enum POISONTYPE ptype); -char *getpoisonname(enum POISONTYPE ptype); +//char *getpoisondesc(enum POISONTYPE ptype); +//char *getpoisonname(enum POISONTYPE ptype); char *getpossessive(char *text); char *getdrunktext(flag_t *drunkflag); char *getinjuredbpname(enum BODYPART bp);