parent
415a15a523
commit
ef08494ade
2
Makefile
2
Makefile
|
@ -1,7 +1,7 @@
|
||||||
#all: Makefile defs.h nexus.c nexus.h ai.c ai.h attack.c attack.h data.c data.h flag.c flag.h god.c god.h io.c io.h lf.c lf.h map.c map.h move.c move.h objects.c objects.h text.c text.h save.c save.h shops.c shops.h spell.c spell.h vault.c vault.h
|
#all: Makefile defs.h nexus.c nexus.h ai.c ai.h attack.c attack.h data.c data.h flag.c flag.h god.c god.h io.c io.h lf.c lf.h map.c map.h move.c move.h objects.c objects.h text.c text.h save.c save.h shops.c shops.h spell.c spell.h vault.c vault.h
|
||||||
# gcc $(CFLAGS) -o nexus nexus.c ai.c attack.c data.c flag.c god.c io.c lf.c map.c move.c objects.c text.c save.c spell.c shops.c vault.c -lncurses -lsqlite3
|
# gcc $(CFLAGS) -o nexus nexus.c ai.c attack.c data.c flag.c god.c io.c lf.c map.c move.c objects.c text.c save.c spell.c shops.c vault.c -lncurses -lsqlite3
|
||||||
|
|
||||||
CFLAGS=-fdiagnostics-color=always -g -Wall -Werror
|
CFLAGS=-fdiagnostics-color=always -g -Wall -Werror -Wno-format-truncation -Wno-unused-but-set-variable
|
||||||
|
|
||||||
nexus: ai.o astar.o attack.o data.o flag.o god.o io.o lf.o map.o move.o nexus.o objects.o save.o shops.o spell.o text.o vault.o ai.h attack.h data.h defs.h flag.h god.h io.h lf.h map.h move.h nexus.h objects.h save.h shops.h spell.h text.h vault.h
|
nexus: ai.o astar.o attack.o data.o flag.o god.o io.o lf.o map.o move.o nexus.o objects.o save.o shops.o spell.o text.o vault.o ai.h attack.h data.h defs.h flag.h god.h io.h lf.h map.h move.h nexus.h objects.h save.h shops.h spell.h text.h vault.h
|
||||||
gcc $(CFLAGS) -o nexus ai.o astar.o attack.o data.o flag.o god.o io.o lf.o map.o move.o nexus.o objects.o save.o shops.o spell.o text.o vault.o -lncurses -lsqlite3
|
gcc $(CFLAGS) -o nexus ai.o astar.o attack.o data.o flag.o god.o io.o lf.o map.o move.o nexus.o objects.o save.o shops.o spell.o text.o vault.o -lncurses -lsqlite3
|
||||||
|
|
30
ai.c
30
ai.c
|
@ -25,10 +25,10 @@ extern int playerhasmoved;
|
||||||
int wantdb = B_TRUE;
|
int wantdb = B_TRUE;
|
||||||
|
|
||||||
void addignorecell(lifeform_t *lf, cell_t *c) {
|
void addignorecell(lifeform_t *lf, cell_t *c) {
|
||||||
int howmany = 0;
|
//int howmany = 0;
|
||||||
if (!c || !lf) return;
|
if (!c || !lf) return;
|
||||||
// TEST: just have one ignorecell at once.
|
// TEST: just have one ignorecell at once.
|
||||||
howmany = killflagsofid(lf->flags, F_IGNORECELL);
|
killflagsofid(lf->flags, F_IGNORECELL);
|
||||||
addtempflag(lf->flags, F_IGNORECELL, c->x, c->y, NA, NULL, 10);
|
addtempflag(lf->flags, F_IGNORECELL, c->x, c->y, NA, NULL, 10);
|
||||||
//if (c && !lfhasflagval(lf, F_IGNORECELL, c->x, c->y, NA, NULL)) {
|
//if (c && !lfhasflagval(lf, F_IGNORECELL, c->x, c->y, NA, NULL)) {
|
||||||
// addtempflag(lf->flags, F_IGNORECELL, c->x, c->y, NA, NULL, 10);
|
// addtempflag(lf->flags, F_IGNORECELL, c->x, c->y, NA, NULL, 10);
|
||||||
|
@ -38,7 +38,7 @@ void addignorecell(lifeform_t *lf, cell_t *c) {
|
||||||
// returns true on failure
|
// returns true on failure
|
||||||
int aiattack(lifeform_t *lf, lifeform_t *victim, int timelimit) {
|
int aiattack(lifeform_t *lf, lifeform_t *victim, int timelimit) {
|
||||||
int db = B_FALSE;
|
int db = B_FALSE;
|
||||||
int innocentattack = 0;
|
//int innocentattack = 0;
|
||||||
flag_t *f;
|
flag_t *f;
|
||||||
|
|
||||||
if (lfhasflag(lf, F_DEBUG)) {
|
if (lfhasflag(lf, F_DEBUG)) {
|
||||||
|
@ -140,14 +140,14 @@ int aiattack(lifeform_t *lf, lifeform_t *victim, int timelimit) {
|
||||||
if (!areenemies(lf, victim)) {
|
if (!areenemies(lf, victim)) {
|
||||||
if (getallegiance(victim) == AL_FRIENDLY) {
|
if (getallegiance(victim) == AL_FRIENDLY) {
|
||||||
killflagsofid(lf->flags, F_FRIENDLY);
|
killflagsofid(lf->flags, F_FRIENDLY);
|
||||||
innocentattack = 3;
|
//innocentattack = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// no longer a pet
|
// no longer a pet
|
||||||
f = lfhasflagval(lf, F_PETOF, victim->id, NA, NA, NULL);
|
f = lfhasflagval(lf, F_PETOF, victim->id, NA, NA, NULL);
|
||||||
if (f) {
|
if (f) {
|
||||||
if (isplayer(victim)) innocentattack = 3;
|
//if (isplayer(victim)) innocentattack = 3;
|
||||||
killflag(f);
|
killflag(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ void ailoscheck(lifeform_t *lf) {
|
||||||
for (i = 0; i < lf->nlos; i++) {
|
for (i = 0; i < lf->nlos; i++) {
|
||||||
c = lf->los[i];
|
c = lf->los[i];
|
||||||
if (!c->known) {
|
if (!c->known) {
|
||||||
if ((c->known < PR_INEPT) || (c->known > PR_MASTER)) {
|
if (((int)c->known < (int)PR_INEPT) || ((int)c->known > (int)PR_MASTER)) {
|
||||||
ok = B_FALSE; break;
|
ok = B_FALSE; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,8 +202,7 @@ flag_t *ai_createpathto(lifeform_t *lf, cell_t *targcell) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (db) dblog("%s pathfind - finding path from %d,%d to %d,%d\n",lfname, lf->cell->x,lf->cell->y,
|
if (db) { dblog("%s pathfind - finding path from %d,%d to %d,%d\n",lfname, lf->cell->x,lf->cell->y, targcell->x,targcell->y); }
|
||||||
targcell->x,targcell->y);
|
|
||||||
|
|
||||||
// add starting cell to open list
|
// add starting cell to open list
|
||||||
open[0].c = lf->cell;
|
open[0].c = lf->cell;
|
||||||
|
@ -1133,14 +1132,14 @@ flag_t *aigoto(lifeform_t *lf, cell_t *c, enum MOVEREASON why, void *data, int t
|
||||||
int ai_attack_existing_target(lifeform_t *lf) {
|
int ai_attack_existing_target(lifeform_t *lf) {
|
||||||
lifeform_t *target;
|
lifeform_t *target;
|
||||||
int db = B_FALSE;
|
int db = B_FALSE;
|
||||||
enum ATTRBRACKET iqb;
|
//enum ATTRBRACKET iqb;
|
||||||
if (lfhasflag(lf, F_DEBUG)) db = B_TRUE;
|
if (lfhasflag(lf, F_DEBUG)) db = B_TRUE;
|
||||||
|
|
||||||
// do we already have a target we are attacking?
|
// do we already have a target we are attacking?
|
||||||
target = gettargetlf(lf);
|
target = gettargetlf(lf);
|
||||||
if (!target) return B_FALSE;
|
if (!target) return B_FALSE;
|
||||||
|
|
||||||
iqb = getattrbracket(getattr(lf, A_IQ), A_IQ, NULL);
|
//iqb = getattrbracket(getattr(lf, A_IQ), A_IQ, NULL);
|
||||||
|
|
||||||
if (db) dblog(".oO { i have a target: lfid %d (%s). }", target->id, target->race->name);
|
if (db) dblog(".oO { i have a target: lfid %d (%s). }", target->id, target->race->name);
|
||||||
|
|
||||||
|
@ -1637,6 +1636,7 @@ int ai_housekeeping(lifeform_t *lf, lifeform_t *master) {
|
||||||
msgnocap("%c - %s", o->letter, obname);
|
msgnocap("%c - %s", o->letter, obname);
|
||||||
}
|
}
|
||||||
// no longer an ally
|
// no longer an ally
|
||||||
|
if (db) { dblog(".oO { no longer an ally }"); }
|
||||||
killflagsofid(lf->flags, F_FRIENDLY);
|
killflagsofid(lf->flags, F_FRIENDLY);
|
||||||
killflagsofid(lf->flags, F_PETOF);
|
killflagsofid(lf->flags, F_PETOF);
|
||||||
killflagsofid(lf->flags, F_ISPRISONER);
|
killflagsofid(lf->flags, F_ISPRISONER);
|
||||||
|
@ -1708,7 +1708,7 @@ int ai_inventory_mgt(lifeform_t *lf, int *canattack) {
|
||||||
object_t *curwep = NULL,*bestwep = NULL, *o = NULL;
|
object_t *curwep = NULL,*bestwep = NULL, *o = NULL;
|
||||||
object_t *curgun = NULL,*bestgun = NULL;
|
object_t *curgun = NULL,*bestgun = NULL;
|
||||||
enum BODYPART bp;
|
enum BODYPART bp;
|
||||||
int icanattack = B_FALSE;
|
//int icanattack = B_FALSE;
|
||||||
enum ATTRBRACKET iqb;
|
enum ATTRBRACKET iqb;
|
||||||
iqb = getattrbracket(getattr(lf, A_IQ), A_IQ, NULL);
|
iqb = getattrbracket(getattr(lf, A_IQ), A_IQ, NULL);
|
||||||
|
|
||||||
|
@ -1819,7 +1819,6 @@ int ai_inventory_mgt(lifeform_t *lf, int *canattack) {
|
||||||
|
|
||||||
// now check whetehr we have ANY weapon
|
// now check whetehr we have ANY weapon
|
||||||
if (curwep || lfhasflag(lf, F_HASATTACK)) {
|
if (curwep || lfhasflag(lf, F_HASATTACK)) {
|
||||||
icanattack = B_TRUE;
|
|
||||||
if (canattack) *canattack = B_TRUE;
|
if (canattack) *canattack = B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1840,9 +1839,9 @@ int ai_inventory_mgt(lifeform_t *lf, int *canattack) {
|
||||||
int ai_movement(lifeform_t *lf) {
|
int ai_movement(lifeform_t *lf) {
|
||||||
int valid = B_TRUE;
|
int valid = B_TRUE;
|
||||||
cell_t *c;
|
cell_t *c;
|
||||||
int db = B_FALSE;
|
//int db = B_FALSE;
|
||||||
flag_t *f = NULL;
|
flag_t *f = NULL;
|
||||||
if (lfhasflag(lf, F_DEBUG)) db = B_TRUE;
|
//if (lfhasflag(lf, F_DEBUG)) db = B_TRUE;
|
||||||
|
|
||||||
if (lfhasflagval(lf, F_DOESNTMOVE, NA, NA, B_TRUE, NULL)) return B_FALSE;
|
if (lfhasflagval(lf, F_DOESNTMOVE, NA, NA, B_TRUE, NULL)) return B_FALSE;
|
||||||
if (isimmobile(lf)) return B_FALSE;
|
if (isimmobile(lf)) return B_FALSE;
|
||||||
|
@ -3051,12 +3050,11 @@ int aispellok(lifeform_t *lf, enum OBTYPE spellid, lifeform_t *victim, enum FLAG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ot->id == OT_S_TELEKINESIS) {
|
} else if (ot->id == OT_S_TELEKINESIS) {
|
||||||
int i,nposs;
|
int i;
|
||||||
float maxweight;
|
float maxweight;
|
||||||
maxweight = getlfweight(lf, B_NOOBS) +
|
maxweight = getlfweight(lf, B_NOOBS) +
|
||||||
(getlfweight(lf, B_NOOBS) * (getstatmod(lf, A_IQ) / 100));
|
(getlfweight(lf, B_NOOBS) * (getstatmod(lf, A_IQ) / 100));
|
||||||
|
|
||||||
nposs = 0;
|
|
||||||
for (i = 0; i < lf->nlos; i++) {
|
for (i = 0; i < lf->nlos; i++) {
|
||||||
if (lf->los[i] != lf->cell) {
|
if (lf->los[i] != lf->cell) {
|
||||||
object_t *o;
|
object_t *o;
|
||||||
|
|
17
attack.c
17
attack.c
|
@ -68,13 +68,14 @@ int applyarmourdamage(lifeform_t *lf, object_t *wep, int dam, enum DAMTYPE damty
|
||||||
|
|
||||||
if (armour) {
|
if (armour) {
|
||||||
int actualdam;
|
int actualdam;
|
||||||
int ar = 0;
|
//int ar = 0;
|
||||||
flag_t *rust, *f;
|
flag_t *rust;
|
||||||
|
/*
|
||||||
f = hasflag(armour->flags, F_ARMOURRATING);
|
f = hasflag(armour->flags, F_ARMOURRATING);
|
||||||
if (f) {
|
if (f) {
|
||||||
ar = f->val[0];
|
ar = f->val[0];
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
rust = hasflag(armour->flags, F_RUSTED);
|
rust = hasflag(armour->flags, F_RUSTED);
|
||||||
|
|
||||||
|
@ -181,7 +182,6 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
|
||||||
void *attacktarget;
|
void *attacktarget;
|
||||||
int attacklfid = -1;
|
int attacklfid = -1;
|
||||||
int nweps = 0;
|
int nweps = 0;
|
||||||
int innateattacks = 0;
|
|
||||||
int i;
|
int i;
|
||||||
int attacktime;
|
int attacktime;
|
||||||
int gotweapon = B_FALSE;
|
int gotweapon = B_FALSE;
|
||||||
|
@ -235,7 +235,7 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
|
||||||
) {
|
) {
|
||||||
switch (getallegiance(c->lf)) {
|
switch (getallegiance(c->lf)) {
|
||||||
case AL_PEACEFUL:
|
case AL_PEACEFUL:
|
||||||
if (getlorelevel(lf, getraceclass(c->lf) >= PR_NOVICE) ||
|
if ((int)getlorelevel(lf, (int)getraceclass(c->lf) >= PR_NOVICE) ||
|
||||||
getskill(lf, SK_SPEECH)) { // need this to KNOW whether they're peaceful
|
getskill(lf, SK_SPEECH)) { // need this to KNOW whether they're peaceful
|
||||||
snprintf(warnbuf, BUFLEN, "Really attack the peaceful %s?",noprefix(victimname));
|
snprintf(warnbuf, BUFLEN, "Really attack the peaceful %s?",noprefix(victimname));
|
||||||
}
|
}
|
||||||
|
@ -533,8 +533,6 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
|
||||||
validwep[i] = B_TRUE;
|
validwep[i] = B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
innateattacks = countinnateattacks(lf);
|
|
||||||
|
|
||||||
attacktime = getattackspeed(lf);
|
attacktime = getattackspeed(lf);
|
||||||
|
|
||||||
if (nweps <= 0) {
|
if (nweps <= 0) {
|
||||||
|
@ -750,6 +748,7 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
|
||||||
// god or map effects...
|
// god or map effects...
|
||||||
if (isplayer(lf) && attacktarget) {
|
if (isplayer(lf) && attacktarget) {
|
||||||
int angered = B_FALSE;
|
int angered = B_FALSE;
|
||||||
|
(void) angered;
|
||||||
if (attacktype == AT_LF) {
|
if (attacktype == AT_LF) {
|
||||||
if (!isgod(attacktarget)) {
|
if (!isgod(attacktarget)) {
|
||||||
int h,m,s;
|
int h,m,s;
|
||||||
|
@ -1292,7 +1291,7 @@ int attacklf(lifeform_t *lf, lifeform_t *victim, object_t *wep, flag_t *damflag)
|
||||||
if (lfhasflag(lf, F_HOLYAURA) && isvulnto(victim->flags, DT_HOLY, B_FALSE)) {
|
if (lfhasflag(lf, F_HOLYAURA) && isvulnto(victim->flags, DT_HOLY, B_FALSE)) {
|
||||||
damtype[i] = DT_HOLY;
|
damtype[i] = DT_HOLY;
|
||||||
}
|
}
|
||||||
sprintf(attackname, "%s%s attack", attackername, getpossessive(attackername));
|
snprintf(attackname, BUFLEN, "%s%s attack", attackername, getpossessive(attackername));
|
||||||
difficulty = 100 + (gettr(victim)*5) - (gettr(lf)*5);
|
difficulty = 100 + (gettr(victim)*5) - (gettr(lf)*5);
|
||||||
if (check_for_block(lf, victim, dam[i], damtype[i], difficulty, attackname, isadjacent(lf->cell,victim->cell))) {
|
if (check_for_block(lf, victim, dam[i], damtype[i], difficulty, attackname, isadjacent(lf->cell,victim->cell))) {
|
||||||
blocked = B_TRUE;
|
blocked = B_TRUE;
|
||||||
|
@ -2370,7 +2369,7 @@ void criticalhit(lifeform_t *lf, lifeform_t *victim, enum BODYPART hitpos, objec
|
||||||
losehydrahead(victim);
|
losehydrahead(victim);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sprintf(dambuf, "a severed %s", bpname);
|
snprintf(dambuf, BUFLEN, "a severed %s", bpname);
|
||||||
losehp(victim, pctof(100/num, victim->maxhp), DT_DIRECT, lf, dambuf);
|
losehp(victim, pctof(100/num, victim->maxhp), DT_DIRECT, lf, dambuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
defs.h
8
defs.h
|
@ -451,10 +451,10 @@
|
||||||
|
|
||||||
enum KNOWNGLYPHTYPE {
|
enum KNOWNGLYPHTYPE {
|
||||||
KG_UNKNOWN = 0,
|
KG_UNKNOWN = 0,
|
||||||
KG_MISC,
|
KG_MISC = 1,
|
||||||
KG_DFEATURE, // dungeon feature object - door, terrain, etc
|
KG_DFEATURE = 2, // dungeon feature object - door, terrain, etc
|
||||||
KG_STAIRS,
|
KG_STAIRS = 3,
|
||||||
KG_OBJECT,
|
KG_OBJECT = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CELLADJUSTTYPE {
|
enum CELLADJUSTTYPE {
|
||||||
|
|
6
god.c
6
god.c
|
@ -2241,13 +2241,14 @@ int prayto(lifeform_t *lf, lifeform_t *god) {
|
||||||
newgod = B_TRUE;
|
newgod = B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (god) {
|
||||||
switch (god->race->id) {
|
|
||||||
lifeform_t *l;
|
lifeform_t *l;
|
||||||
int dist;
|
int dist;
|
||||||
int donesomething = B_FALSE,n;
|
int donesomething = B_FALSE,n;
|
||||||
cell_t *c;
|
cell_t *c;
|
||||||
object_t *o;
|
object_t *o;
|
||||||
|
|
||||||
|
switch (god->race->id) {
|
||||||
case R_GODBATTLE:
|
case R_GODBATTLE:
|
||||||
dist = isinbattle(player, B_INCLUDEDISTANT, B_FALSE);
|
dist = isinbattle(player, B_INCLUDEDISTANT, B_FALSE);
|
||||||
if (dist) {
|
if (dist) {
|
||||||
|
@ -2941,6 +2942,7 @@ int prayto(lifeform_t *lf, lifeform_t *god) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// new god effects
|
// new god effects
|
||||||
|
|
Loading…
Reference in New Issue