- [+] rage:

- [+] no spells/abils
    - [+] no throw
    - [+] no operating wands
    - [+] will not flee
    - [+] no weilding/unweilding
    - [+] no wearing/takingoff
    - [+] don't warn or swap with friendly lfs
    - [+] always attack doors rather than open them.
    - [+] can't close doors.
    - [+] become exhausted when rage runs out
    - [+] infiniite stamina when you're enraged
    - [+] can't quaff/read
- More kill verbs
This commit is contained in:
Rob Pearce 2011-11-18 03:25:09 +00:00
parent 25ca8f3e43
commit 3c7fa61324
10 changed files with 330 additions and 210 deletions

412
ai.c
View File

@ -295,6 +295,12 @@ object_t *aigetrangedattack(lifeform_t *lf, lifeform_t *target, enum RANGEATTACK
object_t *o;
if (lfhasflag(lf, F_DEBUG)) db = B_TRUE;
if (lfhasflag(lf, F_RAGE)) {
if (db) dblog(".oO { no ranged attack because i am enraged }");
if (ra) *ra = RA_NONE;
return NULL;
}
iqb = getattrbracket(getattr(lf, A_IQ), A_IQ, NULL);
if (iqb <= IQ_ANIMAL) {
// animal and lower intelligence won't use ranged
@ -1079,102 +1085,105 @@ void aiturn(lifeform_t *lf) {
///////////////////////////////////////////////
// emergencies / fixing up
///////////////////////////////////////////////
if (iqb >= AT_AVERAGE) {
if (celldangerous(lf, lf->cell, B_TRUE, NULL)) {
// if our cell is dangerous, move away!
if (!dorandommove(lf, B_NOBADMOVES, B_FALSE)) {
if (!lfhasflag(lf, F_RAGE)) {
if (iqb >= AT_AVERAGE) {
if (celldangerous(lf, lf->cell, B_TRUE, NULL)) {
// if our cell is dangerous, move away!
if (!dorandommove(lf, B_NOBADMOVES, B_FALSE)) {
return;
}
}
}
// flying monsters not flying?
if (!isprone(lf)) {
if (hasflag(lf->race->flags, F_FLYING) && !lfhasflag(lf, F_FLYING)) {
copyflag(lf->flags, lf->race->flags, F_FLYING);
taketime(lf, getmovespeed(lf));
return;
}
if (hasflag(lf->race->flags, F_LEVITATING) && !lfhasflag(lf, F_LEVITATING)) {
copyflag(lf->flags, lf->race->flags, F_LEVITATING);
taketime(lf, getmovespeed(lf));
return;
}
}
}
// flying monsters not flying?
if (!isprone(lf)) {
if (hasflag(lf->race->flags, F_FLYING) && !lfhasflag(lf, F_FLYING)) {
copyflag(lf->flags, lf->race->flags, F_FLYING);
taketime(lf, getmovespeed(lf));
return;
}
if (hasflag(lf->race->flags, F_LEVITATING) && !lfhasflag(lf, F_LEVITATING)) {
copyflag(lf->flags, lf->race->flags, F_LEVITATING);
taketime(lf, getmovespeed(lf));
return;
}
}
///////////////////////////////////////////////
// housekeeping - weapon changes, drop/pickup,
// use items, talk,etc
///////////////////////////////////////////////
if (lfhasflag(lf, F_ISPRISONER) && master && isplayer(master) && cansee(lf, master)) {
if (isoutdoors(lf->cell->map) && pctchance(20)) {
object_t *o;
say(lf, "Thanks for getting me out!", SV_TALK);
o = addobfast(master->pack, OT_MANUAL);
if (o) {
char obname[BUFLEN];
say(lf, "Here, let me teach you something as a reward.", SV_TALK);
getobname(o, obname, o->amt);
msgnocap("%c - %s", o->letter, obname);
}
// no longer an ally
killflagsofid(lf->flags, F_PETOF);
killflagsofid(lf->flags, F_ISPRISONER);
}
}
// too many objects?
i = countobs(lf->pack, B_FALSE);
if (i >= (MAXPILEOBS - 5)) {
object_t *container;
// get largest container with space
container = getbestcontainer(lf->pack);
if (container) {
object_t *o;
// find object which will fit
for (o = lf->pack->first ; o ; o = o->next) {
if ((o != container) && !isequipped(o) && obfits(o, container->contents)) {
// put it in.
moveob(o, container->contents, ALL);
if (cansee(player, lf)) {
char obname[BUFLEN];
char lfname[BUFLEN];
char containername[BUFLEN];
// announce
getobname(o, obname, o->amt);
getobname(container, containername, 1);
getlfname(lf, lfname);
msg("%s puts %s into %s.", lfname, obname, containername);
}
// timetime
taketime(lf, getactspeed(lf));
return;
if (!lfhasflag(lf, F_RAGE)) {
if (lfhasflag(lf, F_ISPRISONER) && master && isplayer(master) && cansee(lf, master)) {
if (isoutdoors(lf->cell->map) && pctchance(20)) {
object_t *o;
say(lf, "Thanks for getting me out!", SV_TALK);
o = addobfast(master->pack, OT_MANUAL);
if (o) {
char obname[BUFLEN];
say(lf, "Here, let me teach you something as a reward.", SV_TALK);
getobname(o, obname, o->amt);
msgnocap("%c - %s", o->letter, obname);
}
// no longer an ally
killflagsofid(lf->flags, F_PETOF);
killflagsofid(lf->flags, F_ISPRISONER);
}
}
}
// talking
f = lfhasflag(lf, F_RANDOMTALKPCT);
if (f) {
if (pctchance(f->val[0])) {
flag_t *poss[MAXCANDIDATES];
int nposs = 0,i;
// too many objects?
i = countobs(lf->pack, B_FALSE);
if (i >= (MAXPILEOBS - 5)) {
object_t *container;
// get largest container with space
container = getbestcontainer(lf->pack);
if (container) {
object_t *o;
// find object which will fit
for (o = lf->pack->first ; o ; o = o->next) {
if ((o != container) && !isequipped(o) && obfits(o, container->contents)) {
// put it in.
moveob(o, container->contents, ALL);
if (cansee(player, lf)) {
char obname[BUFLEN];
char lfname[BUFLEN];
char containername[BUFLEN];
// announce
getobname(o, obname, o->amt);
getobname(container, containername, 1);
getlfname(lf, lfname);
msg("%s puts %s into %s.", lfname, obname, containername);
}
// timetime
taketime(lf, getactspeed(lf));
return;
}
}
getflags(lf->flags, retflag, &nretflags, F_RANDOMTALK, F_NONE);
for (i = 0; i < nretflags; i++) {
poss[nposs++] = retflag[i];
}
if (nposs) {
int vol;
f = poss[rnd(0,nposs-1)];
vol = rnd(f->val[1], f->val[2]);
if (strlen(f->text)) {
say(lf, f->text, vol);
} else {
sayphrase(lf, f->val[0], vol, NA, NULL);
}
// talking
f = lfhasflag(lf, F_RANDOMTALKPCT);
if (f) {
if (pctchance(f->val[0])) {
flag_t *poss[MAXCANDIDATES];
int nposs = 0,i;
getflags(lf->flags, retflag, &nretflags, F_RANDOMTALK, F_NONE);
for (i = 0; i < nretflags; i++) {
poss[nposs++] = retflag[i];
}
if (nposs) {
int vol;
f = poss[rnd(0,nposs-1)];
vol = rnd(f->val[1], f->val[2]);
if (strlen(f->text)) {
say(lf, f->text, vol);
} else {
sayphrase(lf, f->val[0], vol, NA, NULL);
}
}
}
}
@ -1203,143 +1212,145 @@ void aiturn(lifeform_t *lf) {
}
}
// feigning death with enemies in sight, and hurt?
if (lfhasflag(lf, F_FEIGNINGDEATH) && !safetorest(lf)) {
if (isbleeding(lf)) {
if (db) dblog(".oO { i am feigning death and bleeding (hp=%d/%d), skipping turn. }",lf->hp,lf->maxhp);
// just wait...
rest(lf, B_TRUE);
return;
}
}
// hurt gods planeshift away
if (lf->race->raceclass->id == RC_GOD) {
if (gethppct(lf) <= 10) {
if (!castspell(lf, OT_S_PLANESHIFT, lf, NULL, lf->cell, NULL, NULL)) {
if (!lfhasflag(lf, F_RAGE)) {
// feigning death with enemies in sight, and hurt?
if (lfhasflag(lf, F_FEIGNINGDEATH) && !safetorest(lf)) {
if (isbleeding(lf)) {
if (db) dblog(".oO { i am feigning death and bleeding (hp=%d/%d), skipping turn. }",lf->hp,lf->maxhp);
// just wait...
rest(lf, B_TRUE);
return;
}
}
}
// need to heal?
if (lf->hp < (lf->maxhp/2)) {
if (!useitemwithflag(lf, F_AIHEALITEM)) {
return;
} else {
// don't have or can't use our healing items
// no enemies in sight?
if (safetorest(lf)) {
// if it's "night time" for us, sleep forever.
// otehrwise just sleep until we're healed
if (!gotosleep(lf, issleepingtimefor(lf) ? B_TRUE : B_FALSE)) {
taketime(lf, getactspeed(lf)); // to make sure our turn ends
return; // success
// hurt gods planeshift away
if (lf->race->raceclass->id == RC_GOD) {
if (gethppct(lf) <= 10) {
if (!castspell(lf, OT_S_PLANESHIFT, lf, NULL, lf->cell, NULL, NULL)) {
return;
}
}
}
}
// burdened?
if (isburdened(lf)) {
object_t *o,*heaviest = NULL;
float hevweight = 0;
if (db) dblog(".oO { i am burdened }");
// drop our heaviest non-equipped object
for (o = lf->pack->first ; o ; o = o->next) {
if (!isequipped(o)) {
float thisweight;
thisweight = getobweight(o);
if (thisweight > hevweight) {
hevweight = thisweight;
heaviest = o;
}
}
}
if (heaviest) {
if (db) {
char obname[BUFLEN];
getobname(o, obname, ALL);
dblog(".oO { i will drop %s to lower my burden }", obname);
}
if (!drop(heaviest, ALL)) {
// need to heal?
if (lf->hp < (lf->maxhp/2)) {
if (!useitemwithflag(lf, F_AIHEALITEM)) {
return;
} else {
// don't have or can't use our healing items
// no enemies in sight?
if (safetorest(lf)) {
// if it's "night time" for us, sleep forever.
// otehrwise just sleep until we're healed
if (!gotosleep(lf, issleepingtimefor(lf) ? B_TRUE : B_FALSE)) {
taketime(lf, getactspeed(lf)); // to make sure our turn ends
return; // success
}
}
}
if (db) dblog(".oO { drop failed! }");
}
if (db) dblog(".oO { couldn't drop anything }");
}
// do we have a better weapon we could use?
curwep = getweapon(lf);
bestwep = getbestweapon(lf);
// burdened?
if (isburdened(lf)) {
object_t *o,*heaviest = NULL;
float hevweight = 0;
if ((curwep != bestwep) && !isfirearm(curwep)) {
if (db) dblog(".oO { i have a better weapon than my current one (%s > %s) }",bestwep->type->name, curwep ? curwep->type->name : "nothing");
// weild better one
if (!weild(lf, bestwep)) return;
}
if (db) dblog(".oO { i am burdened }");
// do we have a better firearm ?
curgun = getfirearm(lf);
if (curwep && hasflag(curwep->flags, F_TWOHANDED)) {
// we are using a two handed weapon. don't
// check for guns.
} else {
bestgun = getbestfirearm(lf);
// drop our heaviest non-equipped object
for (o = lf->pack->first ; o ; o = o->next) {
if (!isequipped(o)) {
float thisweight;
thisweight = getobweight(o);
if (thisweight > hevweight) {
hevweight = thisweight;
heaviest = o;
}
}
}
if (heaviest) {
if (db) {
char obname[BUFLEN];
getobname(o, obname, ALL);
dblog(".oO { i will drop %s to lower my burden }", obname);
}
if (!drop(heaviest, ALL)) {
return;
}
if (db) dblog(".oO { drop failed! }");
}
if (db) dblog(".oO { couldn't drop anything }");
}
if (curgun != bestgun) {
if (db) dblog(".oO { i have a better gun than my current one (%s > %s) }",bestgun->type->name, curgun ? curgun->type->name : "nothing");
// do we have a better weapon we could use?
curwep = getweapon(lf);
bestwep = getbestweapon(lf);
if ((curwep != bestwep) && !isfirearm(curwep)) {
if (db) dblog(".oO { i have a better weapon than my current one (%s > %s) }",bestwep->type->name, curwep ? curwep->type->name : "nothing");
// weild better one
if (!weild(lf, bestgun)) return;
if (!weild(lf, bestwep)) return;
}
}
// do we have ammo for an empty gun?
if (curgun) {
object_t *curammo;
curammo = getammo(curgun);
if (!curammo) {
o = getrandomammo(lf);
if (o && !loadfirearm(lf, curgun, o)) {
// success
// do we have a better firearm ?
curgun = getfirearm(lf);
if (curwep && hasflag(curwep->flags, F_TWOHANDED)) {
// we are using a two handed weapon. don't
// check for guns.
} else {
bestgun = getbestfirearm(lf);
if (curgun != bestgun) {
if (db) dblog(".oO { i have a better gun than my current one (%s > %s) }",bestgun->type->name, curgun ? curgun->type->name : "nothing");
// weild better one
if (!weild(lf, bestgun)) return;
}
}
// do we have ammo for an empty gun?
if (curgun) {
object_t *curammo;
curammo = getammo(curgun);
if (!curammo) {
o = getrandomammo(lf);
if (o && !loadfirearm(lf, curgun, o)) {
// success
return;
}
}
}
// do we have better armour?
for (bp = BP_RIGHTFINGER ; bp < MAXBODYPARTS; bp++) {
object_t *curarm;
curarm = getarmour(lf, bp);
// do we have a better one?
for (o = lf->pack->first ; o ; o = o->next) {
if (canwear(lf, o, BP_NONE) && isbetterarmourthan(o, curarm)) {
// wear this armour instead
if (!wear(lf, o)) return;
}
}
}
// now check whetehr we have ANY weapon
if (curwep || lfhasflag(lf, F_HASATTACK)) {
icanattack = B_TRUE;
}
// before attacking targets,
// look for any object which we _covet_.
// ie. if we covet something, we will pick it up
// instead of attacking our target.
if (!lfhasflag(lf, F_HIDING) && !lfhasflag(lf, F_FEIGNINGDEATH)) {
if (db) dblog(".oO { looking for covetted objects... }");
if (lookforobs(lf)) {
if (db) dblog(".oO { found covetted object. returning. }");
return;
}
}
}
// do we have better armour?
for (bp = BP_RIGHTFINGER ; bp < MAXBODYPARTS; bp++) {
object_t *curarm;
curarm = getarmour(lf, bp);
// do we have a better one?
for (o = lf->pack->first ; o ; o = o->next) {
if (canwear(lf, o, BP_NONE) && isbetterarmourthan(o, curarm)) {
// wear this armour instead
if (!wear(lf, o)) return;
}
}
}
// now check whetehr we have ANY weapon
if (curwep || lfhasflag(lf, F_HASATTACK)) {
icanattack = B_TRUE;
}
// before attacking targets,
// look for any object which we _covet_.
// ie. if we covet something, we will pick it up
// instead of attacking our target.
if (!lfhasflag(lf, F_HIDING) && !lfhasflag(lf, F_FEIGNINGDEATH)) {
if (db) dblog(".oO { looking for covetted objects... }");
if (lookforobs(lf)) {
if (db) dblog(".oO { found covetted object. returning. }");
return;
}
}
} // end if not enraged
///////////////////////////////////////////////
// attacks
@ -1653,8 +1664,13 @@ int aispellok(lifeform_t *lf, enum OBTYPE spellid, lifeform_t *victim, enum FLAG
if (lfhasflag(lf, F_DEBUG)) {
db = B_TRUE;
}
ot = findot(spellid);
if (lfhasflag(lf, F_RAGE)) {
if (db) dblog(".oO { can't cast spells, i am enraged }");
return B_FALSE;
}
ot = findot(spellid);
if (ot) {
flag_t *f;
f = hasflag(ot->flags, F_LOSLOF);

View File

@ -184,7 +184,8 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
// anyone there? if so just attack.
if (c->lf) {
if (!force && isplayer(lf) && !areenemies(lf,c->lf) && (getraceclass(c->lf) != RC_PLANT) && cansee(lf, c->lf)) {
if (!force && isplayer(lf) && !areenemies(lf,c->lf) && (getraceclass(c->lf) != RC_PLANT) && cansee(lf, c->lf)
&& !lfhasflag(lf, F_RAGE)) {
char ch;
char victimname[BUFLEN];
char buf[BUFLEN];
@ -243,7 +244,9 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
priwep = getweapon(lf);
// confirm ?
if (!force && isplayer(lf) && wepdullable(priwep) && (getattrbracket(getattr(player, A_IQ), A_IQ, NULL) >= AT_GTAVERAGE) ) {
if (!force && isplayer(lf) && wepdullable(priwep)
&& (getattrbracket(getattr(player, A_IQ), A_IQ, NULL) >= AT_GTAVERAGE) &&
!lfhasflag(lf, F_RAGE)) {
char obname[BUFLEN],wepname[BUFLEN],buf[BUFLEN];
char ch;
real_getobname(o, obname, o->amt, B_FALSE, B_FALSE, B_TRUE, B_FALSE, B_FALSE);
@ -968,9 +971,13 @@ int attacklf(lifeform_t *lf, lifeform_t *victim, object_t *wep, flag_t *damflag)
if (wep && !isunarmed) {
char wepname[BUFLEN];
getobname(wep, wepname, 1);
/*
snprintf(buf, BUFLEN, "%s^%s %s",attackername2,
(lf == victim) ? "using" : "weilding",
wepname);
*/
// ie. killed by "an orc's dagger"
snprintf(buf, BUFLEN, "%s%s %s",attackername2, getpossessive(attackername2), noprefix(wepname));
} else {
strcpy(buf, attackername2);
}

Binary file not shown.

9
flag.c
View File

@ -804,7 +804,7 @@ void killflag(flag_t *f) {
// notify
if (gamemode == GM_GAMESTARTED) {
if (lf) {
// special cases
// special effects before announcement
if (f->id == F_FLEEFROM) {
// once you recover from fleeing from something,
// you don't find it scary for a little while.
@ -840,6 +840,13 @@ void killflag(flag_t *f) {
break;
}
}
// special effects after announcement
if (f->id == F_RAGE) {
// you are now exhausted
setstamina(lf, 0);
}
} else if (f->pile->ob) {
announceobflagloss(f->pile->ob, f);
}

10
io.c
View File

@ -3447,6 +3447,11 @@ void doclose(void) {
int adjdoors;
int forcedir = D_NONE;
if (lfhasflag(player, F_RAGE)) {
msg("You are too enraged to close doors!");
return;
}
// how many doors are nearby?
adjdoors = 0;
for (dir = DC_N; dir <= DC_NW; dir++) {
@ -5939,6 +5944,11 @@ void domagic(enum OBTYPE spellid, int cellx, int celly) {
objecttype_t *ot = NULL;
int finished;
if (lfhasflag(player, F_RAGE)) {
msg("You are too enraged to use magic or abilities!");
return;
}
// init the prompt if required.
if (spellid == OT_NONE) {
makespellchoicelist(&prompt, player, "Use which spell/ability:","Describe which spell/ability:", SS_NONE, B_FALSE, B_TRUE, B_FALSE, player->mp);

50
lf.c
View File

@ -2859,6 +2859,11 @@ int eat(lifeform_t *lf, object_t *o) {
int stopeating = B_FALSE;
int rawmeat = B_FALSE;
if (lfhasflag(lf, F_RAGE)) {
if (isplayer(lf)) msg("You are too enraged to eat!");
return B_TRUE;
}
if (hasflag(o->flags, F_DRINKABLE)) {
drinking = B_TRUE;
}
@ -11285,10 +11290,16 @@ int losehp_real(lifeform_t *lf, int amt, enum DAMTYPE damtype, lifeform_t *froml
setlastdam(lf, buf);
switch (damtype) {
case DT_ACID: setkillverb(lf, "Dissolved"); break;
case DT_COLD: setkillverb(lf, "Frozen"); break;
case DT_CRUSH: setkillverb(lf, "Crushed"); break;
case DT_ELECTRIC: setkillverb(lf, "Electrocuted"); break;
case DT_FIRE: setkillverb(lf, "Incinerated"); break;
case DT_FIRE:
case DT_HEAT:
setkillverb(lf, "Incinerated"); break;
case DT_MELT: setkillverb(lf, "Melted"); break;
case DT_PIERCE: setkillverb(lf, "Impaled"); break;
case DT_EXPLOSIVE: setkillverb(lf, "Vaporised"); break;
default: break;
}
@ -11536,6 +11547,9 @@ int mightflee(lifeform_t *lf) {
if (hasflag(lf->flags, F_NOFLEE)) {
return B_FALSE;
}
if (lfhasflag(lf, F_RAGE)) {
return B_FALSE;
}
if (hasflag(lf->flags, F_FLEEONDAM)) {
return B_TRUE;
@ -11766,6 +11780,12 @@ void modmorale(lifeform_t *lf, int howmuch) {
void modstamina(lifeform_t *lf, float howmuch) {
float orig;
// you don't lose stamina while enraged
if (lfhasflag(lf, F_RAGE) && (howmuch < 0)) {
return;
}
orig = getstamina(lf);
lf->stamina += howmuch;
limitf(&(lf->stamina), 0, getmaxstamina(lf));
@ -13181,6 +13201,9 @@ int scare(lifeform_t *lf, lifeform_t *scarer, int howlong, int scarerbonus) {
if (lfhasflag(lf, F_ASLEEP)) {
return B_FALSE;
}
if (lfhasflag(lf, F_RAGE)) {
return B_FALSE;
}
// not intelligent enough to be scared?
if (getattrbracket(getattr(lf, A_IQ), A_IQ, NULL) <= IQ_MINDLESS) {
return B_FALSE;
@ -15283,6 +15306,11 @@ int takeoff(lifeform_t *lf, object_t *o) {
return unweild(lf, o);
}
if (lfhasflag(lf, F_RAGE)) {
if (isplayer(lf)) msg("You are too enraged!");
return B_TRUE;
}
getobname(o, obname, 1);
if (!cantakeoff(lf, o)) {
@ -15410,6 +15438,12 @@ int throwat(lifeform_t *thrower, object_t *o, cell_t *where) {
if (isplayer(thrower)) msg("You have no hands to throw with!");
return B_TRUE;
}
if (lfhasflag(thrower, F_RAGE)) {
if (isplayer(thrower)) {
msg("You are too enraged to throw anything!");
}
return B_TRUE;
}
taketime(thrower, getactspeed(thrower));
return fireat(thrower, o, 1, where, getthrowspeed(thrower), NULL);
}
@ -15718,6 +15752,11 @@ int unweild(lifeform_t *lf, object_t *o) {
getobname(o, obname, 1);
if (lfhasflag(lf, F_RAGE)) {
if (isplayer(lf)) msg("You are too enraged to unweild a weapon!");
return B_TRUE;
}
if (!cantakeoff(lf, o)) {
switch (reason) {
case E_CURSED:
@ -16534,6 +16573,11 @@ int wear(lifeform_t *lf, object_t *o) {
statdirty = B_TRUE;
}
if (lfhasflag(lf, F_RAGE)) {
if (isplayer(lf)) msg("You are too enraged!");
return B_TRUE;
}
if (o->amt > 1) {
// eg. for melted wax in your ears
o = splitob(o);
@ -16852,6 +16896,10 @@ int weild(lifeform_t *lf, object_t *o) {
if (isplayer(lf)) {
statdirty = B_TRUE;
}
if (lfhasflag(lf, F_RAGE)) {
if (isplayer(lf)) msg("You are too enraged to weild a weapon!");
return B_TRUE;
}
if (o) {
getobname(o, buf, o->amt);

19
move.c
View File

@ -83,7 +83,7 @@ int ispossiblemove(lifeform_t *lf, int dir) {
return B_TRUE;
case E_DOORINWAY:
// if ai lifeforms CANT open doors, they will attack them
if (canopendoors(lf) || !isplayer(lf)) {
if (canopendoors(lf) || !isplayer(lf) || lfhasflag(lf, F_RAGE)) {
return B_TRUE;
}
//}
@ -112,6 +112,10 @@ int ispossiblemove(lifeform_t *lf, int dir) {
// lf is the one moving, lf2 is the one who is being forced to swap
int canswapwith(lifeform_t *lf, lifeform_t *lf2) {
// can't swap places when enraged
if (lfhasflag(lf, F_RAGE)) {
return B_FALSE;
}
// player can never be forced to swap
if (isplayer(lf2)) {
return B_FALSE;
@ -2747,10 +2751,15 @@ int trymove(lifeform_t *lf, int dir, int onpurpose, int strafe) {
if (onpurpose) taketime(lf, getmovespeed(lf));
}
} else {
// try to open it
if (!opendoor(lf, inway)) {
// opening a door counts as a successful move.
reason = E_OK;
if (lfhasflag(lf, F_RAGE)) {
// attack it
return attackcell(lf, cell, B_FALSE);
} else {
// try to open it
if (!opendoor(lf, inway)) {
// opening a door counts as a successful move.
reason = E_OK;
}
}
}
}

13
nexus.c
View File

@ -266,16 +266,23 @@ int main(int argc, char **argv) {
more();
exit(1);
}
// this is the hole which you fell down to get here.
addobfast(where->obpile, OT_HOLEINROOF);
// kill any objects which were already there, or which fell down the hole
killallobs(where->obpile);
// now add the player
real_addlf(where, startrace->id, 1, C_PLAYER); // this will assign 'player'
// give them basic abilities
addflag(player->flags, F_CANWILL, OT_A_CHECKSTAIRS, NA, NA, NULL);
addflag(player->flags, F_CANWILL, OT_A_PRAY, NA, NA, NULL);
addflag(player->flags, F_CANWILL, OT_A_TRAIN, NA, NA, NULL);
addflag(player->flags, F_CANWILL, OT_A_DEBUG, NA, NA, NULL); /////////
/*o = hasob(where->obpile, OT_PLAYERSTART);
killob(o);*/
killallobs(where->obpile);
addobfast(where->obpile, OT_HOLEINROOF);
// get player name from environment vars
user = getenv("USER");
if (user) {
char pname[MAXPNAMELEN];
@ -284,6 +291,8 @@ int main(int argc, char **argv) {
} else {
addflag(player->flags, F_NAME, NA, NA, NA, "Anonymous");
}
// give the player their job
givejob(player, j->id);
// extra choices for some jobs
if (j->id == J_DRUID) {

View File

@ -7544,6 +7544,13 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
return B_TRUE;
}
if (lfhasflag(lf, F_RAGE)) {
if (isplayer(lf)) {
msg("You are too enraged to operate anything!");
}
return B_TRUE;
}
getobname(o, obname, 1);
if ((isplayer(lf)) || cansee(player, lf)) {
@ -8679,6 +8686,11 @@ void quaff(lifeform_t *lf, object_t *o) {
flag_t *drinkflag;
enum OBTYPE realobid = OT_NONE;
if (lfhasflag(lf, F_RAGE)) {
if (isplayer(lf)) msg("You are too enraged to drink!");
return;
}
getobname(o, obname, 1);
if (isplayer(lf) || cansee(player, lf)) {

View File

@ -31,6 +31,7 @@ extern int noredraw;
extern prompt_t prompt;
extern WINDOW *msgwin;
extern WINDOW *gamewin;
extern void *rdata;
@ -1371,6 +1372,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
if (isplayer(user)) {
needredraw = B_TRUE;
statdirty = B_TRUE;
wclear(gamewin); // this forces a redraw even though the glyphs didn't change
drawscreen();
}
} else if (abilid == OT_A_REPAIR) {