This commit is contained in:
Rob Pearce 2011-03-11 01:25:38 +00:00
parent 4ddc70a314
commit 5f393e02e0
12 changed files with 30368 additions and 49667 deletions

View File

@ -202,7 +202,9 @@ int attacklf(lifeform_t *lf, lifeform_t *victim) {
if (!willheal) {
// modify for strength
dam[ndam] = (int)((float)dam[ndam] * getstrdammod(lf));
if (!hasflag(wep->flags, F_NOSTRDAMMOD) && !lfhasflag(lf, F_NOSTRDAMMOD)) {
dam[ndam] = (int)((float)dam[ndam] * getstrdammod(lf));
}
}
// damtype?

27
defs.h
View File

@ -373,6 +373,7 @@ enum OBCLASS {
OC_FOOD,
OC_CORPSE,
OC_ROCK,
OC_TOOLS,
OC_TECH,
OC_MISC,
OC_SPELL,
@ -738,8 +739,14 @@ enum OBTYPE {
OT_WAND_SLOW,
OT_WAND_WEAKNESS,
OT_WAND_WONDER,
// tech/tools
// tools
OT_BLINDFOLD,
OT_BUGLAMP,
OT_GUNPOWDER,
OT_LANTERNOIL,
OT_LOCKPICK,
OT_PICKAXE,
// tech
OT_POCKETWATCH,
OT_C4,
OT_CREDITCARD,
@ -749,15 +756,11 @@ enum OBTYPE {
OT_INFOVISOR,
OT_INSECTICIDE,
OT_JETPACK,
OT_BUGLAMP,
OT_LANTERNLED,
OT_LANTERNOIL,
OT_LOCKHACKER,
OT_LOCKPICK,
OT_MOTIONSCANNER,
OT_NVGOGGLES,
OT_PAPERCLIP,
OT_PICKAXE,
OT_TELEPAD,
OT_XRAYGOGGLES,
// misc objects
@ -1010,7 +1013,9 @@ enum FLAG {
// v0 is target requirements (los/lof)
// text is prompt
F_OPERNEEDDIR, // need to ask a direction when operating this. text is prompt
// what can ou do with this object?
// technology flags
F_TECHLEVEL, // v0 is a PR_xxx enum for tech usage skill
// what can you do with this object?
F_EDIBLE, // you can eat this. val2 = nutrition. 100 = a meal
// -1 means "nutrition is weight x abs(val1)"
F_OPERABLE, // can operate?
@ -1034,7 +1039,7 @@ enum FLAG {
F_SHARP, // does damage when you step on it. v0/1 are min/max dam
F_SLIPPERY, // you might slip when stepping on it. v0 is amt
F_SLIPMOVE, // if someone slips on this, it will move to an adj cell
F_FLAMMABLE, // object will catch alight if burnt
F_FLAMMABLE, // object will catch alight if burnt (ie fire damage)
// object mods/effects
F_ONFIRE, // burning, also deals extra fire damage
F_HEADLESS, // for corpses. can go on LFs too.
@ -1062,6 +1067,8 @@ enum FLAG {
F_DONTSHOWCHARGES, // don't show 'xx charges left' when id'd
F_RECHARGEWHENOFF, // get power back when you turn it off
F_REFILLWITH, // pour obj id val0 onto this to refill its charges
//
F_POWDER, // this item is a powder
// ob appearance flags
F_SHINY,
// armour flags
@ -1093,6 +1100,9 @@ enum FLAG {
F_AIBOOSTITEM, // ai will use this item to boost/buff itself
F_AIHEALITEM, // ai will use this item when low on hp
F_AIFLEEITEM, // ai will use this item when fleeing
// object _AND_ lifeform flags
F_NOSTRDAMMOD, // this object/lf does not have attacks modified
// using their strength
// lifeform flags
F_DEBUG, // debugging enabled
F_ATTRMOD, // modify attribute val0 by val1. ie. 0=A_STR,1=-3
@ -1367,6 +1377,7 @@ enum ERROR {
E_BLIND = 32,
E_GRABBEDBY = 33,
E_CANTMOVE = 34,
E_NOTKNOWN = 35,
};
@ -1565,8 +1576,10 @@ typedef struct material_s {
enum SKILL {
SK_ATHLETICS,
SK_LOCKPICKING,
SK_RESEARCH,
SK_TECHUSAGE,
};
// proficiency levels

View File

@ -13,6 +13,9 @@ lf.c:
update skillcheck()
update gainlevel() question
update givejob()
update modattr()
io.c:
update announceflaggain() and loss() for this stat
ooooooo replace startxxx with startstat

13
flag.c
View File

@ -29,7 +29,6 @@ flag_t *addflag_real(flagpile_t *fp, enum FLAG id, int val1, int val2, int val3,
known = B_KNOWN;
}
// certain flags stack...
if (flagstacks(id)) {
f = hasflag(fp, id);
@ -293,11 +292,19 @@ void killflag(flag_t *f) {
if (lf && (f->id == F_SPRINTING)) {
int howlong;
// you get tired when you finish sprinting
int slev;
howlong = 5;
// you get tired when you finish sprinting
howlong = 15;
// adjust for athletics skill. -2 per level.
slev = getskill(lf, SK_ATHLETICS);
if (slev != PR_INEPT) {
howlong -= (2*slev);
}
// adjust for constitution
howlong = howlong - (int) ((float)howlong * (getstatmod(lf, A_CON) / 100) );
// enforce minimum
if (howlong < 1) howlong = 1;
addtempflag(f->pile, F_TIRED, B_TRUE, NA, NA, NULL, howlong);
}

1778
io.c

File diff suppressed because it is too large Load Diff

2
io.h
View File

@ -59,7 +59,7 @@ void dothrow(obpile_t *op);
void dovendingmachine(lifeform_t *lf, object_t *vm);
int dowear(obpile_t *op);
int doweild(obpile_t *op);
int downline(int *y, int h, char *heading, char *subheading);
int downline(int *y, int h, char *heading, char *subheading, char *bottomstring, char *cmdchars, char *retchar);
void drawunviscell(cell_t *cell, int x, int y);
void drawcellwithcontents(cell_t *cell, int x, int y);
void drawcursor(void);

59
lf.c
View File

@ -776,6 +776,11 @@ int canwear(lifeform_t *lf, object_t *o, enum BODYPART where) {
return B_FALSE;
}
if (gettechlevel(o) > getskill(lf, SK_TECHUSAGE)) {
reason = E_NOTKNOWN;
return B_FALSE;
}
if (where == BP_NONE) {
// can we wear it ANYWHERE?
enum BODYPART possbp[MAXBODYPARTS];
@ -3273,14 +3278,14 @@ int giveskill(lifeform_t *lf, enum SKILL id) {
if (f) {
// already have the skill - make it better
if (f->val[1] < PR_MASTER) {
f->val[1] ++;
f->val[1]++;
}
if (isplayer(lf) && gamestarted) {
msg("You have learned the %s %s skill!", getskilllevelname(f->val[1]), getskillname(sk->id));
}
} else {
// gaining a new skill
addflag(lf->flags, F_HASSKILL, id, PR_NOVICE, NA, NULL);
f = addflag(lf->flags, F_HASSKILL, id, PR_NOVICE, NA, NULL);
if (isplayer(lf) && gamestarted) {
msg("You have learned the %s %s skill!", getskilllevelname(PR_NOVICE), getskillname(sk->id));
}
@ -3288,6 +3293,27 @@ int giveskill(lifeform_t *lf, enum SKILL id) {
// special effects...
if (id == SK_RESEARCH) {
addflag(lf->flags, F_CANWILL, OT_A_INSPECT, NA, NA, NULL);
} else if (id == SK_ATHLETICS) {
addflag(lf->flags, F_CANWILL, OT_A_SPRINT, NA, NA, NULL);
}
}
if (id == SK_TECHUSAGE) {
objecttype_t *ot;
// automatically make known all tech <= our skill level
for (ot = objecttype ; ot ; ot = ot->next) {
// if objecttype is not known...
if (!isknownot(ot)) {
flag_t *tf;
tf = hasflag(ot->flags, F_TECHLEVEL);
// if objecttype has a tech level , and it is
// lower (or equal to) our tech knowledge...
if (tf && !isknownot(ot) && (tf->val[0] <= f->val[1])) {
// then make it known!
makeknown(ot->id);
}
}
}
}
return B_FALSE;
@ -3359,6 +3385,11 @@ void givestartobs(lifeform_t *lf, flagpile_t *fp) {
killflagsofid(fp, F_STARTOB);
killflagsofid(fp, F_STARTOBDT);
killflagsofid(fp, F_STARTOBCLASS);
// make sure lf doesn't start off burdened!
while (isburdened(lf)) {
modattr(lf, A_STR, 1); // get stronger
}
}
void givestartskills(lifeform_t *lf, flagpile_t *fp) {
@ -4076,8 +4107,8 @@ void initjobs(void) {
addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "10 gold coins");
addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "3 potions of healing");
addflag(lastjob->flags, F_MPDICE, 1, NA, NA, NULL);
addflag(lastjob->flags, F_CANWILL, OT_A_SPRINT, 3, 3, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_LOCKPICKING, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_ATHLETICS, PR_NOVICE, NA, NULL);
addjob(J_ALLOMANCER, "Allomancer");
addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "1 gold coins");
addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "club");
@ -4128,6 +4159,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "10 bullets");
addflag(lastjob->flags, F_STARTATT, A_STR, ST_STRONG, NA, NULL);
addflag(lastjob->flags, F_STARTATT, A_IQ, IQ_DOPEY, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_ATHLETICS, PR_ADEPT, NA, NULL);
// TODO skill: athletics 2
addjob(J_WIZARD, "Wizard");
addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "knife");
@ -4155,6 +4187,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_MPREGEN, 1, NA, NA, NULL);
// can detect magic objects
addflag(lastjob->flags, F_DETECTMAGIC, B_TRUE, NA, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_RESEARCH, PR_ADEPT, NA, NULL);
// TODO skill: magic knowledge
// for monster wizards only:
addflag(lastjob->flags, F_IFMONSTER, NA, NA, NA, NULL);
@ -4384,6 +4417,7 @@ void initrace(void) {
addflag(lastrace->flags, F_FLEEONHPPCT, 50, NA, NA, NULL);
addflag(lastrace->flags, F_HEAVYBLOW, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_CANWILL, OT_S_BURNINGWAVE, 3, 3, NULL);
addflag(lastrace->flags, F_DTRESIST, DT_FIRE, NA, NA, NULL);
// TODO: storm giant
// TODO: storm titan
@ -5718,6 +5752,9 @@ int modattr(lifeform_t *lf, enum ATTRIB attr, int amt) {
case A_STR:
strcpy(adverb, "stronger");
break;
case A_CON:
strcpy(adverb, "healthier");
break;
case A_DEX:
strcpy(adverb, "more agile");
break;
@ -5732,8 +5769,11 @@ int modattr(lifeform_t *lf, enum ATTRIB attr, int amt) {
case A_STR:
strcpy(adverb, "weaker");
break;
case A_CON:
strcpy(adverb, "less healthy");
break;
case A_DEX:
strcpy(adverb, "less agile");
strcpy(adverb, "sluggish");
break;
case A_IQ:
strcpy(adverb, "foolish");
@ -6553,8 +6593,10 @@ void setlastdam(lifeform_t *lf, char *buf) {
}
void initskills(void) {
addskill(SK_ATHLETICS, "Athletics", "Your athletics skill determines how far you can run, and how long it takes for you to recover afterwards.");
addskill(SK_LOCKPICKING, "Lockpicking", "Enhances your ability to pick locks.");
addskill(SK_RESEARCH, "Research", "Allows you a chance of recognising unknown objects.");
addskill(SK_TECHUSAGE, "Tech Usage", "Lets you comprehend the usage of use modern technological items.");
}
void interrupt(lifeform_t *lf) {
@ -7774,7 +7816,7 @@ int wear(lifeform_t *lf, object_t *o) {
if (gamestarted && lf->created) {
switch (reason) {
case E_ALREADYUSING:
if (lf->controller == C_PLAYER) {
if (isplayer(lf)) {
msg("You're already wearing that!");
}
break;
@ -7807,11 +7849,14 @@ int wear(lifeform_t *lf, object_t *o) {
}
} else {
// should never happen
msg("You can't wear that!");
if (isplayer(lf)) msg("You can't wear that!");
}
break;
case E_NOTKNOWN:
if (isplayer(lf)) msg("You can't wear that!");
break;
default:
if (lf->controller == C_PLAYER) {
if (isplayer(lf)) {
msg("You can't wear that!");
}
break;

77674
log.txt

File diff suppressed because it is too large Load Diff

12
nexus.c
View File

@ -68,6 +68,7 @@ int numdraws = 0;
int main(int argc, char **argv) {
int newworld = B_FALSE;
object_t *o;
char welcomemsg[BUFLEN];
atexit(cleanup);
@ -133,19 +134,15 @@ int main(int argc, char **argv) {
// player needs hunger
addflag(player->flags, F_HUNGER, 0, NA, NA, NULL);
drawscreen();
getplayernamefull(pname);
msg("Greetings %s, welcome to %snexus!", pname, newworld ? "the new " : "");
more();
sprintf(welcomemsg, "Greetings %s, welcome to %snexus!", pname, newworld ? "the new " : "");
// XXX testing
//addlf(getcellindir(player->cell, D_N), R_GOBLIN, 1);
// 00:00 - 23:59
curtime = rnd(0,86399);
} else {
drawscreen();
msg("Welcome back!");
more();
sprintf(welcomemsg, "Welcome back!");
}
// start game - this will cause debug messages to now
@ -161,6 +158,9 @@ int main(int argc, char **argv) {
// show level
drawscreen();
msg("%s",welcomemsg);
more();
// MAIN LOOP
// basic flow is:

434
objects.c
View File

@ -63,6 +63,7 @@ enum OBCLASS sortorder[] = {
OC_CORPSE,
OC_RING,
OC_TECH,
OC_TOOLS,
OC_BOOK,
OC_ROCK,
OC_MISC,
@ -70,6 +71,27 @@ enum OBCLASS sortorder[] = {
OC_NULL
};
char *techadjective[] = {
"crazy",
"odd",
"strange",
"weird",
"",
};
char *technoun[] = {
"contraption",
"device",
"doodad",
"doohickey",
"gadget",
"thing",
"object",
"",
};
long nextoid = 0;
brand_t *addbrand(enum BRAND id, char *suffix, enum BODYPART bp) {
@ -1104,6 +1126,7 @@ void adjustdamob(object_t *o, unsigned int *dam, enum DAMTYPE damtype) {
*dam = 0;
return;
}
// only some objects can be hurt
if (!hasflag(o->flags, F_DAMAGABLE)) {
if (damtype != DT_DIRECT) {
@ -1513,16 +1536,16 @@ void explodeob(object_t *o, flag_t *f, int bigness) {
// announce
if (o->pile->owner) {
if (isplayer(o->pile->owner)) {
msg("Your %s explodes!", noprefix(obname));
msg("Your %s explode%s!", noprefix(obname), (o->amt == 1) ? "s" : "");
} else if (haslos(player, o->pile->owner->cell)) {
char lfname[BUFLEN];
getlfname(o->pile->owner, lfname);
msg("%s%s %s explodes!", lfname, getpossessive(lfname), noprefix(obname));
msg("%s%s %s explode%s!", lfname, getpossessive(lfname), noprefix(obname), (o->amt == 1) ? "s" : "");
}
} else if (haslos(player, c)) {
msg("%s explodes!", obname);
msg("%s explode%s!", obname, (o->amt == 1) ? "s" : "");
}
explodecells(c, dam, bigness ? B_TRUE : B_FALSE, o, bigness ? 1 : 0, B_FALSE);
explodecells(c, dam * o->amt, bigness ? B_TRUE : B_FALSE, o, bigness ? 1 : 0, B_FALSE);
// hurt everything!
/*
@ -1537,6 +1560,8 @@ void explodeob(object_t *o, flag_t *f, int bigness) {
explodecell(c, dam, (bigness) ? B_TRUE : B_FALSE, NULL);
}
*/
// object dies.
removeob(o, o->amt);
}
void extinguish(object_t *o) {
@ -1821,10 +1846,16 @@ void fragments(cell_t *centre, char *what, int speed) {
void genhiddennames(void) {
objecttype_t *ot;
flag_t *f;
for (ot = objecttype ; ot ; ot = ot->next) {
if (hasflag(ot->flags, F_HASHIDDENNAME)) {
f = hasflag(ot->flags, F_HASHIDDENNAME);
if (f) {
char *thisname;
thisname = genhiddenname(ot->obclass->id);
if (strlen(f->text)) {
thisname = strdup(f->text);
} else {
thisname = genhiddenname(ot->obclass->id);
}
addknowledge(ot->id, thisname, B_UNKNOWN);
// some descriptions confer other effecst too...
if (strstr(thisname, "glowing")) {
@ -3284,6 +3315,16 @@ int getshatterdam(object_t *o) {
return shatterdam;
}
enum SKILLLEVEL gettechlevel(object_t *o) {
flag_t *f;
enum SKILLLEVEL tlev = PR_INEPT;
f = hasflag(o->flags, F_TECHLEVEL);
if (f) {
tlev = f->val[0];
}
return tlev;
}
int getthrowdam(object_t *o) {
double dam = 0;
flag_t *f;
@ -3436,7 +3477,7 @@ void ignite(object_t *o) {
void initobjects(void) {
//int ch;
//int i;
int i,n;
objecttype_t *ot;
// generate hidden names
@ -3540,13 +3581,26 @@ void initobjects(void) {
addhiddenname(OC_WAND, "sapphire wand");
addhiddenname(OC_WAND, "wooden wand");
// gems
addhiddenname(OC_RING, "ruby ring");
addhiddenname(OC_RING, "diamond ring");
addhiddenname(OC_RING, "emerald ring");
addhiddenname(OC_RING, "silver ring");
addhiddenname(OC_RING, "gold ring");
for (n = 0; strlen(technoun[n]); n++) {
// add it without an adjective
addhiddenname(OC_TECH, technoun[n]);
// add it with all known adjectives
for (i = 0; strlen(techadjective[i]) ; i++) {
char buf[BUFLEN];
sprintf(buf, "%s %s",techadjective[i], technoun[n]);
addhiddenname(OC_TECH, buf);
}
}
shufflehiddennames();
// object modifiers - flags can be either known or not, depending on if it's obvious
addobmod(OM_FLAMING,"flaming");
addflag_real(lastobmod->flags, F_ONFIRE, B_TRUE, NA, NA, NULL, PERMENANT, B_KNOWN, -1);
@ -3683,7 +3737,10 @@ void initobjects(void) {
addflag(lastobjectclass->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastobjectclass->flags, F_OBHP, 50, 50, NA, NULL);
addflag(lastobjectclass->flags, F_OBHPDRAIN, 1, DT_DECAY, NA, NULL); // ie. corpses last for 50 turns
addoc(OC_TECH, "Tools/Technology", "Useful items, from the common to the obscure.", '~');
addoc(OC_TECH, "Technology", "A strange piece of futuristic technology.", '~');
addflag(lastobjectclass->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastobjectclass->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addoc(OC_TOOLS, "Tools", "Useful items, from the common to the obscure.", '[');
addflag(lastobjectclass->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastobjectclass->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addoc(OC_MISC, "Miscellaneous", "This could be anything.", '\\');
@ -3792,6 +3849,7 @@ void initobjects(void) {
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, "");
addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, NA, "");
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_POWDER, B_TRUE, NA, NA, NULL);
addot(OT_GEMOFSEEING, "gem of seeing", "Magically enhances your eyesight.", MT_STONE, 1, OC_ROCK);
addflag(lastot->flags, F_HOLDCONFER, F_XRAYVIS, 2, NA, NULL);
addflag(lastot->flags, F_HOLDCONFER, F_DETECTAURAS, B_TRUE, NA, NULL);
@ -4515,45 +4573,54 @@ void initobjects(void) {
addflag(lastot->flags, F_OPERNEEDTARGET, TT_NONE, NA, NA, NULL);
addflag(lastot->flags, F_AICASTATVICTIM, NA, NA, NA, NULL);
// tech/tools
addot(OT_POCKETWATCH, "pocket watch", "A portable timekeeping device made to be carried in a pocket.", MT_METAL, 0.1, OC_TECH);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 60, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addot(OT_DIGITALWATCH, "digital watch", "An electronic timekeeping device which shows the time as a number.", MT_METAL, 0.1, OC_TECH);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 50, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addot(OT_BLINDFOLD, "blindfold", "Short length of wide cloth, used for blocking eyesight.", MT_CLOTH, 0.01, OC_TECH);
addflag(lastot->flags, F_GOESON, BP_EYES, NA, NA, NULL);
addflag(lastot->flags, F_EQUIPCONFER, F_BLIND, B_TRUE, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 60, NA, NULL);
addot(OT_C4, "block of c4", "A highly explosive plastic which explodes a medium time after activation.", MT_PLASTIC, 1, OC_TECH);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 25, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_CHARGES, 5, 5, NA, NULL);
addflag(lastot->flags, F_DONTSHOWCHARGES, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RECHARGEWHENOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOOBDIETEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_EXPLODEONDEATH, 30, B_BIG, B_IFACTIVATED, NULL);
addflag(lastot->flags, F_GRENADE, B_TRUE, NA, NA, NULL);
addot(OT_BUGLAMP, "glowing flask", "A glass flask with a glowbug corpse inside.", MT_GLASS, 0.3, OC_TECH);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 2, NA, NA, NULL);
addflag(lastot->flags, F_HOLDCONFER, F_PRODUCESLIGHT, 2, IFKNOWN, NULL);
// tech - l0
addot(OT_CREDITCARD, "credit card", "A rectangular plastic card.", MT_PLASTIC, 0.01, OC_TECH);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, NA, NULL);
addflag(lastot->flags, F_PICKLOCKS, 2, NA, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addot(OT_PAPERCLIP, "paperclip", "A thin, looped wire for holding paper together.", MT_METAL, 0.01, OC_TECH);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, NA, NULL);
addflag(lastot->flags, F_PICKLOCKS, 4, B_DIEONFAIL, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
// can use as a (very bad) weapon too...
addflag(lastot->flags, F_DAMTYPE, DT_PIERCE, NA, NA, NULL);
addflag(lastot->flags, F_DAM, 1, 1, NA, NULL);
addflag(lastot->flags, F_ACCURACY, 50, NA, NA, NULL);
// tech - l1
addot(OT_POCKETWATCH, "pocket watch", "A portable timekeeping device made to be carried in a pocket.", MT_METAL, 0.1, OC_TECH);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 60, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_NOVICE, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
addot(OT_DIGITALWATCH, "digital watch", "An electronic timekeeping device which shows the time as a number.", MT_METAL, 0.1, OC_TECH);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 50, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_NOVICE, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
addot(OT_INSECTICIDE, "can of insecticide", "A spraycan containing poisonous chemicals.", MT_METAL, 0.5, OC_TECH);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERUSECHARGE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERNEEDTARGET, TT_MONSTER, NA, NA, "Where will you spray?");
addflag(lastot->flags, F_RNDCHARGES, 5, 10, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_NOVICE, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
addot(OT_LANTERNLED, "LED lantern", "A low-powered but efficient lantern which will last almost forever.", MT_METAL, 0.5, OC_TECH);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 20, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 2, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_NOVICE, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
// tech - l2
addot(OT_FLASHBANG, "flashbang", "A stun grenade which temporarily blinds all within sight.", MT_METAL, 1, OC_TECH);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 40, NA, NULL);
@ -4568,7 +4635,8 @@ void initobjects(void) {
addflag(lastot->flags, F_FLASHONDEATH, 4, NA, B_IFACTIVATED, NULL);
addflag(lastot->flags, F_FLASHONDAM, 4, NA, B_IFACTIVATED, NULL);
addflag(lastot->flags, F_GRENADE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_BEGINNER, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
addot(OT_GRENADE, "grenade", "An explosive weapon which explodes a short time after activation.", MT_METAL, 1, OC_TECH);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 30, NA, NULL);
@ -4580,23 +4648,28 @@ void initobjects(void) {
addflag(lastot->flags, F_RECHARGEWHENOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOOBDIETEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_EXPLODEONDEATH, 10, NA, B_IFACTIVATED, NULL);
addflag(lastot->flags, F_EXPLODEONDEATH, 15, NA, B_IFACTIVATED, NULL);
addflag(lastot->flags, F_EXPLODEONDAM, 10, NA, B_IFACTIVATED, NULL);
addflag(lastot->flags, F_GRENADE, B_TRUE, NA, NA, NULL);
addot(OT_INFOVISOR, "infovisor", "Sleek looking metal visor which displays info directly into the retina.", MT_METAL, 0.2, OC_TECH);
addflag(lastot->flags, F_GOESON, BP_EYES, NA, NA, NULL);
addflag(lastot->flags, F_EQUIPCONFER, F_EXTRAINFO, B_TRUE, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 30, NA, NULL);
addot(OT_INSECTICIDE, "can of insecticide", "A spraycan containing poisonous chemicals.", MT_METAL, 0.5, OC_TECH);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_BEGINNER, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
addot(OT_C4, "block of c4", "A highly explosive plastic which explodes a medium time after activation.", MT_PLASTIC, 1, OC_TECH);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 25, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERUSECHARGE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERNEEDTARGET, TT_MONSTER, NA, NA, "Where will you spray?");
addflag(lastot->flags, F_RNDCHARGES, 5, 10, NA, NULL);
addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_CHARGES, 5, 5, NA, NULL);
addflag(lastot->flags, F_DONTSHOWCHARGES, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RECHARGEWHENOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOOBDIETEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_EXPLODEONDEATH, 30, B_BIG, B_IFACTIVATED, NULL);
addflag(lastot->flags, F_GRENADE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_BEGINNER, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
// tech - l3
addot(OT_JETPACK, "jet pack", "A portable ion-thruster which allows the wearer to fly.", MT_METAL, 10, OC_TECH);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 30, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
@ -4605,20 +4678,63 @@ void initobjects(void) {
addflag(lastot->flags, F_REFILLWITH, OT_POT_OIL, NA, NA, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_FLYING, B_TRUE, NA, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 1, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_ADEPT, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
// tech - l4
addot(OT_INFOVISOR, "infovisor", "Sleek looking metal visor which displays info directly into the retina.", MT_METAL, 0.2, OC_TECH);
addflag(lastot->flags, F_GOESON, BP_EYES, NA, NA, NULL);
addflag(lastot->flags, F_EQUIPCONFER, F_EXTRAINFO, B_TRUE, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 30, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_SKILLED, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
addot(OT_LOCKHACKER, "lock hacker", "A sophisticated machine to manipulate physical locks.", MT_METAL, 3, OC_TECH);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 20, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_SKILLED, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
addot(OT_LANTERNLED, "LED lantern", "A low-powered but efficient lantern which will last almost forever.", MT_METAL, 0.5, OC_TECH);
// tech - l5
addot(OT_TELEPAD, "teleport beacon", "A metal cone which will teleport the user to the nearest similar cone.", MT_METAL, 3, OC_TECH);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 40, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_EXPERT, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
addot(OT_XRAYGOGGLES, "pair of xray goggles", "Bulky looking goggles which allow you to see through walls.", MT_METAL, 0.3, OC_TECH);
addflag(lastot->flags, F_GOESON, BP_EYES, NA, NA, NULL);
addflag(lastot->flags, F_EQUIPCONFER, F_XRAYVIS, 2, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 25, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_EXPERT, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
// tech - l6 ???
// tools
addot(OT_BLINDFOLD, "blindfold", "Short length of wide cloth, used for blocking eyesight.", MT_CLOTH, 0.01, OC_TOOLS);
addflag(lastot->flags, F_GOESON, BP_EYES, NA, NA, NULL);
addflag(lastot->flags, F_EQUIPCONFER, F_BLIND, B_TRUE, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 60, NA, NULL);
addot(OT_BUGLAMP, "glowing flask", "A glass flask with a glowbug corpse inside.", MT_GLASS, 0.3, OC_TOOLS);
addflag(lastot->flags, F_GLYPH, NA, NA, NA, "!");
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 20, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 2, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 2, NA, NA, NULL);
addflag(lastot->flags, F_HOLDCONFER, F_PRODUCESLIGHT, 2, IFKNOWN, NULL);
addot(OT_LANTERNOIL, "oil lantern", "An oil-powered lantern which produces a lot of light.", MT_METAL, 1, OC_TECH);
addot(OT_GUNPOWDER, "pile of gunpowder", "A black metallic powder.", MT_METAL, 0.5, OC_TOOLS);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, "pile of black powder");
addflag(lastot->flags, F_GLYPH, NA, NA, NA, ",");
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 65, NA, NULL);
addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_EXPLODEONDAM, 15, NA, NA, NULL);
addflag(lastot->flags, F_DTVULN, DT_FIRE, NA, NA, "2d6");
addflag(lastot->flags, F_FLAMMABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_POWDER, B_TRUE, NA, NA, NULL);
addot(OT_LANTERNOIL, "oil lantern", "An oil-powered lantern which produces a lot of light.", MT_METAL, 1, OC_TOOLS);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 55, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
@ -4628,36 +4744,17 @@ void initobjects(void) {
addflag(lastot->flags, F_RNDCHARGES, 100, 200, NA, NULL);
addflag(lastot->flags, F_REFILLWITH, OT_POT_OIL, NA, NA, NULL);
addot(OT_LOCKPICK, "lockpick", "An angled piece of metal, used to open locks.", MT_METAL, 0.05, OC_TECH);
addot(OT_LOCKPICK, "lockpick", "An angled piece of metal, used to open locks.", MT_METAL, 0.05, OC_TOOLS);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 75, NA, NULL);
addflag(lastot->flags, F_PICKLOCKS, 10, B_DIEONFAIL, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addot(OT_PAPERCLIP, "paperclip", "A thin, looped wire for holding paper together.", MT_METAL, 0.01, OC_TECH);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, NA, NULL);
addflag(lastot->flags, F_PICKLOCKS, 4, B_DIEONFAIL, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
// can use as a (very bad) weapon too...
addflag(lastot->flags, F_DAMTYPE, DT_PIERCE, NA, NA, NULL);
addflag(lastot->flags, F_DAM, 1, 1, NA, NULL);
addflag(lastot->flags, F_ACCURACY, 50, NA, NA, NULL);
addot(OT_PICKAXE, "pickaxe", "A heavy tool for breaking rock.", MT_METAL, 8, OC_TECH);
addot(OT_PICKAXE, "pickaxe", "A heavy tool for breaking rock.", MT_METAL, 8, OC_TOOLS);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 65, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addot(OT_TELEPAD, "teleport beacon", "A metal cone which will teleport the user to the nearest similar cone.", MT_METAL, 3, OC_TECH);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 40, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addot(OT_XRAYGOGGLES, "pair of xray goggles", "Bulky looking goggles which allow you to see through walls.", MT_METAL, 0.3, OC_TECH);
addflag(lastot->flags, F_GOESON, BP_EYES, NA, NA, NULL);
addflag(lastot->flags, F_EQUIPCONFER, F_XRAYVIS, 2, NA, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 25, NA, NULL);
// misc
@ -5167,6 +5264,7 @@ void initobjects(void) {
addflag(lastot->flags, F_DAMTYPE, DT_BITE, NA, NA, NULL);
addflag(lastot->flags, F_DAM, 1, 2, NA, NULL);
addflag(lastot->flags, F_ACCURACY, 100, NA, NA, NULL);
addflag(lastot->flags, F_NOSTRDAMMOD, B_TRUE, NA, NA, NULL);
addot(OT_CLAWS, "claws", "claws object", MT_BONE, 0, OC_WEAPON);
addflag(lastot->flags, F_DAMTYPE, DT_CLAW, NA, NA, NULL);
@ -5187,22 +5285,26 @@ void initobjects(void) {
addflag(lastot->flags, F_DAMTYPE, DT_ELECTRIC, NA, NA, NULL);
addflag(lastot->flags, F_DAM, 1, 2, NA, NULL);
addflag(lastot->flags, F_ACCURACY, 100, NA, NA, NULL);
addflag(lastot->flags, F_NOSTRDAMMOD, B_TRUE, NA, NA, NULL);
// monster weapons
addot(OT_ACIDATTACK, "acidattack", "acid attack object", MT_WATER, 0, OC_WEAPON);
addflag(lastot->flags, F_DAMTYPE, DT_ACID, NA, NA, NULL);
addflag(lastot->flags, F_DAM, 1, 2, NA, NULL);
addflag(lastot->flags, F_ACCURACY, 60, NA, NA, NULL);
addflag(lastot->flags, F_NOSTRDAMMOD, B_TRUE, NA, NA, NULL);
addot(OT_TOUCHPARALYZE, "paralyzing touch", "paralyzing touch object", MT_BONE, 0, OC_WEAPON);
addflag(lastot->flags, F_DAMTYPE, DT_TOUCH, NA, NA, NULL);
addflag(lastot->flags, F_DAM, 0, 1, NA, NULL);
addflag(lastot->flags, F_ACCURACY, 100, NA, NA, NULL);
addflag(lastot->flags, F_HITCONFER, F_PARALYZED, B_TRUE, NA, "2-4");
addflag(lastot->flags, F_NOSTRDAMMOD, B_TRUE, NA, NA, NULL);
addot(OT_TOUCHPARALYZE2, "strong paralyzing touch", "strong paralyzing touch object", MT_BONE, 0, OC_WEAPON);
addflag(lastot->flags, F_DAMTYPE, DT_TOUCH, NA, NA, NULL);
addflag(lastot->flags, F_DAM, 0, 1, NA, NULL);
addflag(lastot->flags, F_ACCURACY, 100, NA, NA, NULL);
addflag(lastot->flags, F_HITCONFER, F_PARALYZED, B_TRUE, NA, "5-10");
addflag(lastot->flags, F_NOSTRDAMMOD, B_TRUE, NA, NA, NULL);
// missiles
addot(OT_DART, "dart", "A small, sharp projectile weapon.", MT_WOOD, 0.5, OC_MISSILE);
@ -5708,14 +5810,20 @@ int isflammable(object_t *o) {
}
int isknown(object_t *o) {
knowledge_t *k;
// if id'd, return the full name
if (hasflag(o->flags, F_IDENTIFIED)) {
return B_TRUE;
}
return isknownot(o->type);
}
int isknownot(objecttype_t *ot) {
knowledge_t *k;
// if id'd, return the full name
for (k = knowledge; k ; k = k->next) {
if (k->id == o->type->id) {
if (k->id == ot->id) {
// it DOES have a hidden name.
// does the player know about it?
if (k->known) {
@ -5732,6 +5840,7 @@ int isknown(object_t *o) {
}
// is the object fully identified?
// ie. its type is known ("potion of healing" rather than "red potion")
// AND
@ -6367,6 +6476,7 @@ void obdie(object_t *o) {
} else {
explodeob(o, f, (f->val[1] == B_BIG) ? 1 : 0);
}
return;
}
// flashes?
@ -6520,8 +6630,15 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
// if not a wand, must know what a tool is before you can use it
if (!isknown(o) && (o->type->obclass->id != OC_WAND)) {
if (lf->controller == C_PLAYER) {
msg("You don't know how to use that (yet)!");
if (isplayer(lf)) {
msg("You don't know how to use %s!", obname);
}
return B_TRUE;
}
if (gettechlevel(o) > getskill(lf, SK_TECHUSAGE)) {
if (isplayer(lf)) {
msg("This technology is beyond your understanding.");
}
return B_TRUE;
}
@ -7933,6 +8050,55 @@ void setinscription(object_t *o, char *text) {
o->inscription = strdup(text);
}
// randomizes hidden names
void shufflehiddennames(void) {
int i,n;
int total;
hiddenname_t *a, *temp;
int shuffleamt = 20;
total = 0;
for (a = firsthiddenname ; a ; a = a->next) {
total++;
}
if (total <= 1) {
return;
}
for (i = 0; i < shuffleamt; i++) {
int which;
// select random element (but never the first)
which = (rand() % (total-1))+1;
// go there
a = firsthiddenname;
for (n = 0; n < which; n++) {
if (a->next != NULL) a = a->next;
}
temp = a;
// remove from list
temp->prev->next = temp->next;
if (temp->next) {
temp->next->prev = temp->prev;
} else {
lasthiddenname = temp->prev;
}
// re-add this element to the start
temp->next = firsthiddenname;
temp->prev = NULL;
firsthiddenname->prev = temp;
firsthiddenname = temp;
}
}
object_t *splitob(object_t *o) {
object_t *newob;
// decrease count on original stack temporarily, in case we
@ -7992,6 +8158,51 @@ int takedamage(object_t *o, unsigned int howmuch, int damtype) {
}
adjustdamob(o, &howmuch, damtype);
// effects which have to happen before damage is applied...
// explodes?
f = hasflag(o->flags, F_EXPLODEONDAM);
if (f) {
if (f->val[2] == B_IFACTIVATED) {
if (hasflag(o->flags, F_ACTIVATED)) {
if (hasflag(o->flags, F_EXPLODEONDEATH)) {
// object dies!
addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL);
} else {
// explode
explodeob(o, f, (f->val[1] == B_BIG) ? 1 : 0);
return howmuch;
}
}
} else {
if (hasflag(o->flags, F_EXPLODEONDEATH)) {
// object dies!
addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL);
} else {
// explode
explodeob(o, f, (f->val[1] == B_BIG) ? 1 : 0);
return howmuch;
}
}
}
// flashes?
f = hasflag(o->flags, F_FLASHONDAM);
if (f) {
if (f->val[2] == B_IFACTIVATED) {
if (hasflag(o->flags, F_ACTIVATED)) {
// flash, then object dies
brightflash(getoblocation(o),f->val[0], NULL);
addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL);
}
} else {
// flash, then object dies
brightflash(getoblocation(o),f->val[0], NULL);
addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL);
}
return howmuch;
}
if (howmuch <= 0) {
return 0;
}
@ -8046,7 +8257,6 @@ int takedamage(object_t *o, unsigned int howmuch, int damtype) {
// object dies!
addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL);
} else if (hpflag) {
flag_t *f;
// object was just damaged
getobconditionname(o, postdamname);
@ -8084,46 +8294,6 @@ int takedamage(object_t *o, unsigned int howmuch, int damtype) {
// explodes?
f = hasflag(o->flags, F_EXPLODEONDAM);
if (f) {
if (f->val[2] == B_IFACTIVATED) {
if (hasflag(o->flags, F_ACTIVATED)) {
if (hasflag(o->flags, F_EXPLODEONDEATH)) {
// object dies!
addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL);
} else {
// explode
explodeob(o, f, (f->val[1] == B_BIG) ? 1 : 0);
}
}
} else {
if (hasflag(o->flags, F_EXPLODEONDEATH)) {
// object dies!
addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL);
} else {
// explode
explodeob(o, f, (f->val[1] == B_BIG) ? 1 : 0);
}
}
}
// flashes?
f = hasflag(o->flags, F_FLASHONDAM);
if (f) {
if (f->val[2] == B_IFACTIVATED) {
if (hasflag(o->flags, F_ACTIVATED)) {
// flash, then object dies
brightflash(getoblocation(o),f->val[0], NULL);
addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL);
}
} else {
// flash, then object dies
brightflash(getoblocation(o),f->val[0], NULL);
addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL);
}
}
}
return damtaken;
}
@ -8292,7 +8462,7 @@ int fireat(lifeform_t *thrower, object_t *o, cell_t *where, int speed, object_t
//taketime(thrower, SPEED_THROW);
// some obejcts will die when thrown.
if (o->type->id == OT_ASH) {
if (hasflag(o->flags, F_POWDER)) {
if (haslos(player, srcloc)) {
msg("%s disperses into the air.", obname);
}
@ -9018,6 +9188,7 @@ int validateobs(void) {
objecttype_t *ot;
int foundspells = B_FALSE;
int goterror = B_FALSE;
flag_t *f;
for (ot = objecttype ; ot ; ot = ot->next) {
if ((ot->obclass->id == OC_SPELL) || (ot->obclass->id == OC_ABILITY)) {
if (!foundspells) foundspells = B_TRUE;
@ -9050,6 +9221,13 @@ int validateobs(void) {
printf("ERROR in object '%s' - firearms need to have F_RANGE.", ot->name);
goterror = B_TRUE;
}
f = hasflag(ot->flags, F_TECHLEVEL);
if (f && (f->val[0] != PR_INEPT)) {
if (!hasflag(ot->flags, F_HASHIDDENNAME)) {
printf("ERROR in object '%s' - has a techlevel but doesn't have a hidden name.", ot->name);
goterror = B_TRUE;
}
}
}
return goterror;

View File

@ -87,6 +87,7 @@ char *getrandomobwithclass(map_t *map, enum OBCLASS cid, char *buf);
enum SPELLSCHOOL getschool(enum OBTYPE sid);
char *getschoolname(enum SPELLSCHOOL sch);
int getshatterdam(object_t *o);
enum SKILLLEVEL gettechlevel(object_t *o);
int getthrowdam(object_t *o);
int hasedibleob(obpile_t *op);
object_t *hasknownob(obpile_t *op, enum OBTYPE oid);
@ -116,6 +117,7 @@ int isequippedon(object_t *o, enum BODYPART bp);
int isfirearm(object_t *o);
int isflammable(object_t *o);
int isknown(object_t *o);
int isknownot(objecttype_t *ot);
int isidentified(object_t *o);
int isimpassableob(object_t *o, lifeform_t *lf);
int ismetal(enum MATERIAL mat);
@ -160,6 +162,7 @@ int removeob(object_t *o, int howmany);
object_t *relinkob(object_t *src, obpile_t *dst);
void setblessed(object_t *o, enum BLESSTYPE wantbless);
void setinscription(object_t *o, char *text);
void shufflehiddennames(void);
object_t *splitob(object_t *o);
int takedamage(object_t *o, unsigned int howmuch, int damtype);
int fireat(lifeform_t *thrower, object_t *o, cell_t *where, int speed, object_t *firearm);

10
spell.c
View File

@ -244,6 +244,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
}
} else if (abilid == OT_A_SPRINT) {
int howlong;
int slev;
if (lfhasflag(user, F_TIRED)) {
if (isplayer(user)) {
msg("You are too tired to sprint right now.");
@ -256,6 +257,11 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
return B_TRUE;
}
howlong = 5;
// +2 for each athletics skill level
slev = getskill(user, SK_ATHLETICS);
if (slev > PR_INEPT) {
howlong += (2*slev);
}
// modify for constitution
howlong = modifybystat(howlong, user, A_CON);
@ -416,7 +422,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
getobname(o, obname, o->amt);
msgnocap("This seems to be %s!", obname);
} else {
msg("You are not yet sure what this is.");
msg("You cannot determine what this is.");
addflag(user->flags, F_FAILEDINSPECT, o->type->id, NA, NA, NULL);
}
taketime(user, getactspeed(user));
@ -2302,7 +2308,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, lifeform_t *target,
if (!validatespellcell(caster, &targcell,TT_OBJECT | TT_MONSTER, B_FALSE, spellid)) return B_TRUE;
if (haslos(player, targcell)) {
msg("A small spark appears.");
msg("A small spark of flame appears.");
if (seenbyplayer) *seenbyplayer = B_TRUE;
}