Genies should be immune to cold

Objects/lfs made of gas shouldn't be able to be knocked backwards
This commit is contained in:
Rob Pearce 2016-06-01 16:51:09 +10:00
parent 1b8980db09
commit 4a7711d110
6 changed files with 20 additions and 5 deletions

6
ai.c
View File

@ -1631,6 +1631,7 @@ int ai_housekeeping(lifeform_t *lf, lifeform_t *master) {
if (lfhasflag(lf, F_ISPRISONER) && master && isplayer(master) && if (lfhasflag(lf, F_ISPRISONER) && master && isplayer(master) &&
(cansee(lf, master) || isadjacent(lf->cell,master->cell))) { (cansee(lf, master) || isadjacent(lf->cell,master->cell))) {
// soon after escaping the dungeon, they'll leave you.
if (isoutdoors(lf->cell->map) && pctchance(85)) { if (isoutdoors(lf->cell->map) && pctchance(85)) {
object_t *o; object_t *o;
say(lf, "Thanks for getting me out!", SV_TALK); say(lf, "Thanks for getting me out!", SV_TALK);
@ -1641,7 +1642,7 @@ int ai_housekeeping(lifeform_t *lf, lifeform_t *master) {
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
msgnocap("%c - %s", o->letter, obname); msgnocap("%c - %s", o->letter, obname);
} }
// no longer an ally - but don't announce this. // 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);
@ -1881,6 +1882,9 @@ int ai_movement(lifeform_t *lf) {
// can see a non-enemy on top of the object, and we are adjacent // can see a non-enemy on top of the object, and we are adjacent
valid = B_FALSE; valid = B_FALSE;
} }
} else {
// weird ?
raise (SIGINT);
} }
if (valid) { if (valid) {

1
data.c
View File

@ -12493,6 +12493,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTATT, A_WIS, AT_HIGH, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_WIS, AT_HIGH, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_CHA, AT_HIGH, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_CHA, AT_HIGH, NA, NULL);
addflag(lastrace->flags, F_DTIMMUNE, DT_PROJECTILE, NA, NA, NULL); addflag(lastrace->flags, F_DTIMMUNE, DT_PROJECTILE, NA, NA, NULL);
addflag(lastrace->flags, F_DTIMMUNE, DT_COLD, NA, NA, NULL);
addflag(lastrace->flags, F_HASATTACK, OT_FISTS, 7, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_FISTS, 7, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "2 scimitars"); addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "2 scimitars");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "silk shirt"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "silk shirt");

2
lf.c
View File

@ -24170,7 +24170,7 @@ void startlfturn(lifeform_t *lf) {
} }
// extra effects // extra effects
if (!ko && (f->val[0] == P_COLD)) { if (!ko && (f->val[0] == P_COLD) && !isimmuneto(lf->flags, DT_COLD, B_FALSE)) {
if (rnd(1,100) <= 10) { if (rnd(1,100) <= 10) {
shiver(lf); shiver(lf);
} }

6
move.c
View File

@ -895,6 +895,11 @@ int knockback(lifeform_t *lf, int dir, int howfar, lifeform_t *pusher, int fallc
int preventchance = 0; int preventchance = 0;
enum LFSIZE lfsize; enum LFSIZE lfsize;
// can't knock non-solid things back
if (getmaterialstate(getlfmaterial(lf)) != MS_SOLID) {
return B_TRUE;
}
if (lfhasflag(lf, F_GRAVLESSENED)) { if (lfhasflag(lf, F_GRAVLESSENED)) {
howfar *= 2; howfar *= 2;
} else if (lfhasflag(lf, F_GRAVBOOSTED)) { } else if (lfhasflag(lf, F_GRAVBOOSTED)) {
@ -2656,6 +2661,7 @@ int initiatemove(lifeform_t *lf, cell_t *cell, int onpurpose, int *didmsg) {
if (willstand) { if (willstand) {
standup(lf); standup(lf);
reason = E_OK; reason = E_OK;
// doesn't count as a move for monster who were feigning death! // doesn't count as a move for monster who were feigning death!
if (!isplayer(lf) && lfhasflag(lf, F_FEIGNINGDEATH)) { if (!isplayer(lf) && lfhasflag(lf, F_FEIGNINGDEATH)) {

View File

@ -16277,7 +16277,8 @@ void timeeffectsob(object_t *o) {
object_t *oo; object_t *oo;
lf = o->pile->where->lf; lf = o->pile->where->lf;
creator = getobcreatedby(o); creator = getobcreatedby(o);
if (lf && (lf != creator) ) {
if (lf && (lf != creator) && (getmaterialstate(getlfmaterial(lf)) == MS_SOLID)) {
char damstring[BUFLEN]; char damstring[BUFLEN];
if (cansee(player, lf)) { if (cansee(player, lf)) {
char lfname[BUFLEN]; char lfname[BUFLEN];
@ -16302,9 +16303,12 @@ void timeeffectsob(object_t *o) {
// objects get knocked away // objects get knocked away
for (oo = o->pile->where->obpile->first ; oo ; oo = oo->next) { for (oo = o->pile->where->obpile->first ; oo ; oo = oo->next) {
if (oo == o) continue; if (oo == o) continue;
// note: f_nopickup obs will still get moved! // note: f_nopickup obs will still get moved!
if (hasflag(oo->flags, F_COSMETIC) || hasflag(oo->flags, F_CLIMBABLE) || if (hasflag(oo->flags, F_COSMETIC) || hasflag(oo->flags, F_CLIMBABLE) ||
(hasflag(oo->flags, F_TRAIL)) || (hasflag(oo->flags, F_TRAIL)) ||
(getmaterialstate(o->material->id) != MS_SOLID) ||
(hasflag(oo->flags, F_KNOCKAWAY)) || // don't affect other wind knockaway objects (hasflag(oo->flags, F_KNOCKAWAY)) || // don't affect other wind knockaway objects
(oo->type->obclass->id == OC_BUILDING)) { (oo->type->obclass->id == OC_BUILDING)) {
} else { } else {

View File

@ -8313,7 +8313,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (cansee(player, target)) { if (cansee(player, target)) {
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
} }
makehot(o, amt, rnd(1,2)); makehot(o, amt, 2);
} }
} }
} }
@ -8343,7 +8343,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
donesomething = B_TRUE; donesomething = B_TRUE;
} }
makehot(o, amt, rnd(1,2)); makehot(o, amt, 2);
if (isplayer(caster)) { if (isplayer(caster)) {
char obname[BUFLEN]; char obname[BUFLEN];
getobname(o, obname, o->amt); getobname(o, obname, o->amt);