Fire sources can ignite candles, lamps, and potions of oil
... on the floor, in monster inventory, and in hero's inventory. Items in your inventory being ignited produce a message even if you're blind - you can see the lit-state by viewing inventory anyway, so just give player the message. (via xNetHack)
This commit is contained in:
44
src/trap.c
44
src/trap.c
@@ -2434,6 +2434,7 @@ register struct monst *mtmp;
|
||||
(void) destroy_mitem(mtmp, SCROLL_CLASS, AD_FIRE);
|
||||
(void) destroy_mitem(mtmp, SPBOOK_CLASS, AD_FIRE);
|
||||
(void) destroy_mitem(mtmp, POTION_CLASS, AD_FIRE);
|
||||
ignite_items(mtmp->minvent);
|
||||
}
|
||||
if (burn_floor_objects(mtmp->mx, mtmp->my, see_it, FALSE)
|
||||
&& !see_it && distu(mtmp->mx, mtmp->my) <= 3 * 3)
|
||||
@@ -3196,6 +3197,7 @@ struct obj *box; /* null for floor trap */
|
||||
destroy_item(SCROLL_CLASS, AD_FIRE);
|
||||
destroy_item(SPBOOK_CLASS, AD_FIRE);
|
||||
destroy_item(POTION_CLASS, AD_FIRE);
|
||||
ignite_items(g.invent);
|
||||
}
|
||||
if (!box && burn_floor_objects(u.ux, u.uy, see_it, TRUE) && !see_it)
|
||||
You("smell paper burning.");
|
||||
@@ -5400,6 +5402,7 @@ lava_effects()
|
||||
destroy_item(SCROLL_CLASS, AD_FIRE);
|
||||
destroy_item(SPBOOK_CLASS, AD_FIRE);
|
||||
destroy_item(POTION_CLASS, AD_FIRE);
|
||||
ignite_items(g.invent);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -5560,4 +5563,45 @@ boolean override;
|
||||
return defsyms[trap_to_defsym(ttyp)].explanation;
|
||||
}
|
||||
|
||||
/* Ignite ignitable items in the given object chain, due to some external source
|
||||
* of fire. The object chain should be somewhere exposed, like someone's open
|
||||
* inventory or the floor.
|
||||
* This is modeled after destroy_item() somewhat and hopefully will be able to
|
||||
* merge into it in the future.
|
||||
*/
|
||||
void
|
||||
ignite_items(objchn)
|
||||
struct obj *objchn;
|
||||
{
|
||||
struct obj *obj;
|
||||
boolean vis = FALSE;
|
||||
if (!objchn)
|
||||
return;
|
||||
|
||||
if (objchn->where == OBJ_INVENT)
|
||||
vis = TRUE; /* even when blind; lit-state can be seen in inventory */
|
||||
else if (objchn->where == OBJ_MINVENT)
|
||||
vis = canseemon(objchn->ocarry);
|
||||
else if (objchn->where == OBJ_FLOOR)
|
||||
vis = cansee(objchn->ox, objchn->oy);
|
||||
else {
|
||||
impossible("igniting item in a weird location %d", objchn->where);
|
||||
return;
|
||||
}
|
||||
|
||||
for (obj = objchn; obj; obj = obj->nobj) {
|
||||
if (!(ignitable(obj) || obj->otyp == MAGIC_LAMP)
|
||||
/* The Candelabrum requires intention to be lit */
|
||||
|| obj->otyp == CANDELABRUM_OF_INVOCATION
|
||||
|| obj->otyp == BRASS_LANTERN /* doesn't ignite via fire */
|
||||
|| obj->in_use /* not available */
|
||||
|| obj->lamplit) { /* already burning */
|
||||
continue;
|
||||
}
|
||||
begin_burn(obj, FALSE);
|
||||
if (vis)
|
||||
pline("%s on fire!", Yobjnam2(obj, "catch"));
|
||||
}
|
||||
}
|
||||
|
||||
/*trap.c*/
|
||||
|
||||
Reference in New Issue
Block a user