- [+] hunter calm animals not working
- [+] when announcing new ability/spell gains, show spell power, and allow override of lower power ones. - [+] make "lessen gravity" also let you hold more. 15kg per power level. - [+] fix broken autoshortcut() - [+] calmanimals now awards gives 25% xp (druids get 50%) - [+] show "tried on xxx]" for scrolls. - [+] char *knowledge_t->triedon - [+] update maketried() - [+] update getobname() - [+] potion of grow/shrink should only be temporary - [+] sizetimer v0 = newsize, v1=timeleft - [+] bug: blessed scroll of id not being destroyed after reading it - [+] option: autopickup_used_missiles - [+] give everyone 1 free object drop/pickup per turn. after that it takes time. - [+] add the option - [+] add f_usedplayermissile to objects before firing them. - [+] if you walk onto an object with f_usedplayermissile - [+] AND autopickup_used_missiles is set - [+] ...then pick it up. - [+] ...and remove the flag.
This commit is contained in:
parent
ee42bdc73f
commit
81d65d35d9
10
data.c
10
data.c
|
@ -505,9 +505,12 @@ void initjobs(void) {
|
|||
addflag(lastjob->flags, F_CANLEARN, SK_LORE_HUMANOID, NA, NA, NULL);
|
||||
addflag(lastjob->flags, F_CANLEARN, SK_LORE_DRAGONS, NA, NA, NULL);
|
||||
// abilities
|
||||
addflag(lastjob->flags, F_CANWILL, OT_S_CALMANIMALS, NA, NA, NULL);
|
||||
addflag(lastjob->flags, F_CANWILL, OT_S_CALMANIMALS, NA, NA, "pw:1;");
|
||||
addflag(lastjob->flags, F_LEVABIL, 3, OT_S_CALMANIMALS, NA, "pw:3;");
|
||||
addflag(lastjob->flags, F_LEVSKILL, 5, SK_LORE_NATURE, NA, NULL);
|
||||
addflag(lastjob->flags, F_LEVABIL, 7, OT_S_CALMANIMALS, NA, "pw:5;");
|
||||
addflag(lastjob->flags, F_LEVSKILL, 10, SK_LORE_NATURE, NA, NULL);
|
||||
addflag(lastjob->flags, F_LEVABIL, 12, OT_S_CALMANIMALS, NA, "pw:7;");
|
||||
addflag(lastjob->flags, F_LEVSKILL, 15, SK_LORE_NATURE, NA, NULL);
|
||||
addflag(lastjob->flags, F_HIRABLE, B_TRUE, NA, NA, NULL);
|
||||
|
||||
|
@ -3301,9 +3304,11 @@ void initobjects(void) {
|
|||
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
|
||||
addflag(lastot->flags, F_VARPOWER, B_TRUE, NA, NA, NULL);
|
||||
// l2
|
||||
addot(OT_S_GRAVLOWER, "lessen gravity", "Causes the caster to fall very slowly.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
|
||||
addot(OT_S_GRAVLOWER, "lessen gravity", "Lessens the weight of the caster's items. Also causes the caster to fall very slowly.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
|
||||
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Each power level will reduce caster's load by 15kg.");
|
||||
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_SPELLLEVEL, 2, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_VARPOWER, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_ONGOING, B_TRUE, NA, NA, NULL);
|
||||
addot(OT_S_WHATGOESUP, "what goes up", "...must come down. Thrown or fired missiles will return to the caster's hands if not destroyed.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
|
||||
addflag(lastot->flags, F_SPELLSCHOOL, SS_GRAVITY, NA, NA, NULL);
|
||||
|
@ -7122,6 +7127,7 @@ void initobjects(void) {
|
|||
void initoptions(void) {
|
||||
addoption(OPT_ALWAYSSHOWTRAILS, "always show trail objects", B_FALSE);
|
||||
addoption(OPT_AUTORELOAD, "automatically reload empty firearms", B_TRUE);
|
||||
addoption(OPT_RETRIEVE_MISSILES, "automatically retrieve used missiles", B_TRUE);
|
||||
addoption(OPT_STOPRUNONNOISE, "stop running if sound heard", B_TRUE);
|
||||
}
|
||||
|
||||
|
|
BIN
data/hiscores.db
BIN
data/hiscores.db
Binary file not shown.
7
defs.h
7
defs.h
|
@ -2225,6 +2225,8 @@ enum FLAG {
|
|||
F_RECHARGEWHENOFF, // get power back when you turn it off
|
||||
F_RECHARGE, // get v0 charges back each turn.
|
||||
F_REFILLWITH, // pour obj id val0 onto this to refill its charges
|
||||
F_PLAYERMISSILE, // this was a missile fired/thrown by the player
|
||||
// used with the 'autopickup used missiles' option.
|
||||
// what can you do with this object?
|
||||
F_TAINTED, // will give food poisoning if you eat/drink it
|
||||
F_PREPARED, // raw meat has been prepared using cooking skill
|
||||
|
@ -2495,6 +2497,7 @@ enum FLAG {
|
|||
// f_armourrating is used for innate armour.
|
||||
// f_arboost is used by objects "of protection" which
|
||||
// enhance your armour rating.
|
||||
F_DONEPICKUP, // lf has used their free pickup/drop for this turn.
|
||||
F_DONEKNOWLEDGETRADE, // you've already traded knowledge with this
|
||||
// person.
|
||||
F_FOLLOWTIME, // v0 = how long will ai chase you for? defaults to
|
||||
|
@ -2551,6 +2554,7 @@ enum FLAG {
|
|||
F_ATTRMOD, // modify attribute val0 by val1. ie. 0=A_STR,1=-3
|
||||
F_ATTRSET, // forces attribute val0 to be val1. ie. 0=A_STR,1=18
|
||||
F_SIZE, // val0 = lf size (enum LFSIZE)
|
||||
F_SIZETIMER, // lf weill resize to LFSIZE val0 in val1 turns.
|
||||
F_USEDPOISON, // this lf used a poisoned weapon to attack
|
||||
F_RANDOMTALKPCT, // v0 = chance of randomly saying something each turn
|
||||
F_RANDOMTALK, // EITHER:
|
||||
|
@ -2947,6 +2951,7 @@ enum FLAG {
|
|||
// (bypasses armour)
|
||||
F_GRAVBOOSTED,// cannot walk or throw stuff
|
||||
F_GRAVLESSENED,// knockback maeks you go further, can jump further
|
||||
// your current load is reduce by v0 * 15kg.
|
||||
F_MEDITATES, // meditates instead of sleeping.
|
||||
F_NEEDSWATER, // cannot survive out of deep water
|
||||
F_PAIN, // take damage if you walk. v0=damtype,text is damage (xdy+z).
|
||||
|
@ -3373,6 +3378,7 @@ typedef struct warning_s {
|
|||
enum OPTION {
|
||||
OPT_ALWAYSSHOWTRAILS,
|
||||
OPT_AUTORELOAD,
|
||||
OPT_RETRIEVE_MISSILES,
|
||||
OPT_STOPRUNONNOISE,
|
||||
};
|
||||
|
||||
|
@ -3832,6 +3838,7 @@ typedef struct knowledge_s {
|
|||
enum OBTYPE id;
|
||||
char *hiddenname;
|
||||
int known;
|
||||
char *triedon;
|
||||
struct knowledge_s *next, *prev;
|
||||
} knowledge_t;
|
||||
|
||||
|
|
45
io.c
45
io.c
|
@ -1347,9 +1347,18 @@ int announceflaggain(lifeform_t *lf, flag_t *f) {
|
|||
ot = findot(f->val[0]);
|
||||
if (ot) {
|
||||
enum SPELLSCHOOL school;
|
||||
char spellname[BUFLEN];
|
||||
int forcepower;
|
||||
|
||||
if (texttospellopts(f->text, "pw:", &forcepower, NULL)) {
|
||||
getspellname(ot->id, lf, spellname, forcepower);
|
||||
} else {
|
||||
getspellname(ot->id, lf, spellname, B_FALSE);
|
||||
}
|
||||
|
||||
school = getspellschoolknown(lf, ot->id);
|
||||
msg("^gYou have learned the %s '%s'%s.",
|
||||
(school == SS_MENTAL) ? "psionic power" : "spell", ot->name,
|
||||
(school == SS_MENTAL) ? "psionic power" : "spell", spellname,
|
||||
getflagsourcetext(f));
|
||||
donesomething = B_TRUE;
|
||||
}
|
||||
|
@ -1361,16 +1370,17 @@ int announceflaggain(lifeform_t *lf, flag_t *f) {
|
|||
ot = findot(f->val[0]);
|
||||
if (ot && (!hasflag(ot->flags, F_NOANNOUNCE))) {
|
||||
char buf[BUFLEN];
|
||||
snprintf(buf, BUFLEN, "^gYou have gained the ability '%s'%s.", ot->name,
|
||||
getflagsourcetext(f));
|
||||
/*
|
||||
if (f->val[2] != NA) {
|
||||
char turnbuf[BUFLEN];
|
||||
snprintf(turnbuf, BUFLEN, " (every %d turn%s)",f->val[2], (f->val[2] == 1) ? "" : "s");
|
||||
strcat(buf, turnbuf);
|
||||
char spellname[BUFLEN];
|
||||
int forcepower;
|
||||
|
||||
if (texttospellopts(f->text, "pw:", &forcepower, NULL)) {
|
||||
getspellname(ot->id, lf, spellname, forcepower);
|
||||
} else {
|
||||
getspellname(ot->id, lf, spellname, B_FALSE);
|
||||
}
|
||||
strcat(buf, ".");
|
||||
*/
|
||||
|
||||
snprintf(buf, BUFLEN, "^gYou have gained the ability '%s'%s.", spellname,
|
||||
getflagsourcetext(f));
|
||||
msg(buf, ot->name); more();
|
||||
donesomething = B_TRUE;
|
||||
}
|
||||
|
@ -6900,7 +6910,7 @@ void makespellchoicelist(prompt_t *pr, lifeform_t *lf, char *ques, char *ques2,
|
|||
addheading(pr, getschoolname(lastschool));
|
||||
}
|
||||
|
||||
getspellname(ot->id, player, buf2);
|
||||
getspellname(ot->id, player, buf2, B_FALSE);
|
||||
if (deactspell[i]) {
|
||||
strcat(buf2, "/deact");
|
||||
}
|
||||
|
@ -8206,7 +8216,14 @@ int drop(object_t *o, int count) {
|
|||
|
||||
if (newob) { // if drop was successful...
|
||||
//taketime(op->owner, (SPEED_DROP * count));
|
||||
taketime(op->owner, SPEED_DROP);
|
||||
|
||||
// you get one free pickup/drop per turn
|
||||
if (lfhasflag(op->owner, F_DONEPICKUP)) {
|
||||
taketime(op->owner, SPEED_DROP);
|
||||
} else {
|
||||
addflag(op->owner->flags, F_DONEPICKUP, B_TRUE, NA, NA, NULL);
|
||||
}
|
||||
|
||||
// if object wasn't changed...
|
||||
/*
|
||||
if (newob->type->id == origid) {
|
||||
|
@ -11325,7 +11342,7 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
}
|
||||
}
|
||||
|
||||
getspellname(ot->id, lf, spellname);
|
||||
getspellname(ot->id, lf, spellname, B_FALSE);
|
||||
if (castable) setcol(mainwin, C_GREEN);
|
||||
else setcol(mainwin, C_RED);
|
||||
snprintf(buf, BUFLEN, " %-4d%-26s%-15s%-13s%s",thislev, spellname, getschoolnameshort(getspellschoolknown(lf, ot->id)), powerbuf, mpbuf);
|
||||
|
@ -11952,7 +11969,7 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
}
|
||||
f = lfhasflag(lf, F_GRAVLESSENED);
|
||||
if (f && (f->known)) {
|
||||
mvwprintw(mainwin, y, 0, "Gravity is lessened around %s, preventing fall damage and increasing flight speed.", you_l(lf));
|
||||
mvwprintw(mainwin, y, 0, "Gravity is lessened around %s, preventing fall damage, increasing flight speed and reducing load.", you_l(lf));
|
||||
y++;
|
||||
}
|
||||
f = lfhasknownflag(lf, F_INVULNERABLE);
|
||||
|
|
76
lf.c
76
lf.c
|
@ -3925,7 +3925,22 @@ void enhanceskills(lifeform_t *lf) {
|
|||
f = levelabilityready(lf);
|
||||
while (f) {
|
||||
if (f->id == F_LEVABIL) {
|
||||
addtempflag(lf->flags, F_CANWILL, f->val[1], f->val[2], f->val[2], f->text, FROMJOB);
|
||||
flag_t *abilflag[MAXCANDIDATES],*thisabil;
|
||||
int nabilflags = 0;
|
||||
int origborn,i;
|
||||
thisabil = addtempflag(lf->flags, F_CANWILL, f->val[1], f->val[2], f->val[2], f->text, FROMJOB);
|
||||
origborn = lf->born;
|
||||
// already had this power with different options?
|
||||
getflags(lf->flags, abilflag, &nabilflags, F_CANWILL, F_NONE);
|
||||
for (i = 0;i < nabilflags; i++) {
|
||||
if (abilflag[i] == thisabil) continue;
|
||||
if ((abilflag[i]->val[0] == f->val[1]) && (abilflag[i]->lifetime == FROMJOB)) {
|
||||
lf->born = B_FALSE; // stop flag loss from being announced
|
||||
killflag(f);
|
||||
lf->born = origborn;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (f->id == F_LEVFLAG) {
|
||||
addtempflag(lf->flags, f->val[1], f->val[2], NA, NA, f->text, FROMJOB);
|
||||
} else if (f->id == F_LEVSKILL) {
|
||||
|
@ -12129,7 +12144,7 @@ void autoshortcut(lifeform_t *lf, enum OBTYPE spellid) {
|
|||
ot = findot(spellid);
|
||||
if (ot) {
|
||||
// set to lowest possible shortcut
|
||||
getflags(lf->flags, retflag, &nretflags, F_CANCAST, F_CANWILL, F_NONE);
|
||||
getflags(lf->flags, retflag, &nretflags, F_SHORTCUT, F_NONE);
|
||||
for (i = 0; i < nretflags; i++) {
|
||||
if (retflag[i]->val[0] > min) {
|
||||
min = retflag[i]->val[0];
|
||||
|
@ -13891,7 +13906,7 @@ int pickup(lifeform_t *lf, object_t *what, int howmany, int fromground, int want
|
|||
if (fromground) {
|
||||
if (lfhasflag(lf, F_LEVITATING)) {
|
||||
if (isplayer(lf)) {
|
||||
msg("You can't reach the ground from up here!");
|
||||
msg("You can't reach %s from up here!", obname);
|
||||
}
|
||||
return B_TRUE;
|
||||
}
|
||||
|
@ -13955,8 +13970,6 @@ int pickup(lifeform_t *lf, object_t *what, int howmany, int fromground, int want
|
|||
}
|
||||
}
|
||||
|
||||
// special case
|
||||
|
||||
if (!failed) {
|
||||
// try to move whatever was selected
|
||||
o = moveob(what, lf->pack, howmany);
|
||||
|
@ -13972,9 +13985,13 @@ int pickup(lifeform_t *lf, object_t *what, int howmany, int fromground, int want
|
|||
msg("%s picks up %s.",buf, obname);
|
||||
}
|
||||
}
|
||||
taketime(lf, SPEED_PICKUP);
|
||||
|
||||
// TODO: update burdened status
|
||||
// you get one free pickup/drop per turn
|
||||
if (lfhasflag(lf, F_DONEPICKUP)) {
|
||||
taketime(lf, SPEED_PICKUP);
|
||||
} else {
|
||||
addflag(lf->flags, F_DONEPICKUP, B_TRUE, NA, NA, NULL);
|
||||
}
|
||||
} else {
|
||||
// tell the player why!
|
||||
if (isplayer(lf)) {
|
||||
|
@ -17183,7 +17200,7 @@ void startlfturn(lifeform_t *lf) {
|
|||
// effects for/on your own flags
|
||||
getflags(lf->flags, retflag, &nretflags, F_ATTACHEDTO, F_CANWILL, F_CHARMEDBY, F_CLIMBING, F_FEIGNFOOLEDBY,F_FLEEFROM,
|
||||
F_GRABBEDBY, F_GRABBING, F_HIDING, F_BOOSTSPELL, F_FEIGNINGDEATH, F_HPDRAIN, F_INJURY,
|
||||
F_NOFLEEFROM, F_PETOF, F_SPOTTED, F_STABBEDBY, F_STRIKETOKO, F_TARGETCELL, F_TARGETLF, F_NONE);
|
||||
F_NOFLEEFROM, F_PETOF, F_SIZETIMER, F_SPOTTED, F_STABBEDBY, F_STRIKETOKO, F_TARGETCELL, F_TARGETLF, F_NONE);
|
||||
for (i = 0; i < nretflags; i++) {
|
||||
f = retflag[i];
|
||||
// remove impossible flags
|
||||
|
@ -17248,6 +17265,15 @@ void startlfturn(lifeform_t *lf) {
|
|||
if (arm && !hasobmod(arm, findobmod(OM_BLOODSTAINED)) && pctchance(5)) applyobmod(arm, findobmod(OM_BLOODSTAINED));
|
||||
}
|
||||
|
||||
if (f->id == F_SIZETIMER) {
|
||||
f->val[1]--;
|
||||
if (f->val[1] <= 0) {
|
||||
resizelf(lf, f->val[0]);
|
||||
killflag(f);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (f->id == F_STABBEDBY) {
|
||||
lifeform_t *lf2;
|
||||
lf2 = findlf(NULL, f->val[0]);
|
||||
|
@ -18855,18 +18881,19 @@ int validateraces(void) {
|
|||
// returns TRUE on error
|
||||
int resizelf(lifeform_t *lf, enum LFSIZE newsize) {
|
||||
flag_t *f;
|
||||
enum LFSIZE origsize;
|
||||
enum LFSIZE origsize,racesize = SZ_ANY;
|
||||
int changedir;
|
||||
char lfname[BUFLEN];
|
||||
object_t *o,*nexto;
|
||||
getlfname(lf, lfname);
|
||||
f = hasflag(lf->flags, F_SIZE);
|
||||
|
||||
f = hasflag(lf->race->flags, F_SIZE);
|
||||
if (f) {
|
||||
origsize = f->val[0];
|
||||
} else {
|
||||
origsize = SZ_HUMAN; // default
|
||||
racesize = f->val[0];
|
||||
}
|
||||
|
||||
origsize = getlfsize(lf);
|
||||
|
||||
if (origsize == newsize) {
|
||||
return B_TRUE;
|
||||
} else if (newsize > origsize) {
|
||||
|
@ -18875,6 +18902,8 @@ int resizelf(lifeform_t *lf, enum LFSIZE newsize) {
|
|||
changedir = -1;
|
||||
}
|
||||
|
||||
// actually do the resize
|
||||
f = lfhasflag(lf, F_SIZE);
|
||||
if (f) {
|
||||
f->val[0] = newsize;
|
||||
} else {
|
||||
|
@ -18882,10 +18911,18 @@ int resizelf(lifeform_t *lf, enum LFSIZE newsize) {
|
|||
}
|
||||
|
||||
// announce
|
||||
if (isplayer(lf)) {
|
||||
msg("Your body %s unnaturally!", (changedir == 1) ? "grows" : "shrinks");
|
||||
} else if (cansee(player, lf)) {
|
||||
msg("%s %s unnaturally!", lfname, (changedir == 1) ? "grows" : "shrinks");
|
||||
if (racesize == newsize) {
|
||||
if (isplayer(lf)) {
|
||||
msg("Your body returns to its regular size."); more();
|
||||
} else if (cansee(player, lf)) {
|
||||
msg("%s returns to its regular size.", lfname);
|
||||
}
|
||||
} else {
|
||||
if (isplayer(lf)) {
|
||||
msg("Your body %s unnaturally!", (changedir == 1) ? "grows" : "shrinks"); more();
|
||||
} else if (cansee(player, lf)) {
|
||||
msg("%s %s unnaturally!", lfname, (changedir == 1) ? "grows" : "shrinks");
|
||||
}
|
||||
}
|
||||
|
||||
// effects on objects, armour etc
|
||||
|
@ -19414,7 +19451,8 @@ int wear(lifeform_t *lf, object_t *o) {
|
|||
}
|
||||
taketime(lf, getactspeed(lf));
|
||||
|
||||
if (isplayer(lf)) maketried(o->type->id);
|
||||
|
||||
if (isplayer(lf)) maketried(o->type->id, NULL);
|
||||
|
||||
// when you wear armour, you find out
|
||||
// its bonuses.
|
||||
|
@ -19744,7 +19782,7 @@ int weild(lifeform_t *lf, object_t *o) {
|
|||
|
||||
taketime(lf, getactspeed(lf));
|
||||
|
||||
if (isplayer(lf) && isweapon(o)) maketried(o->type->id);
|
||||
if (isplayer(lf) && isweapon(o)) maketried(o->type->id, NULL);
|
||||
|
||||
if ((gamemode == GM_GAMESTARTED) && lf->created && (lf->race->id != R_DANCINGWEAPON)) {
|
||||
if (isplayer(lf)) {
|
||||
|
|
13
move.c
13
move.c
|
@ -2844,6 +2844,19 @@ int trymove(lifeform_t *lf, int dir, int onpurpose, int strafe) {
|
|||
} else if (isclimbing(lf)) {
|
||||
practice(lf, SK_CLIMBING, 1);
|
||||
}
|
||||
|
||||
// autopickup objects?
|
||||
if (isplayer(lf) && getoption(OPT_RETRIEVE_MISSILES) && !lfhasflag(lf, F_LEVITATING)) {
|
||||
object_t *o,*nexto;
|
||||
for (o = lf->cell->obpile->first ; o ; o = nexto) {
|
||||
nexto = o->next;
|
||||
if (hasflag(o->flags, F_PLAYERMISSILE) && canpickup(lf, o, o->amt)) {
|
||||
killflagsofid(o->flags, F_PLAYERMISSILE);
|
||||
pickup(lf, o, o->amt, B_TRUE, B_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else { // ie !moveok
|
||||
object_t *inway = NULL;
|
||||
int door, dooropen;
|
||||
|
|
76
objects.c
76
objects.c
|
@ -352,6 +352,7 @@ knowledge_t *addknowledge(enum OBCLASS id, char *hiddenname, int known) {
|
|||
a->id = id;
|
||||
a->hiddenname = strdup(hiddenname);
|
||||
a->known = known;
|
||||
a->triedon = NULL;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
@ -5303,6 +5304,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
|
|||
|
||||
// show if we've tried this
|
||||
if (gamemode == GM_GAMESTARTED) {
|
||||
knowledge_t *k;
|
||||
strcpy(triedbuf, "");
|
||||
|
||||
if (hasflag(o->flags, F_BEINGUSED)) {
|
||||
|
@ -5311,10 +5313,13 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
|
|||
strcat(triedbuf, "currently being read");
|
||||
}
|
||||
|
||||
if (istried(o)) {
|
||||
flag_t *f2;
|
||||
k = istried(o);
|
||||
if (k) {
|
||||
//flag_t *f2;
|
||||
if (strlen(triedbuf)) strcat(triedbuf, ", ");
|
||||
else strcpy(triedbuf, " [");
|
||||
|
||||
/*
|
||||
f2 = hasflag(o->flags, F_SCROLLNEEDSOB);
|
||||
if (f2) {
|
||||
if ((f2->val[0] == B_IFNOTBLESSED) && !isblessed(o)) {
|
||||
|
@ -5325,6 +5330,13 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
|
|||
} else {
|
||||
strcat(triedbuf, "tried");
|
||||
}
|
||||
*/
|
||||
if (k->triedon) {
|
||||
strcat(triedbuf, "tried on ");
|
||||
strcat(triedbuf, k->triedon);
|
||||
} else {
|
||||
strcat(triedbuf, "tried");
|
||||
}
|
||||
}
|
||||
if (!isknown(o)) {
|
||||
if (lfhasflagval(player, F_FAILEDINSPECT, o->type->id, NA, NA, NULL)) {
|
||||
|
@ -5410,6 +5422,15 @@ float getobpileweight(obpile_t *op) {
|
|||
for (o = op->first ; o ; o = o->next) {
|
||||
weight += getobweight(o);
|
||||
}
|
||||
|
||||
if (op->owner) {
|
||||
flag_t *f;
|
||||
f = lfhasflag(op->owner, F_GRAVLESSENED);
|
||||
if (f) {
|
||||
weight -= (15 * f->val[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return weight;
|
||||
}
|
||||
|
||||
|
@ -6944,7 +6965,7 @@ int isthrowmissile(object_t *o) {
|
|||
}
|
||||
|
||||
// shoudl we append {tried} to this object?
|
||||
int istried(object_t *o) {
|
||||
knowledge_t *istried(object_t *o) {
|
||||
if (hasflag(o->flags, F_IDENTIFIED)) {
|
||||
return B_FALSE;
|
||||
}
|
||||
|
@ -6952,7 +6973,7 @@ int istried(object_t *o) {
|
|||
return istriedot(o->type);
|
||||
}
|
||||
|
||||
int istriedot(objecttype_t *ot) {
|
||||
knowledge_t *istriedot(objecttype_t *ot) {
|
||||
knowledge_t *k;
|
||||
|
||||
if (ot->obclass->id == OC_BOOK) return B_FALSE;
|
||||
|
@ -6962,16 +6983,16 @@ int istriedot(objecttype_t *ot) {
|
|||
// it DOES have a hidden name.
|
||||
// has the player tried it?
|
||||
if (k->known == B_TRIED) {
|
||||
return B_TRUE;
|
||||
return k;
|
||||
} else {
|
||||
return B_FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// no hidden name, so can't be "tried"
|
||||
return B_FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int isoperable(object_t *o) {
|
||||
|
@ -7179,6 +7200,7 @@ void killknowledge(knowledge_t *k) {
|
|||
|
||||
// free mem
|
||||
if (k->hiddenname) free(k->hiddenname);
|
||||
if (k->triedon) free(k->triedon);
|
||||
|
||||
// remove from list
|
||||
nextone = k->next;
|
||||
|
@ -7588,7 +7610,7 @@ void makeknown(enum OBTYPE otid) {
|
|||
}
|
||||
}
|
||||
|
||||
void maketried(enum OBTYPE otid) {
|
||||
void maketried(enum OBTYPE otid, char *triedon) {
|
||||
knowledge_t *k;
|
||||
objecttype_t *ot;
|
||||
|
||||
|
@ -7600,8 +7622,12 @@ void maketried(enum OBTYPE otid) {
|
|||
|
||||
for (k = knowledge; k ; k = k->next) {
|
||||
if (k->id == otid) {
|
||||
// test for B_TRIED too since we might be updating the text.
|
||||
if (k->known == B_UNKNOWN) {
|
||||
k->known = B_TRIED;
|
||||
if (triedon) {
|
||||
k->triedon = strdup(triedon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8605,7 +8631,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
|
|||
}
|
||||
|
||||
// mark obejct as tried
|
||||
if (isplayer(lf)) maketried(o->type->id);
|
||||
if (isplayer(lf)) maketried(o->type->id, NULL);
|
||||
|
||||
// trapped?
|
||||
if (doobtraps(o, lf)) {
|
||||
|
@ -9646,7 +9672,7 @@ void quaff(lifeform_t *lf, object_t *o) {
|
|||
realobid = o->type->id;
|
||||
}
|
||||
|
||||
if (isplayer(lf)) maketried(realobid);
|
||||
if (isplayer(lf)) maketried(realobid, NULL);
|
||||
|
||||
if (touch(lf, o)) {
|
||||
return;
|
||||
|
@ -9974,11 +10000,14 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE
|
|||
dospelleffects(lf, OT_S_GASEOUSFORM, (potblessed) ? 5 : 1, lf, NULL, lf->cell, potblessed, seen, B_TRUE);
|
||||
break;
|
||||
case OT_POT_GROWTH:
|
||||
i = getlfsize(lf);
|
||||
if (iscursed(o)) {
|
||||
dospelleffects(lf, OT_S_SIZEDOWN, 1, lf, NULL, lf->cell, B_UNCURSED, seen, B_TRUE);
|
||||
} else {
|
||||
dospelleffects(lf, OT_S_SIZEUP, 1, lf, NULL, lf->cell, B_UNCURSED, seen, B_TRUE);
|
||||
}
|
||||
// revert in a little while...
|
||||
addflag(lf->flags, F_SIZETIMER, i, rnd(10,20), NA, NULL);
|
||||
break;
|
||||
case OT_POT_HEALING:
|
||||
dospelleffects(lf, OT_S_HEALING,potblessed ? 5 : 1, lf, NULL, lf->cell, potblessed, seen, B_TRUE);
|
||||
|
@ -10258,7 +10287,7 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE
|
|||
|
||||
int readsomething(lifeform_t *lf, object_t *o) {
|
||||
flag_t *f;
|
||||
char buf[BUFLEN],obname[BUFLEN];
|
||||
char buf[BUFLEN],obname[BUFLEN],triedonbuf[BUFLEN];
|
||||
int playercansee;
|
||||
int willid = B_FALSE;
|
||||
int needsob = B_FALSE;
|
||||
|
@ -10279,6 +10308,7 @@ int readsomething(lifeform_t *lf, object_t *o) {
|
|||
return B_TRUE;
|
||||
}
|
||||
|
||||
strcpy(triedonbuf, "");
|
||||
|
||||
getobname(o, obname, 1);
|
||||
|
||||
|
@ -10300,8 +10330,6 @@ int readsomething(lifeform_t *lf, object_t *o) {
|
|||
|
||||
taketime(lf, readtime);
|
||||
|
||||
if (isplayer(lf)) maketried(o->type->id);
|
||||
|
||||
// some checks first...
|
||||
if (touch(lf, o)) {
|
||||
return B_TRUE;
|
||||
|
@ -10416,6 +10444,9 @@ int readsomething(lifeform_t *lf, object_t *o) {
|
|||
if (seen) {
|
||||
makeknown(o->type->id); o->blessknown = B_TRUE;
|
||||
}
|
||||
|
||||
if (isplayer(lf)) msg("The scroll crumbles to dust.");
|
||||
removeob(o, 1);
|
||||
} else if ((o->type->id == OT_SCR_MENDING) && isblessed(o)) {
|
||||
int seen = B_FALSE;
|
||||
object_t *oo;
|
||||
|
@ -10453,7 +10484,12 @@ int readsomething(lifeform_t *lf, object_t *o) {
|
|||
f2 = addflag(o->flags, F_BEINGUSED, B_TRUE, NA, NA, NULL);
|
||||
targob = askobject(lf->pack, "Target which object", NULL, '\0', AO_NONE);
|
||||
killflag(f2);
|
||||
if (!targob) {
|
||||
if (targob) {
|
||||
if (isplayer(lf)) {
|
||||
// this will be used by maketried() later
|
||||
real_getobname(targob, triedonbuf, 1, B_FALSE, B_FALSE, B_TRUE, B_FALSE, B_FALSE);
|
||||
}
|
||||
} else {
|
||||
noeffect = B_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -10729,6 +10765,7 @@ int readsomething(lifeform_t *lf, object_t *o) {
|
|||
|
||||
if (!slev) {
|
||||
if (isplayer(lf)) msg("You cannot comprehend the contents of this book.");
|
||||
maketried(o->type->id, NULL);
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
|
@ -10762,6 +10799,7 @@ int readsomething(lifeform_t *lf, object_t *o) {
|
|||
addchoice(&prompt, '-', "none", NULL, NULL, NULL);
|
||||
if (prompt.nchoices == 1) {
|
||||
msg("You already know all the spells in this book!");
|
||||
maketried(o->type->id, NULL);
|
||||
return B_FALSE;
|
||||
}
|
||||
prompt.maycancel = B_TRUE;
|
||||
|
@ -10769,6 +10807,7 @@ int readsomething(lifeform_t *lf, object_t *o) {
|
|||
if ((ch == '\0') || (ch == '-')) {
|
||||
// not 'cancelled' because we still took time
|
||||
msg("You close the spellbook without reading it.");
|
||||
maketried(o->type->id, NULL);
|
||||
return B_FALSE;
|
||||
}
|
||||
linkspell = (objecttype_t *) prompt.result;
|
||||
|
@ -10806,6 +10845,11 @@ int readsomething(lifeform_t *lf, object_t *o) {
|
|||
pleasegodmaybe(R_GODMAGIC, 2);
|
||||
}
|
||||
|
||||
if (strlen(triedonbuf)) {
|
||||
maketried(o->type->id, triedonbuf);
|
||||
} else {
|
||||
maketried(o->type->id, NULL);
|
||||
}
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
|
@ -11856,6 +11900,10 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp
|
|||
}
|
||||
}
|
||||
|
||||
if (thrower && isplayer(thrower)) {
|
||||
addflag(o->flags, F_PLAYERMISSILE, B_TRUE, NA, NA, NULL);
|
||||
}
|
||||
|
||||
// announce it ("xx throws xx" "at yy")
|
||||
if (announcethrow) {
|
||||
if (thrower && isplayer(thrower)) {
|
||||
|
|
|
@ -206,8 +206,8 @@ flag_t *issecretdoor(object_t *o);
|
|||
flag_t *isshield(object_t *o);
|
||||
int issmellableob(object_t *o);
|
||||
int isthrownmissile(object_t *o);
|
||||
int istried(object_t *o);
|
||||
int istriedot(objecttype_t *ot);
|
||||
knowledge_t *istried(object_t *o);
|
||||
knowledge_t *istriedot(objecttype_t *ot);
|
||||
int isweapon(object_t *o);
|
||||
int iswearable(object_t *o);
|
||||
void killallobs(obpile_t *op);
|
||||
|
@ -228,7 +228,7 @@ int knockbackob(object_t *o, int dir, int howfar, int power, lifeform_t *pusher)
|
|||
lifeform_t *makeanimated(lifeform_t *lf, object_t *o, int level);
|
||||
int makeduller(object_t *o, int howmuch);
|
||||
void makeknown(enum OBTYPE otid);
|
||||
void maketried(enum OBTYPE otid);
|
||||
void maketried(enum OBTYPE otid, char *triedon);
|
||||
void makewet(object_t *o, int amt);
|
||||
object_t *moveob(object_t *src, obpile_t *dst, int howmany);
|
||||
object_t *real_moveob(object_t *src, obpile_t *dst, int howmany, int stackok);
|
||||
|
|
21
spell.c
21
spell.c
|
@ -4252,11 +4252,16 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
|
||||
ncalmed++;
|
||||
|
||||
// druids get 25% of the monster's XP value for calming it.
|
||||
if (hasjob(caster, J_DRUID)) {
|
||||
if (getallegiance(caster) == AL_FRIENDLY) {
|
||||
// druids get 50% of the monster's XP value for calming it.
|
||||
// everyone else gets 25%.
|
||||
if (getallegiance(caster) == AL_FRIENDLY) {
|
||||
if (hasjob(caster, J_DRUID)) {
|
||||
awardxpfor(c->lf, 50);
|
||||
} else {
|
||||
awardxpfor(c->lf, 25);
|
||||
}
|
||||
// prevent attacking it and getting xp again.
|
||||
addflag(c->lf->flags, F_XPVAL, 0, NA, NA, NULL);
|
||||
}
|
||||
|
||||
if (cansee(player, c->lf)) {
|
||||
|
@ -8243,7 +8248,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
|
||||
f = addtempflag(caster->flags, F_DTIMMUNE, DT_FALL, NA, NA, NULL, FROMSPELL);
|
||||
f->obfrom = spellid;
|
||||
f = addtempflag(caster->flags, F_GRAVLESSENED, B_TRUE, NA, NA, NULL, FROMSPELL);
|
||||
f = addtempflag(caster->flags, F_GRAVLESSENED, power, NA, NA, NULL, FROMSPELL);
|
||||
f->obfrom = spellid;
|
||||
} else if (spellid == OT_S_GUSTOFWIND) {
|
||||
obpile_t *op;
|
||||
|
@ -11123,14 +11128,18 @@ int getspellmaxpower(enum OBTYPE spellid) {
|
|||
return max;
|
||||
}
|
||||
|
||||
char *getspellname(enum OBTYPE spellid, lifeform_t *lf, char *buf) {
|
||||
char *getspellname(enum OBTYPE spellid, lifeform_t *lf, char *buf, int forcepower) {
|
||||
int power;
|
||||
enum SPELLSCHOOL ss;
|
||||
objecttype_t *ot;
|
||||
ot = findot(spellid);
|
||||
strcpy(buf, ot->name);
|
||||
capitalise(buf);
|
||||
power = getspellpower(lf, spellid);
|
||||
if (forcepower) {
|
||||
power = forcepower;
|
||||
} else {
|
||||
power = getspellpower(lf, spellid);
|
||||
}
|
||||
ss = getspellschool(spellid);
|
||||
|
||||
if ((power > 1) && (ss != SS_ABILITY)) {
|
||||
|
|
2
spell.h
2
spell.h
|
@ -21,7 +21,7 @@ char *getspellcosttext(lifeform_t *lf, enum OBTYPE spellid, int power, char *buf
|
|||
int getspellduration(int min,int max,int blessed);
|
||||
int getspelllevel(enum OBTYPE spellid);
|
||||
int getspellmaxpower(enum OBTYPE spellid);
|
||||
char *getspellname(enum OBTYPE spellid, lifeform_t *lf, char *buf);
|
||||
char *getspellname(enum OBTYPE spellid, lifeform_t *lf, char *buf, int forcepower);
|
||||
int getspellpower(lifeform_t *lf, enum OBTYPE spellid);
|
||||
enum SPELLSCHOOL getspellschool(enum OBTYPE spellid);
|
||||
enum SPELLSCHOOL getspellschoolknown(lifeform_t *lf, enum OBTYPE spellid);
|
||||
|
|
Loading…
Reference in New Issue