- [+] when you 'look' on purpose, you should see cosmetic things.

* [+] CRASH in noise() when you swap with your pet!
- [+] if a goblin dodges, you shouldn't get any more attacks.
- [+] armour skill makes armour sustain less damage?
- [+] make orks have higher level tech
- [+] prone on botl (if not asleep/resting) in yellow
- [+] shields not being listed in 'T'akeoff
* [+] why doesn't stickstosnakes show up afetr i read a book?
* [+] why does 'sprint' count as a 'divine power' ???
This commit is contained in:
Rob Pearce 2011-05-06 00:34:42 +00:00
parent 810ab99662
commit bfb7b12b46
9 changed files with 76 additions and 56 deletions

View File

@ -48,8 +48,21 @@ int applyarmourdamage(lifeform_t *lf, object_t *wep, int dam, enum DAMTYPE damty
// ALL of damage reduction goes towards armour
actualdam = dam;
} else {
// half the damage reduction goes towards armour
actualdam = (dam / 2);
switch (getskill(lf, SK_ARMOUR)) {
default:
case PR_INEPT:
actualdam = dam;
break;
case PR_NOVICE: actualdam = pctof(90, dam); break;
case PR_BEGINNER: actualdam = pctof(80, dam); break;
case PR_ADEPT: actualdam = pctof(70, dam); break;
case PR_SKILLED: actualdam = pctof(60, dam); break;
case PR_EXPERT: actualdam = pctof(50, dam); break;
case PR_MASTER: actualdam = pctof(40, dam); break;
}
if (actualdam > 0) {
limit(&dam, 1, NA);
}
}
// modify for rust

2
defs.h
View File

