- [+] 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:
parent
25ca8f3e43
commit
3c7fa61324
414
ai.c
414
ai.c
|
@ -295,6 +295,12 @@ object_t *aigetrangedattack(lifeform_t *lf, lifeform_t *target, enum RANGEATTACK
|
||||||
object_t *o;
|
object_t *o;
|
||||||
if (lfhasflag(lf, F_DEBUG)) db = B_TRUE;
|
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);
|
iqb = getattrbracket(getattr(lf, A_IQ), A_IQ, NULL);
|
||||||
if (iqb <= IQ_ANIMAL) {
|
if (iqb <= IQ_ANIMAL) {
|
||||||
// animal and lower intelligence won't use ranged
|
// animal and lower intelligence won't use ranged
|
||||||
|
@ -1079,102 +1085,105 @@ void aiturn(lifeform_t *lf) {
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// emergencies / fixing up
|
// emergencies / fixing up
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
if (iqb >= AT_AVERAGE) {
|
if (!lfhasflag(lf, F_RAGE)) {
|
||||||
if (celldangerous(lf, lf->cell, B_TRUE, NULL)) {
|
if (iqb >= AT_AVERAGE) {
|
||||||
// if our cell is dangerous, move away!
|
if (celldangerous(lf, lf->cell, B_TRUE, NULL)) {
|
||||||
if (!dorandommove(lf, B_NOBADMOVES, B_FALSE)) {
|
// 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;
|
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,
|
// housekeeping - weapon changes, drop/pickup,
|
||||||
// use items, talk,etc
|
// use items, talk,etc
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
if (lfhasflag(lf, F_ISPRISONER) && master && isplayer(master) && cansee(lf, master)) {
|
if (!lfhasflag(lf, F_RAGE)) {
|
||||||
if (isoutdoors(lf->cell->map) && pctchance(20)) {
|
if (lfhasflag(lf, F_ISPRISONER) && master && isplayer(master) && cansee(lf, master)) {
|
||||||
object_t *o;
|
if (isoutdoors(lf->cell->map) && pctchance(20)) {
|
||||||
say(lf, "Thanks for getting me out!", SV_TALK);
|
object_t *o;
|
||||||
o = addobfast(master->pack, OT_MANUAL);
|
say(lf, "Thanks for getting me out!", SV_TALK);
|
||||||
if (o) {
|
o = addobfast(master->pack, OT_MANUAL);
|
||||||
char obname[BUFLEN];
|
if (o) {
|
||||||
say(lf, "Here, let me teach you something as a reward.", SV_TALK);
|
char obname[BUFLEN];
|
||||||
getobname(o, obname, o->amt);
|
say(lf, "Here, let me teach you something as a reward.", SV_TALK);
|
||||||
msgnocap("%c - %s", o->letter, obname);
|
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;
|
|
||||||
}
|
}
|
||||||
|
// no longer an ally
|
||||||
|
killflagsofid(lf->flags, F_PETOF);
|
||||||
|
killflagsofid(lf->flags, F_ISPRISONER);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// talking
|
// too many objects?
|
||||||
f = lfhasflag(lf, F_RANDOMTALKPCT);
|
i = countobs(lf->pack, B_FALSE);
|
||||||
if (f) {
|
if (i >= (MAXPILEOBS - 5)) {
|
||||||
if (pctchance(f->val[0])) {
|
object_t *container;
|
||||||
flag_t *poss[MAXCANDIDATES];
|
// get largest container with space
|
||||||
int nposs = 0,i;
|
container = getbestcontainer(lf->pack);
|
||||||
|
if (container) {
|
||||||
getflags(lf->flags, retflag, &nretflags, F_RANDOMTALK, F_NONE);
|
object_t *o;
|
||||||
for (i = 0; i < nretflags; i++) {
|
// find object which will fit
|
||||||
poss[nposs++] = retflag[i];
|
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 (nposs) {
|
}
|
||||||
int vol;
|
|
||||||
f = poss[rnd(0,nposs-1)];
|
// talking
|
||||||
vol = rnd(f->val[1], f->val[2]);
|
f = lfhasflag(lf, F_RANDOMTALKPCT);
|
||||||
if (strlen(f->text)) {
|
if (f) {
|
||||||
say(lf, f->text, vol);
|
if (pctchance(f->val[0])) {
|
||||||
} else {
|
flag_t *poss[MAXCANDIDATES];
|
||||||
sayphrase(lf, f->val[0], vol, NA, NULL);
|
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_RAGE)) {
|
||||||
if (lfhasflag(lf, F_FEIGNINGDEATH) && !safetorest(lf)) {
|
// feigning death with enemies in sight, and hurt?
|
||||||
if (isbleeding(lf)) {
|
if (lfhasflag(lf, F_FEIGNINGDEATH) && !safetorest(lf)) {
|
||||||
if (db) dblog(".oO { i am feigning death and bleeding (hp=%d/%d), skipping turn. }",lf->hp,lf->maxhp);
|
if (isbleeding(lf)) {
|
||||||
// just wait...
|
if (db) dblog(".oO { i am feigning death and bleeding (hp=%d/%d), skipping turn. }",lf->hp,lf->maxhp);
|
||||||
rest(lf, B_TRUE);
|
// just wait...
|
||||||
return;
|
rest(lf, B_TRUE);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// need to heal?
|
// hurt gods planeshift away
|
||||||
if (lf->hp < (lf->maxhp/2)) {
|
if (lf->race->raceclass->id == RC_GOD) {
|
||||||
if (!useitemwithflag(lf, F_AIHEALITEM)) {
|
if (gethppct(lf) <= 10) {
|
||||||
return;
|
if (!castspell(lf, OT_S_PLANESHIFT, lf, NULL, lf->cell, NULL, NULL)) {
|
||||||
} else {
|
return;
|
||||||
// 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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// burdened?
|
// need to heal?
|
||||||
if (isburdened(lf)) {
|
if (lf->hp < (lf->maxhp/2)) {
|
||||||
object_t *o,*heaviest = NULL;
|
if (!useitemwithflag(lf, F_AIHEALITEM)) {
|
||||||
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)) {
|
|
||||||
return;
|
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?
|
// burdened?
|
||||||
curwep = getweapon(lf);
|
if (isburdened(lf)) {
|
||||||
bestwep = getbestweapon(lf);
|
object_t *o,*heaviest = NULL;
|
||||||
|
float hevweight = 0;
|
||||||
|
|
||||||
|
if (db) dblog(".oO { i am burdened }");
|
||||||
|
|
||||||
if ((curwep != bestwep) && !isfirearm(curwep)) {
|
// drop our heaviest non-equipped object
|
||||||
if (db) dblog(".oO { i have a better weapon than my current one (%s > %s) }",bestwep->type->name, curwep ? curwep->type->name : "nothing");
|
for (o = lf->pack->first ; o ; o = o->next) {
|
||||||
// weild better one
|
if (!isequipped(o)) {
|
||||||
if (!weild(lf, bestwep)) return;
|
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 }");
|
||||||
|
}
|
||||||
|
|
||||||
// do we have a better firearm ?
|
// do we have a better weapon we could use?
|
||||||
curgun = getfirearm(lf);
|
curwep = getweapon(lf);
|
||||||
if (curwep && hasflag(curwep->flags, F_TWOHANDED)) {
|
bestwep = getbestweapon(lf);
|
||||||
// we are using a two handed weapon. don't
|
|
||||||
// check for guns.
|
|
||||||
} else {
|
|
||||||
bestgun = getbestfirearm(lf);
|
|
||||||
|
|
||||||
if (curgun != bestgun) {
|
if ((curwep != bestwep) && !isfirearm(curwep)) {
|
||||||
if (db) dblog(".oO { i have a better gun than my current one (%s > %s) }",bestgun->type->name, curgun ? curgun->type->name : "nothing");
|
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
|
// weild better one
|
||||||
if (!weild(lf, bestgun)) return;
|
if (!weild(lf, bestwep)) return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// do we have ammo for an empty gun?
|
// do we have a better firearm ?
|
||||||
if (curgun) {
|
curgun = getfirearm(lf);
|
||||||
object_t *curammo;
|
if (curwep && hasflag(curwep->flags, F_TWOHANDED)) {
|
||||||
curammo = getammo(curgun);
|
// we are using a two handed weapon. don't
|
||||||
if (!curammo) {
|
// check for guns.
|
||||||
o = getrandomammo(lf);
|
} else {
|
||||||
if (o && !loadfirearm(lf, curgun, o)) {
|
bestgun = getbestfirearm(lf);
|
||||||
// success
|
|
||||||
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // end if not enraged
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// attacks
|
// attacks
|
||||||
|
@ -1653,8 +1664,13 @@ int aispellok(lifeform_t *lf, enum OBTYPE spellid, lifeform_t *victim, enum FLAG
|
||||||
if (lfhasflag(lf, F_DEBUG)) {
|
if (lfhasflag(lf, F_DEBUG)) {
|
||||||
db = B_TRUE;
|
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) {
|
if (ot) {
|
||||||
flag_t *f;
|
flag_t *f;
|
||||||
f = hasflag(ot->flags, F_LOSLOF);
|
f = hasflag(ot->flags, F_LOSLOF);
|
||||||
|
|
11
attack.c
11
attack.c
|
@ -184,7 +184,8 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
|
||||||
|
|
||||||
// anyone there? if so just attack.
|
// anyone there? if so just attack.
|
||||||
if (c->lf) {
|
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 ch;
|
||||||
char victimname[BUFLEN];
|
char victimname[BUFLEN];
|
||||||
char buf[BUFLEN];
|
char buf[BUFLEN];
|
||||||
|
@ -243,7 +244,9 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
|
||||||
priwep = getweapon(lf);
|
priwep = getweapon(lf);
|
||||||
|
|
||||||
// confirm ?
|
// 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 obname[BUFLEN],wepname[BUFLEN],buf[BUFLEN];
|
||||||
char ch;
|
char ch;
|
||||||
real_getobname(o, obname, o->amt, B_FALSE, B_FALSE, B_TRUE, B_FALSE, B_FALSE);
|
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) {
|
if (wep && !isunarmed) {
|
||||||
char wepname[BUFLEN];
|
char wepname[BUFLEN];
|
||||||
getobname(wep, wepname, 1);
|
getobname(wep, wepname, 1);
|
||||||
|
/*
|
||||||
snprintf(buf, BUFLEN, "%s^%s %s",attackername2,
|
snprintf(buf, BUFLEN, "%s^%s %s",attackername2,
|
||||||
(lf == victim) ? "using" : "weilding",
|
(lf == victim) ? "using" : "weilding",
|
||||||
wepname);
|
wepname);
|
||||||
|
*/
|
||||||
|
// ie. killed by "an orc's dagger"
|
||||||
|
snprintf(buf, BUFLEN, "%s%s %s",attackername2, getpossessive(attackername2), noprefix(wepname));
|
||||||
} else {
|
} else {
|
||||||
strcpy(buf, attackername2);
|
strcpy(buf, attackername2);
|
||||||
}
|
}
|
||||||
|
|
BIN
data/hiscores.db
BIN
data/hiscores.db
Binary file not shown.
9
flag.c
9
flag.c
|
@ -804,7 +804,7 @@ void killflag(flag_t *f) {
|
||||||
// notify
|
// notify
|
||||||
if (gamemode == GM_GAMESTARTED) {
|
if (gamemode == GM_GAMESTARTED) {
|
||||||
if (lf) {
|
if (lf) {
|
||||||
// special cases
|
// special effects before announcement
|
||||||
if (f->id == F_FLEEFROM) {
|
if (f->id == F_FLEEFROM) {
|
||||||
// once you recover from fleeing from something,
|
// once you recover from fleeing from something,
|
||||||
// you don't find it scary for a little while.
|
// you don't find it scary for a little while.
|
||||||
|
@ -840,6 +840,13 @@ void killflag(flag_t *f) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// special effects after announcement
|
||||||
|
if (f->id == F_RAGE) {
|
||||||
|
// you are now exhausted
|
||||||
|
setstamina(lf, 0);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (f->pile->ob) {
|
} else if (f->pile->ob) {
|
||||||
announceobflagloss(f->pile->ob, f);
|
announceobflagloss(f->pile->ob, f);
|
||||||
}
|
}
|
||||||
|
|
10
io.c
10
io.c
|
@ -3446,6 +3446,11 @@ void doclose(void) {
|
||||||
int dir;
|
int dir;
|
||||||
int adjdoors;
|
int adjdoors;
|
||||||
int forcedir = D_NONE;
|
int forcedir = D_NONE;
|
||||||
|
|
||||||
|
if (lfhasflag(player, F_RAGE)) {
|
||||||
|
msg("You are too enraged to close doors!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// how many doors are nearby?
|
// how many doors are nearby?
|
||||||
adjdoors = 0;
|
adjdoors = 0;
|
||||||
|
@ -5939,6 +5944,11 @@ void domagic(enum OBTYPE spellid, int cellx, int celly) {
|
||||||
objecttype_t *ot = NULL;
|
objecttype_t *ot = NULL;
|
||||||
int finished;
|
int finished;
|
||||||
|
|
||||||
|
if (lfhasflag(player, F_RAGE)) {
|
||||||
|
msg("You are too enraged to use magic or abilities!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// init the prompt if required.
|
// init the prompt if required.
|
||||||
if (spellid == OT_NONE) {
|
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);
|
makespellchoicelist(&prompt, player, "Use which spell/ability:","Describe which spell/ability:", SS_NONE, B_FALSE, B_TRUE, B_FALSE, player->mp);
|
||||||
|
|
50
lf.c
50
lf.c
|
@ -2859,6 +2859,11 @@ int eat(lifeform_t *lf, object_t *o) {
|
||||||
int stopeating = B_FALSE;
|
int stopeating = B_FALSE;
|
||||||
int rawmeat = 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)) {
|
if (hasflag(o->flags, F_DRINKABLE)) {
|
||||||
drinking = B_TRUE;
|
drinking = B_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -11285,10 +11290,16 @@ int losehp_real(lifeform_t *lf, int amt, enum DAMTYPE damtype, lifeform_t *froml
|
||||||
setlastdam(lf, buf);
|
setlastdam(lf, buf);
|
||||||
|
|
||||||
switch (damtype) {
|
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_CRUSH: setkillverb(lf, "Crushed"); break;
|
||||||
case DT_ELECTRIC: setkillverb(lf, "Electrocuted"); 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_MELT: setkillverb(lf, "Melted"); break;
|
||||||
|
case DT_PIERCE: setkillverb(lf, "Impaled"); break;
|
||||||
|
case DT_EXPLOSIVE: setkillverb(lf, "Vaporised"); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11536,6 +11547,9 @@ int mightflee(lifeform_t *lf) {
|
||||||
if (hasflag(lf->flags, F_NOFLEE)) {
|
if (hasflag(lf->flags, F_NOFLEE)) {
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
}
|
}
|
||||||
|
if (lfhasflag(lf, F_RAGE)) {
|
||||||
|
return B_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasflag(lf->flags, F_FLEEONDAM)) {
|
if (hasflag(lf->flags, F_FLEEONDAM)) {
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
|
@ -11766,6 +11780,12 @@ void modmorale(lifeform_t *lf, int howmuch) {
|
||||||
|
|
||||||
void modstamina(lifeform_t *lf, float howmuch) {
|
void modstamina(lifeform_t *lf, float howmuch) {
|
||||||
float orig;
|
float orig;
|
||||||
|
|
||||||
|
// you don't lose stamina while enraged
|
||||||
|
if (lfhasflag(lf, F_RAGE) && (howmuch < 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
orig = getstamina(lf);
|
orig = getstamina(lf);
|
||||||
lf->stamina += howmuch;
|
lf->stamina += howmuch;
|
||||||
limitf(&(lf->stamina), 0, getmaxstamina(lf));
|
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)) {
|
if (lfhasflag(lf, F_ASLEEP)) {
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
}
|
}
|
||||||
|
if (lfhasflag(lf, F_RAGE)) {
|
||||||
|
return B_FALSE;
|
||||||
|
}
|
||||||
// not intelligent enough to be scared?
|
// not intelligent enough to be scared?
|
||||||
if (getattrbracket(getattr(lf, A_IQ), A_IQ, NULL) <= IQ_MINDLESS) {
|
if (getattrbracket(getattr(lf, A_IQ), A_IQ, NULL) <= IQ_MINDLESS) {
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
|
@ -15283,6 +15306,11 @@ int takeoff(lifeform_t *lf, object_t *o) {
|
||||||
return unweild(lf, 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);
|
getobname(o, obname, 1);
|
||||||
|
|
||||||
if (!cantakeoff(lf, o)) {
|
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!");
|
if (isplayer(thrower)) msg("You have no hands to throw with!");
|
||||||
return B_TRUE;
|
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));
|
taketime(thrower, getactspeed(thrower));
|
||||||
return fireat(thrower, o, 1, where, getthrowspeed(thrower), NULL);
|
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);
|
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)) {
|
if (!cantakeoff(lf, o)) {
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case E_CURSED:
|
case E_CURSED:
|
||||||
|
@ -16534,6 +16573,11 @@ int wear(lifeform_t *lf, object_t *o) {
|
||||||
statdirty = B_TRUE;
|
statdirty = B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lfhasflag(lf, F_RAGE)) {
|
||||||
|
if (isplayer(lf)) msg("You are too enraged!");
|
||||||
|
return B_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (o->amt > 1) {
|
if (o->amt > 1) {
|
||||||
// eg. for melted wax in your ears
|
// eg. for melted wax in your ears
|
||||||
o = splitob(o);
|
o = splitob(o);
|
||||||
|
@ -16852,6 +16896,10 @@ int weild(lifeform_t *lf, object_t *o) {
|
||||||
if (isplayer(lf)) {
|
if (isplayer(lf)) {
|
||||||
statdirty = B_TRUE;
|
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) {
|
if (o) {
|
||||||
getobname(o, buf, o->amt);
|
getobname(o, buf, o->amt);
|
||||||
|
|
19
move.c
19
move.c
|
@ -83,7 +83,7 @@ int ispossiblemove(lifeform_t *lf, int dir) {
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
case E_DOORINWAY:
|
case E_DOORINWAY:
|
||||||
// if ai lifeforms CANT open doors, they will attack them
|
// 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;
|
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
|
// lf is the one moving, lf2 is the one who is being forced to swap
|
||||||
int canswapwith(lifeform_t *lf, lifeform_t *lf2) {
|
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
|
// player can never be forced to swap
|
||||||
if (isplayer(lf2)) {
|
if (isplayer(lf2)) {
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
|
@ -2747,10 +2751,15 @@ int trymove(lifeform_t *lf, int dir, int onpurpose, int strafe) {
|
||||||
if (onpurpose) taketime(lf, getmovespeed(lf));
|
if (onpurpose) taketime(lf, getmovespeed(lf));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// try to open it
|
if (lfhasflag(lf, F_RAGE)) {
|
||||||
if (!opendoor(lf, inway)) {
|
// attack it
|
||||||
// opening a door counts as a successful move.
|
return attackcell(lf, cell, B_FALSE);
|
||||||
reason = E_OK;
|
} else {
|
||||||
|
// try to open it
|
||||||
|
if (!opendoor(lf, inway)) {
|
||||||
|
// opening a door counts as a successful move.
|
||||||
|
reason = E_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
nexus.c
13
nexus.c
|
@ -266,16 +266,23 @@ int main(int argc, char **argv) {
|
||||||
more();
|
more();
|
||||||
exit(1);
|
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'
|
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_CHECKSTAIRS, NA, NA, NULL);
|
||||||
addflag(player->flags, F_CANWILL, OT_A_PRAY, 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_TRAIN, NA, NA, NULL);
|
||||||
addflag(player->flags, F_CANWILL, OT_A_DEBUG, NA, NA, NULL); /////////
|
addflag(player->flags, F_CANWILL, OT_A_DEBUG, NA, NA, NULL); /////////
|
||||||
/*o = hasob(where->obpile, OT_PLAYERSTART);
|
/*o = hasob(where->obpile, OT_PLAYERSTART);
|
||||||
killob(o);*/
|
killob(o);*/
|
||||||
killallobs(where->obpile);
|
|
||||||
addobfast(where->obpile, OT_HOLEINROOF);
|
|
||||||
|
|
||||||
|
// get player name from environment vars
|
||||||
user = getenv("USER");
|
user = getenv("USER");
|
||||||
if (user) {
|
if (user) {
|
||||||
char pname[MAXPNAMELEN];
|
char pname[MAXPNAMELEN];
|
||||||
|
@ -284,6 +291,8 @@ int main(int argc, char **argv) {
|
||||||
} else {
|
} else {
|
||||||
addflag(player->flags, F_NAME, NA, NA, NA, "Anonymous");
|
addflag(player->flags, F_NAME, NA, NA, NA, "Anonymous");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// give the player their job
|
||||||
givejob(player, j->id);
|
givejob(player, j->id);
|
||||||
// extra choices for some jobs
|
// extra choices for some jobs
|
||||||
if (j->id == J_DRUID) {
|
if (j->id == J_DRUID) {
|
||||||
|
|
12
objects.c
12
objects.c
|
@ -7544,6 +7544,13 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
|
||||||
return B_TRUE;
|
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);
|
getobname(o, obname, 1);
|
||||||
|
|
||||||
if ((isplayer(lf)) || cansee(player, lf)) {
|
if ((isplayer(lf)) || cansee(player, lf)) {
|
||||||
|
@ -8679,6 +8686,11 @@ void quaff(lifeform_t *lf, object_t *o) {
|
||||||
flag_t *drinkflag;
|
flag_t *drinkflag;
|
||||||
enum OBTYPE realobid = OT_NONE;
|
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);
|
getobname(o, obname, 1);
|
||||||
|
|
||||||
if (isplayer(lf) || cansee(player, lf)) {
|
if (isplayer(lf) || cansee(player, lf)) {
|
||||||
|
|
2
spell.c
2
spell.c
|
@ -31,6 +31,7 @@ extern int noredraw;
|
||||||
extern prompt_t prompt;
|
extern prompt_t prompt;
|
||||||
|
|
||||||
extern WINDOW *msgwin;
|
extern WINDOW *msgwin;
|
||||||
|
extern WINDOW *gamewin;
|
||||||
|
|
||||||
extern void *rdata;
|
extern void *rdata;
|
||||||
|
|
||||||
|
@ -1371,6 +1372,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
|
||||||
if (isplayer(user)) {
|
if (isplayer(user)) {
|
||||||
needredraw = B_TRUE;
|
needredraw = B_TRUE;
|
||||||
statdirty = B_TRUE;
|
statdirty = B_TRUE;
|
||||||
|
wclear(gamewin); // this forces a redraw even though the glyphs didn't change
|
||||||
drawscreen();
|
drawscreen();
|
||||||
}
|
}
|
||||||
} else if (abilid == OT_A_REPAIR) {
|
} else if (abilid == OT_A_REPAIR) {
|
||||||
|
|
Loading…
Reference in New Issue