fix #2495 - light vs gremlins (trunk only)
From a bug report, flashing yourself with a camera while in gremlin form blinded as with any other form, but didn't inflict any damage the way that flashing a monster gremlin does. This fixes that, and also makes light from wand/scroll/spell that hits you-as-gremlin or monster gremlins do 1d5 damage too. It happens even if the target is already in a lit spot, but doesn't continue afterwards: simply being in a lit spot doesn't cause any damage, nor does lamp light.
This commit is contained in:
28
src/uhitm.c
28
src/uhitm.c
@@ -2609,16 +2609,7 @@ struct obj *otmp; /* source of flash */
|
||||
/* Rule #1: Keep them out of the light. */
|
||||
amt = otmp->otyp == WAN_LIGHT ? d(1 + otmp->spe, 4) :
|
||||
rn2(min(mtmp->mhp,4));
|
||||
pline("%s %s!", Monnam(mtmp), amt > mtmp->mhp / 2 ?
|
||||
"wails in agony" : "cries out in pain");
|
||||
if ((mtmp->mhp -= amt) <= 0) {
|
||||
if (context.mon_moving)
|
||||
monkilled(mtmp, (char *)0, AD_BLND);
|
||||
else
|
||||
killed(mtmp);
|
||||
} else if (cansee(mtmp->mx,mtmp->my) && !canspotmon(mtmp)){
|
||||
map_invisible(mtmp->mx, mtmp->my);
|
||||
}
|
||||
light_hits_gremlin(mtmp, amt);
|
||||
}
|
||||
if (mtmp->mhp > 0) {
|
||||
if (!context.mon_moving) setmangry(mtmp);
|
||||
@@ -2632,4 +2623,21 @@ struct obj *otmp; /* source of flash */
|
||||
return res;
|
||||
}
|
||||
|
||||
void
|
||||
light_hits_gremlin(mon, dmg)
|
||||
struct monst *mon;
|
||||
int dmg;
|
||||
{
|
||||
pline("%s %s!", Monnam(mon),
|
||||
(dmg > mon->mhp / 2) ? "wails in agony" : "cries out in pain");
|
||||
if ((mon->mhp -= dmg) <= 0) {
|
||||
if (context.mon_moving)
|
||||
monkilled(mon, (char *)0, AD_BLND);
|
||||
else
|
||||
killed(mon);
|
||||
} else if (cansee(mon->mx, mon->my) && !canspotmon(mon)) {
|
||||
map_invisible(mon->mx, mon->my);
|
||||
}
|
||||
}
|
||||
|
||||
/*uhitm.c*/
|
||||
|
||||
Reference in New Issue
Block a user