@ -1620,6 +1620,8 @@ enum FLAG {
F_STARTSKILL, // val0 = skill id
F_STARTOBDT, // val0 = %chance of starting with damtype val1
F_STARTOBCLASS, // val0 = %chance of starting with obclass val1
// option val2 = addition to map depth for rarity
// calculation
F_STARTJOB, // val0 = %chance of starting with it, v1 = jobid
F_STARTATT, // val0 = A_xxx, val0 = start bracket (ie. IQ_GENIUS)
F_STARTHIDDENPCT, // val0 = pct chance auto-generated monster will

27
io.c
View File

@ -3717,7 +3717,7 @@ void doknowledgelist(void) {
drawscreen();
}
void dolook(cell_t *where) {
void dolook(cell_t *where, int onpurpose) {
int numobs;
char buf[BUFLEN];
char seeverb[BUFLEN];
@ -3737,7 +3737,7 @@ void dolook(cell_t *where) {
interrupt(player);
seensomething = B_TRUE;
} else {
if (!hasflag(o->flags, F_COSMETIC)) {
if (onpurpose || !hasflag(o->flags, F_COSMETIC)) {
if (!numobs) firstob = o;
numobs++;
}
@ -3823,7 +3823,7 @@ void makespellchoicelist(prompt_t *pr, lifeform_t *lf, char *ques, char *ques2,
// get list of spells/abilities we can cast at will
for (ot = objecttype ; ot ; ot = ot->next) {
if ((ot->obclass->id == OC_SPELL) || (ot->obclass->id == OC_ABILITY)) {
// doesn't match the current level?
// matches the current level?
if (getspelllevel(ot->id) == lev) {
f = lfhasflagval(lf, F_CANWILL, ot->id, NA, NA, NULL);
if (!wantunknown && f) {
@ -3898,9 +3898,9 @@ void makespellchoicelist(prompt_t *pr, lifeform_t *lf, char *ques, char *ques2,
}
}
}
}
}
}
} // end if is_a_spell and level_matches
} // end forech ob type
} // end if we can cast spells
} // end foreach spell level
} // end foreach spell school
@ -3946,14 +3946,7 @@ void makespellchoicelist(prompt_t *pr, lifeform_t *lf, char *ques, char *ques2,
strcat(costbuf, mpdesc[i]);
sprintf(buf, "%-30s%s", buf2, costbuf);
// we don't want spell letters to change
// every time you get a new spell, so the
// choice letter always comes from spell letter
/*
f = hasflag(ot->flags, F_SPELLLETTER);
assert(f);
*/
// letter doesn't matter
addchoice(pr, 'a', buf2, buf, ot);
}
@ -5528,7 +5521,7 @@ void handleinput(void) {
showlfarmour(player);
break;
case ':': // look at what's here
dolook(player->cell);
dolook(player->cell, B_TRUE);
break;
case '|': // msg history - TODO: replace with ctrl-p
domsghist();
@ -5944,6 +5937,12 @@ void drawstatus(void) {
}
}
if (isprone(player) && !lfhasflag(player, F_ASLEEP)) {
setcol(statwin, C_YELLOW);
wprintw(statwin, " Prone");
unsetcol(statwin, C_YELLOW);
}
// burdened somehow?
switch (isburdened(player)) {
case BR_BURDENED:

2
io.h
View File

@ -42,7 +42,7 @@ void dofire(void);
void dohelp(void);
void doinventory(obpile_t *op);
void doknowledgelist(void);
void dolook(cell_t *where);
void dolook(cell_t *where, int onpurpose);
void domagic(enum OBTYPE spellid, int cellx, int celly);
void domemmagic(void);
void domsghist(void);

37
lf.c
View File

@ -525,6 +525,9 @@ int canhear(lifeform_t *lf, cell_t *dest) {
// can't hear if you are deaf
if (lfhasflag(lf, F_DEAF)) return B_FALSE;
// can't hear when training
if (lfhasflag(lf, F_TRAINING)) return B_FALSE;
// can't hear noises from other maps
if (lf->cell->map != dest->map) return B_FALSE;
@ -4687,24 +4690,7 @@ void givejob(lifeform_t *lf, enum JOB jobid) {
if (db) dblog("... ignoring next.");
ignorenext = B_TRUE;
}
//
} else {
//if (db) dblog("processing normal flag: %d",f->id);
/*
switch (f->id) {
case F_STARTOB:
case F_STARTOBDT:
case F_STARTOBCLASS:
break;
default:
addflag_real(lf->flags, f->id, f->val[0], f->val[1], f->val[2], f->text, FROMJOB,B_TRUE, -1);
if (f->id == F_STARTSTR) rollatt[A_STR] = B_TRUE;
if (f->id == F_STARTDEX) rollatt[A_DEX] = B_TRUE;
if (f->id == F_STARTIQ) rollatt[A_IQ] = B_TRUE;
break;
}
*/
addflag_real(lf->flags, f->id, f->val[0], f->val[1], f->val[2], f->text, FROMJOB,B_TRUE, -1);
if (f->id == F_STARTATT) {
rollatt[f->val[0]] = B_TRUE;
@ -5073,7 +5059,7 @@ void givestartobs(lifeform_t *lf, flagpile_t *fp) {
}
} else if (f->id == F_STARTOBCLASS) {
if (rnd(1,100) <= f->val[0]) {
while (!getrandomobwithclass(lf->cell->map, f->val[1], buf));
while (!getrandomobwithclass(lf->cell->map, f->val[1], buf, f->val[2]));
//if (strlen(buf) <= 0);
o = addob(lf->pack, buf);
}
@ -5709,6 +5695,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_STARTSKILL, SK_SS_DIVINATION, PR_MASTER, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_MENTAL, PR_MASTER, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_SUMMONING, PR_MASTER, NA, NULL);
addflag(lastjob->flags, F_HASPET, NA, NA, NA, "young wolf");
for (i = 1; i < MAXSKILLS; i++) {
addflag(lastjob->flags, F_CANLEARN, i, NA, NA, NULL);
}
@ -5717,10 +5704,9 @@ void initjobs(void) {
if ((i == SS_ABILITY) || (i == SS_DIVINE)) {
mayusespellschool(lastjob->flags, i, F_CANWILL);
} else {
mayusespellschool(lastjob->flags, i, F_CANCAST);
// mayusespellschool(lastjob->flags, i, F_CANCAST);
}
}
addflag(lastjob->flags, F_HASPET, NA, NA, NA, "young wolf");
addjob(J_ADVENTURER, "Adventurer");
addflag(lastjob->flags, F_STARTATT, A_STR, ST_AVERAGE, NA, NULL);
@ -5740,6 +5726,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_STARTSKILL, SK_ARMOUR, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_LORE_HUMANOID, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_LORE_UNDEAD, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "spellbook of flame dart");
for (i = 1; i < MAXSKILLS; i++) {
addflag(lastjob->flags, F_CANLEARN, i, NA, NA, NULL);
}
@ -6831,7 +6818,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "football helmet");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-25 gold coins");
addflag(lastrace->flags, F_STARTOBCLASS, 50, OC_POTION, NA, NULL);
addflag(lastrace->flags, F_STARTOBCLASS, 50, OC_TECH, NA, NULL);
addflag(lastrace->flags, F_STARTOBCLASS, 50, OC_TECH, 10, NULL);
addflag(lastrace->flags, F_WANTS, OT_GOLD, NA, NA, NULL);
addflag(lastrace->flags, F_WANTSOBFLAG, F_OPERABLE, B_COVETS, NA, NULL); // ie. tech
addflag(lastrace->flags, F_WANTSBETTERWEP, B_TRUE, B_COVETS, NA, NULL);
@ -9474,7 +9461,9 @@ void noise(cell_t *c, lifeform_t *noisemaker, char *text, char *seetext) {
lifeform_t *l;
// if anything nearby hears it, it might respond
for (l = c->map->lf; l ; l = l->next) {
if (l != noisemaker) {
// if you make a noise while swapping position with
// something, its ->cell will be null here!
if ((l != noisemaker) && (l->cell)) {
int difficulty;
//if (canhear(l, c) && haslos(l, c)) {
@ -10569,7 +10558,7 @@ void setlastdam(lifeform_t *lf, char *buf) {
}
void initskills(void) {
addskill(SK_ARMOUR, "Armour", "Reduces your evasion penalty for wearing armour.");
addskill(SK_ARMOUR, "Armour", "Helps maintain armour, reducing evasion penalties and armour damage.");
addskill(SK_ATHLETICS, "Athletics", "Assists with sprinting and exhaustion recovery.");
addskill(SK_BACKSTAB, "Backstab", "Lets you inflict massive damage with stabs when unseen.");
addskill(SK_FIRSTAID, "First Aid", "Increases your healing rate and reduces duration of poison.");
@ -10577,7 +10566,7 @@ void initskills(void) {
addskill(SK_LOCKPICKING, "Lockpicking", "Enhances your ability to pick locks.");
addskill(SK_CHANNELING, "Channeling", "Lets you make better use of magical items.");
addskill(SK_TWOWEAPON, "Dual Weilding", "Allows you to weild two melee weapons at once.");
addskill(SK_SHIELDS, "Shields", "Reduces your accuracy penalty when using a shield.");
addskill(SK_SHIELDS, "Shields", "Reduces shield accuracy penalty, and raises chance to block projectiles.");
addskill(SK_SPELLCASTING, "Spellcasting", "Determines your ability to cast spells from all schools.");
addskill(SK_SPOTHIDDEN, "Searching", "Helps you to spot hidden traps or creatures.");
addskill(SK_STEALTH, "Stealth", "Affects your ability to move silently.");

6
move.c
View File

@ -960,7 +960,7 @@ int moveto(lifeform_t *lf, cell_t *newcell, int onpurpose, int dontclearmsg) {
// just clear the message buffer
if (!didmsg) clearmsg();
} else { // tell player what is here
dolook(newcell);
dolook(newcell, B_FALSE);
}
}
}
@ -1485,8 +1485,8 @@ int teleportto(lifeform_t *lf, cell_t *c, int wantsmoke) {
// show any objects here, just like if we moved.
// BUT don't let dolook() clear the msg bar if there are
// no objects here.
if (isplayer(lf) && countobs(lf->cell->obpile)) {
dolook(lf->cell);
if (isplayer(lf) && countnoncosmeticobs(lf->cell->obpile)) {
dolook(lf->cell, B_FALSE);
}
return B_FALSE;
}

View File

@ -1455,7 +1455,7 @@ int adjustshieldpenalty(lifeform_t *lf, float amt) {
slev = getskill(lf, SK_SHIELDS);
switch (slev) {
case PR_INEPT:
amt *= 10;
amt *= 3;
break;
case PR_NOVICE:
break;
@ -3741,8 +3741,8 @@ char *getrandomobwithdt(map_t *map, enum DAMTYPE damtype, char *buf) {
return real_getrandomob(map, buf, RO_DAMTYPE, damtype, NA);
}
char *getrandomobwithclass(map_t *map, enum OBCLASS cid, char *buf) {
return real_getrandomob(map, buf, RO_OBCLASS, cid, NA);
char *getrandomobwithclass(map_t *map, enum OBCLASS cid, char *buf, int depthmod) {
return real_getrandomob(map, buf, RO_OBCLASS, cid, map->depth + depthmod);
}
int getobrarity(object_t *o) {
@ -8586,13 +8586,10 @@ int obmatchescondition(object_t *o, long opts) {
if ((opts & AO_EQUIPPEDNONWEAPON)) {
flag_t *ff;
ff = hasflag(o->flags, F_EQUIPPED);
if (ff) {
if ((ff->val[0] != BP_WEAPON) &&
(ff->val[0] != BP_SECWEAPON)) {
if (ff && !isweapon(o)) {
ok = B_TRUE;
}
}
}
if ((opts & AO_EDIBLE) && isedible(o)) ok = B_TRUE;
if ((opts & AO_DRINKABLE) && isdrinkable(o)) ok = B_TRUE;
if ((opts & AO_READABLE) && isreadable(o)) ok = B_TRUE;
@ -10116,8 +10113,10 @@ int readsomething(lifeform_t *lf, object_t *o) {
// is this a spellbook?
if (linkspell) {
// if so, only id if we are able to read it
//if (getiqreq(linkspell->id) <= getattr(lf, A_IQ)) {
// even if we id though, can only actually LEARN
// the spell if we are skilled in that school.
if (getspellpower(lf, linkspell->id) > 0) {
willid = B_TRUE;
} else {
willid = B_FALSE;
@ -10271,8 +10270,17 @@ int readsomething(lifeform_t *lf, object_t *o) {
if (lfhasflagval(lf, F_CANCAST, linkspell->id, NA, NA, NULL)) {
if (isplayer(lf)) msg("You already know how to cast this spell!");
} else {
enum SPELLSCHOOL school;
enum SKILL skill;
school = getspellschool(linkspell->id);
skill = getschoolskill(school);
if (getskill(lf, skill)) {
// learn it
addflag(lf->flags, F_CANCAST, linkspell->id, NA, NA, NULL);
} else {
msg("You are not yet skilled in %s.",getschoolnameshort(school));
}
}
} else {
if (isplayer(lf)) msg("You cannot comprehend this book.");

View File

@ -96,7 +96,7 @@ objecttype_t *getoppositestairs(objecttype_t *ot);
char *real_getrandomob(map_t *map, char *buf, int cond, int cval, int forcedepth);
char *getrandomob(map_t *map, char *buf);
char *getrandomobwithdt(map_t *map, enum DAMTYPE damtype, char *buf);
char *getrandomobwithclass(map_t *map, enum OBCLASS cid, char *buf);
char *getrandomobwithclass(map_t *map, enum OBCLASS cid, char *buf, int depthmod);
int getobrarity(object_t *o);
enum SPELLSCHOOL getschool(enum OBTYPE sid);
char *getschoolname(enum SPELLSCHOOL sch);

View File

@ -5397,6 +5397,9 @@ enum SPELLSCHOOL getspellschool(enum OBTYPE spellid) {
if (!ot) {
return SS_NONE;
}
if (ot->obclass->id == OC_ABILITY) {
return SS_ABILITY;
}
f = hasflag(ot->flags, F_SPELLSCHOOL);
if (f) {
return f->val[0];
@ -5414,14 +5417,20 @@ enum SPELLSCHOOL getspellschoolknown(lifeform_t *lf, enum OBTYPE spellid) {
return SS_NONE;
}
if (ot->obclass->id == OC_ABILITY) {
return SS_ABILITY;
}
// find a school which we know about!
thisschool = SS_NONE;
for (f = ot->flags->first ; f ; f = f->next) {
if ((f->id == F_SPELLSCHOOL) && getskill(lf, getschoolskill(f->val[0]))) {
thisschool = f->val[0];
break;
}
}
// if we don't know any of the schools...
if (thisschool == SS_NONE) {
// just pick the first one.
f = hasflag(ot->flags, F_SPELLSCHOOL);