Called when potentially lightable object is affected by fire_damage(). Return TRUE if object becomes lit and FALSE otherwise --ALI */
| 1574 | /* Called when potentially lightable object is affected by fire_damage(). |
| 1575 | Return TRUE if object becomes lit and FALSE otherwise --ALI */ |
| 1576 | boolean |
| 1577 | catch_lit(struct obj *obj) |
| 1578 | { |
| 1579 | coordxy x, y; |
| 1580 | |
| 1581 | if (!obj->lamplit && ignitable(obj) && get_obj_location(obj, &x, &y, 0)) { |
| 1582 | if (((obj->otyp == MAGIC_LAMP /* spe==0 => no djinni inside */ |
| 1583 | /* spe==0 => no candles attached */ |
| 1584 | || obj->otyp == CANDELABRUM_OF_INVOCATION) && obj->spe == 0) |
| 1585 | /* age_is_relative && age==0 && still-exists means out of fuel */ |
| 1586 | || (age_is_relative(obj) && obj->age == 0) |
| 1587 | /* lantern is classified as ignitable() but not by fire */ |
| 1588 | || obj->otyp == BRASS_LANTERN) |
| 1589 | return FALSE; |
| 1590 | if (obj->otyp == CANDELABRUM_OF_INVOCATION && obj->cursed) |
| 1591 | return FALSE; |
| 1592 | if ((obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP) |
| 1593 | /* once lit, cursed lamp is as good as non-cursed one, so failure |
| 1594 | to light is a minor inconvenience to make cursed be worse */ |
| 1595 | && obj->cursed && !rn2(2)) |
| 1596 | return FALSE; |
| 1597 | |
| 1598 | if (obj->where == OBJ_INVENT || cansee(x, y)) { |
| 1599 | if (obj->where == OBJ_FLOOR && cansee(x, y)) |
| 1600 | set_msg_xy(x, y); |
| 1601 | pline("%s %s %s", Yname2(obj), |
| 1602 | /* "catches light!" or "feels warm." */ |
| 1603 | otense(obj, Blind ? "feel" : "catch"), |
| 1604 | Blind ? "warm." : "light!"); |
| 1605 | } |
| 1606 | if (obj->otyp == POT_OIL) |
| 1607 | makeknown(obj->otyp); |
| 1608 | if (carried(obj) && obj->unpaid && costly_spot(u.ux, u.uy)) { |
| 1609 | struct monst *shkp VOICEONLY |
| 1610 | = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); |
| 1611 | |
| 1612 | /* if it catches while you have it, then it's your tough luck */ |
| 1613 | check_unpaid(obj); |
| 1614 | SetVoice(shkp, 0, 80, 0); |
| 1615 | verbalize("That's in addition to the cost of %s %s, of course.", |
| 1616 | yname(obj), |
| 1617 | (obj->quan == 1L) ? "itself" : "themselves"); |
| 1618 | bill_dummy_object(obj); |
| 1619 | } |
| 1620 | begin_burn(obj, FALSE); |
| 1621 | return TRUE; |
| 1622 | } |
| 1623 | return FALSE; |
| 1624 | } |
| 1625 | |
| 1626 | /* light a lamp or candle */ |
| 1627 | staticfn void |
no test coverage detected