local place = { {08,16},{13,07},{21,08},{41,14},{50,04},{50,16},{66,01} }
shuffle(place)
-des.region({ region={26,01,32,01},lit=0,type="ordinary",prefilled=0,irregular=1 })
+des.region({ region={26,01,32,01}, lit=0, type="ordinary",
+ prefilled=0, irregular=1 })
des.region(selection.area(20,08,21,08),"unlit")
des.region(selection.area(23,08,25,08),"unlit");
-- Secret doors
des.object("loadstone",place[4])
des.object("ruby",place[5])
des.object("worthless piece of red glass",place[5])
-des.object("luckstone",place[5])
+des.object({ id="luckstone", coord=place[5], buc="not-cursed", achievement=1 })
-- Random objects
des.object("*")
des.object("*")
des.non_diggable(selection.area(53,14,61,14))
-- The Gnome King's wine cellar.
-- the Trespassers sign is a long-running joke
-des.engraving({12,03},"engrave","You are now entering the Gnome King's wine cellar.")
-des.engraving({12,04},"engrave","Trespassers will be persecuted!")
+des.engraving({12,03}, "engrave",
+ "You are now entering the Gnome King's wine cellar.")
+des.engraving({12,04}, "engrave", "Trespassers will be persecuted!")
des.object("booze", 10, 07)
des.object("booze", 10, 07)
des.object("!", 10, 07)
des.object("amethyst", 70, 05)
des.object("*", 70, 05)
des.object("amethyst", 70, 05)
-des.object("luckstone", 70, 05)
+des.object({ id="luckstone", x=70, y=05,
+ buc="not-cursed", achievement=1 });
-- Scattered gems...
des.object("*")
des.object("*")
des.object("amethyst")
des.object("*")
des.object("amethyst")
-des.object("luckstone",place[2])
+des.object({ id="luckstone", coord=place[2], buc="not-cursed", achievement=1 })
des.object("flint",place[1])
des.object("?")
des.object("?")
des.door("closed", 17, 13);
des.door("closed", 17, 15);
-des.region({ region={18,10, 22,16}, lit = 1, type = "zoo", prefilled = 0, irregular = 1 });
+des.region({ region={18,10, 22,16}, lit = 1, type = "zoo",
+ prefilled = 0, irregular = 1 });
px, py = selection.rndcoord(place);
-if math.random(0, 99) < 50 then
- des.object("bag of holding", px, py);
+if math.random(0, 99) < 75 then
+ des.object({ id="bag of holding", x=px, y=py,
+ buc="not-cursed", achievement=1 });
else
- des.object("amulet of reflection", px, py);
+ des.object({ id="amulet of reflection", x=px, y=py,
+ buc="not-cursed", achievement=1 });
end
des.engraving({ x = px, y = py, type = "burn", text = "Elbereth" });
des.object({ id = "scare monster", x = px, y = py, buc = "cursed" });
des.door("closed",17,10)
des.door("closed",17,12)
des.door("closed",17,14)
-des.region({ region={18,09, 22,15}, lit = 1, type = "zoo", prefilled = 0, irregular = 1 });
+des.region({ region={18,09, 22,15}, lit = 1, type = "zoo",
+ prefilled = 0, irregular = 1 });
px, py = selection.rndcoord(place);
-if math.random(0, 99) < 50 then
- des.object("bag of holding",px,py);
+if math.random(0, 99) < 25 then
+ des.object({ id="bag of holding", x=px, y=py,
+ buc="not-cursed", achievement=1 });
else
- des.object("amulet of reflection",px,py);
+ des.object({ id="amulet of reflection", x=px, y=py,
+ buc="not-cursed", achievement=1 });
end
des.engraving({ x = px, y = py, type = "burn", text = "Elbereth" });
des.object({ id = "scare monster", x = px, y = py, buc = "cursed" });
-/* NetHack 3.6 context.h $NHDT-Date: 1577050216 2019/12/22 21:30:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.36 $ */
+/* NetHack 3.6 context.h $NHDT-Date: 1580434522 2020/01/31 01:35:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.39 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
struct achievement_tracking {
unsigned mines_prize_oid, soko_prize_oid; /* obj->o_id */
- short mines_prize_type, soko_prize_typ1, soko_prize_typ2; /* obj->otyp */
+ /* short mines_prize_type, soko_prize_typ1, soko_prize_typ2; */
};
struct context_info {
-/* NetHack 3.7 flag.h $NHDT-Date: 1579261284 2020/01/17 11:41:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.172 $ */
+/* NetHack 3.7 flag.h $NHDT-Date: 1580434522 2020/01/31 01:35:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.175 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
Bitfield(save_uswallow, 1);
Bitfield(save_uinwater, 1);
Bitfield(save_uburied, 1);
- /* item types used to acomplish "special achievements"; find the target
- object and you'll be flagged as having achieved something... */
- short mines_prize_type; /* luckstone */
- short soko_prize_type1; /* bag of holding or */
- short soko_prize_type2; /* amulet of reflection */
struct debug_flags debug;
boolean windowtype_locked; /* windowtype can't change from configfile */
boolean windowtype_deferred; /* pick a windowport and store it in
-/* NetHack 3.6 sp_lev.h $NHDT-Date: 1544930819 2018/12/16 03:26:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.25 $ */
+/* NetHack 3.6 sp_lev.h $NHDT-Date: 1580434523 2020/01/31 01:35:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.33 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
int quan;
short buried;
short lit;
- short eroded, locked, trapped, recharged, invis, greased, broken;
+ short eroded, locked, trapped, recharged, invis, greased, broken,
+ achievement;
} object;
typedef struct {
-/* NetHack 3.7 options.c $NHDT-Date: 1579261293 2020/01/17 11:41:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.428 $ */
+/* NetHack 3.7 options.c $NHDT-Date: 1580434523 2020/01/31 01:35:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.439 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2008. */
/* NetHack may be freely redistributed. See license for details. */
for (i = 0; i < WARNCOUNT; i++)
g.warnsyms[i] = def_warnsyms[i].sym;
- /* for "special achievement" tracking (see obj.h,
- create_object(sp_lev.c), addinv_core1(invent.c) */
- g.context.achieveo.mines_prize_type = LUCKSTONE;
- g.context.achieveo.soko_prize_typ1 = BAG_OF_HOLDING;
- g.context.achieveo.soko_prize_typ2 = AMULET_OF_REFLECTION;
-
/* assert( sizeof flags.inv_order == sizeof def_inv_order ); */
(void) memcpy((genericptr_t) flags.inv_order,
(genericptr_t) def_inv_order, sizeof flags.inv_order);
-/* NetHack 3.6 sp_lev.c $NHDT-Date: 1580431541 2020/01/31 00:45:41 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.149 $ */
+/* NetHack 3.6 sp_lev.c $NHDT-Date: 1580434524 2020/01/31 01:35:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.150 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
}
}
- if (o->id != -1) {
+ if (o->achievement) {
static const char prize_warning[] = "multiple prizes on %s level";
- /*
- * If this is a specific item of the right type and it is being
- * created on the right level, record its obj->o_id to be able
- * to recognize it as the designated item
- * used to detect a special achievement (to whit, reaching and
- * exploring the target level, although the exploration part
- * might be short-circuited if a monster brings object to hero).
- * Achievement is accomplished and the recorded o_id is cleared
- * if/when it gets added into hero's inventory.
- *
- * Random items of the appropriate type won't trigger a false
- * match--they'll fail the (id != -1) test above--but the level
- * definition should not include a second instance of any prize.
- */
- if (Is_mineend_level(&u.uz)
- && otmp->otyp == g.context.achieveo.mines_prize_type) {
+ if (Is_mineend_level(&u.uz)) {
if (!g.context.achieveo.mines_prize_oid) {
g.context.achieveo.mines_prize_oid = otmp->o_id;
/* prevent stacking; cleared when achievement is recorded */
} else {
impossible(prize_warning, "mines end");
}
- } else if (Is_sokoend_level(&u.uz)
- && (otmp->otyp == g.context.achieveo.soko_prize_typ1
- || otmp->otyp == g.context.achieveo.soko_prize_typ2)) {
+ } else if (Is_sokoend_level(&u.uz)) {
if (!g.context.achieveo.soko_prize_oid) {
g.context.achieveo.soko_prize_oid = otmp->o_id;
otmp->nomerge = 1; /* redundant; Sokoban prizes don't stack */
} else {
impossible(prize_warning, "sokoban end");
}
+ } else {
+ char lbuf[QBUFSZ];
+
+ (void) describe_level(lbuf); /* always has a trailing space */
+ impossible("create_object: unknown achievement (%s\"%s\")",
+ lbuf, simpleonames(otmp));
}
}
tmpobj.recharged = get_table_int_opt(L, "recharged", 0);
tmpobj.greased = get_table_boolean_opt(L, "greased", 0);
tmpobj.broken = get_table_boolean_opt(L, "broken", 0);
+ tmpobj.achievement = get_table_boolean_opt(L, "achievement", 0);
ox = get_table_int_opt(L, "x", -1);
oy = get_table_int_opt(L, "y", -1);