some orctown follow-up bits, fix Bad fruit #0 and some minor tuning

This commit is contained in:
nhmall
2018-09-21 11:31:01 -04:00
parent dbf3816cc4
commit a18ae517f8
9 changed files with 109 additions and 29 deletions

View File

@@ -410,7 +410,7 @@ boolean with_you;
if ((mtmp->mspare1 & MIGR_LEFTOVERS) != 0L) {
/* Pick up the rest of the MIGR_TO_SPECIES objects */
if (migrating_objs)
deliver_obj_to_mon(mtmp, DF_ALL);
deliver_obj_to_mon(mtmp, 0, DF_ALL);
}
if (xlocale && wander) {

View File

@@ -1671,20 +1671,22 @@ boolean near_hero;
}
void
deliver_obj_to_mon(mtmp, deliverflags)
deliver_obj_to_mon(mtmp, cnt, deliverflags)
int cnt;
struct monst *mtmp;
unsigned long deliverflags;
{
struct obj *otmp, *otmp2;
int where, cnt = 0, maxobj = 0;
int where, maxobj = 1;
if (deliverflags & DF_RANDOM3)
maxobj = rn2(3) + 1;
else if (deliverflags & DF_RANDOM2)
maxobj = rn2(2) + 1;
else if (deliverflags == DF_NONE)
if ((deliverflags & DF_RANDOM) && cnt > 1)
maxobj = rnd(cnt);
else if (deliverflags & DF_ALL)
maxobj = 0;
else
maxobj = 1;
cnt = 0;
for (otmp = migrating_objs; otmp; otmp = otmp2) {
otmp2 = otmp->nobj;
where = (int) (otmp->owornmask & 0x7fffL); /* destination code */

View File

@@ -1391,7 +1391,7 @@ int mmflags;
}
if (allow_minvent && migrating_objs)
deliver_obj_to_mon(mtmp, DF_RANDOM2); /* in case there's waiting items */
deliver_obj_to_mon(mtmp, 1, DF_NONE); /* in case there's waiting items */
if (!in_mklev)
newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */

View File

@@ -632,6 +632,7 @@ char *s;
}
#define ORC_LEADER 1
static const char *orcfruit[] = {"paddle cactus", "dwarven root"};
void
migrate_orc(mtmp, mflags)
@@ -652,7 +653,7 @@ unsigned long mflags;
nlev = max_depth;
mtmp->mspare1 = MIGR_LEFTOVERS;
} else {
nlev = rn2(max_depth - cur_depth) + cur_depth + 1;
nlev = rn2((max_depth - cur_depth) + 1) + cur_depth;
if (nlev == cur_depth)
nlev++;
if (nlev > max_depth)
@@ -663,6 +664,38 @@ unsigned long mflags;
migrate_to_level(mtmp, ledger_no(&dest), MIGR_RANDOM, (coord *) 0);
}
void
shiny_orc_stuff(mtmp)
struct monst *mtmp;
{
int gemprob, goldprob, otyp;
struct obj *otmp;
boolean is_captain = (mtmp->data == &mons[PM_ORC_CAPTAIN]);
/* probabilities */
goldprob = is_captain ? 600 : 300;
gemprob = goldprob / 4;
if (rn2(1000) < goldprob) {
if ((otmp = mksobj(GOLD_PIECE, FALSE, FALSE)) != 0) {
otmp->quan = 1L + rnd(goldprob);
otmp->owt = weight(otmp);
add_to_minv(mtmp, otmp);
}
}
if (rn2(1000) < gemprob) {
if ((otmp = mkobj(GEM_CLASS, FALSE)) != 0) {
if (otmp->otyp == ROCK)
dealloc_obj(otmp);
else
add_to_minv(mtmp, otmp);
}
}
if (is_captain || !rn2(8)) {
otyp = shiny_obj(RING_CLASS);
if ((otmp = mksobj(otyp, FALSE, FALSE)) != 0)
add_to_minv(mtmp, otmp);
}
}
void
migr_booty_item(otyp, gang)
int otyp;
@@ -673,8 +706,13 @@ const char *gang;
if (otmp && gang) {
new_oname(otmp, strlen(gang) + 1); /* removes old name if one is present */
Strcpy(ONAME(otmp), gang);
if (otyp >= TRIPE_RATION && otyp <= TIN)
if (otyp >= TRIPE_RATION && otyp <= TIN) {
if (otyp == SLIME_MOLD)
otmp->spe = fruitadd((char *) orcfruit[rn2(SIZE(orcfruit))],
(struct fruit *) 0);
otmp->quan += (long) rn2(3);
otmp->owt = weight(otmp);
}
}
}
@@ -699,24 +737,16 @@ stolen_booty(VOID_ARGS)
*/
gang = rndorcname(gang_name);
/* create the leader of the orc gang */
mtmp = makemon(&mons[PM_ORC_CAPTAIN], 0, 0, MM_NONAME);
if (mtmp) {
mtmp = christen_monst(mtmp, upstart(gang));
mtmp->mpeaceful = 0;
migrate_orc(mtmp, ORC_LEADER);
}
/* create the stuff that the rest of the gang took */
migr_booty_item(rn2(2) ? LONG_SWORD : SILVER_SABER, gang);
cnt = rn2(3) + 1;
/* create the stuff that the gang took */
cnt = rnd(4);
for (i = 0; i < cnt; ++i)
migr_booty_item(rn2(4) ? TALLOW_CANDLE : WAX_CANDLE, gang);
cnt = rn2(2) + 1;
cnt = rnd(3);
for (i = 0; i < cnt; ++i)
migr_booty_item(SKELETON_KEY, gang);
otyp = rn2((GAUNTLETS_OF_DEXTERITY - LEATHER_GLOVES) + 1) + LEATHER_GLOVES;
migr_booty_item(otyp, gang);
cnt = rn2(9) + 1;
cnt = rnd(10);
for (i = 0; i < cnt; ++i) {
/* Food items - but no lembas! (or some other weird things) */
otyp = rn2((TIN - TRIPE_RATION) + 1) + TRIPE_RATION;
@@ -727,6 +757,15 @@ stolen_booty(VOID_ARGS)
otyp != HUGE_CHUNK_OF_MEAT && otyp != CORPSE)
migr_booty_item(otyp, gang);
}
migr_booty_item(rn2(2) ? LONG_SWORD : SILVER_SABER, gang);
/* create the leader of the orc gang */
mtmp = makemon(&mons[PM_ORC_CAPTAIN], 0, 0, MM_NONAME);
if (mtmp) {
mtmp = christen_monst(mtmp, upstart(gang));
mtmp->mpeaceful = 0;
shiny_orc_stuff(mtmp);
migrate_orc(mtmp, ORC_LEADER);
}
/* Make most of the orcs on the level be part of the invading gang */
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
@@ -751,14 +790,16 @@ stolen_booty(VOID_ARGS)
* members of the invading gang until they get their spoils assigned
* to the inventory; handled during that assignment.
*/
cnt = rn2(7) + 5;
cnt = rn2(10) + 5;
for (i = 0; i < cnt; ++i) {
int mtyp;
mtyp = rn2((PM_ORC_SHAMAN - PM_ORC) + 1) + PM_ORC;
mtmp = makemon(&mons[mtyp], 0, 0, MM_NONAME);
if (mtmp)
if (mtmp) {
shiny_orc_stuff(mtmp);
migrate_orc(mtmp, 0UL);
}
}
ransacked = 0;

View File

@@ -2753,6 +2753,13 @@ char oclass;
return STRANGE_OBJECT;
}
int
shiny_obj(oclass)
char oclass;
{
return (int) rnd_otyp_by_namedesc("shiny", oclass);
}
/*
* Return something wished for. Specifying a null pointer for
* the user request string results in a random object. Otherwise,