monster movement comments

A bit of reformatting and a couple of new comments.  No change in
behavior.
This commit is contained in:
PatR
2019-04-17 18:57:14 -07:00
parent 7088247883
commit bbe4991a7f
2 changed files with 26 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 allmain.c $NHDT-Date: 1554895741 2019/04/10 11:29:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.99 $ */
/* NetHack 3.6 allmain.c $NHDT-Date: 1555552624 2019/04/18 01:57:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.100 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -106,21 +106,24 @@ boolean resuming;
context.mon_moving = FALSE;
if (!monscanmove && youmonst.movement < NORMAL_SPEED) {
/* both you and the monsters are out of steam this round
*/
/* set up for a new turn */
/* both hero and monsters are out of steam this round */
struct monst *mtmp;
/* set up for a new turn */
mcalcdistress(); /* adjust monsters' trap, blind, etc */
/* reallocate movement rations to monsters */
/* reallocate movement rations to monsters; don't need
to skip dead monsters here because they will have
been purged at end of their previous round of moving */
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
mtmp->movement += mcalcmove(mtmp);
if (!rn2(u.uevent.udemigod
? 25
: (depth(&u.uz) > depth(&stronghold_level))
? 50
: 70))
/* occasionally add another monster; since this takes
place after movement has been allotted, the new
monster effectively loses its first turn */
if (!rn2(u.uevent.udemigod ? 25
: (depth(&u.uz) > depth(&stronghold_level)) ? 50
: 70))
(void) makemon((struct permonst *) 0, 0, 0,
NO_MM_FLAGS);
@@ -131,11 +134,11 @@ boolean resuming;
} else {
moveamt = youmonst.data->mmove;
if (Very_fast) { /* speed boots or potion */
if (Very_fast) { /* speed boots, potion, or spell */
/* gain a free action on 2/3 of turns */
if (rn2(3) != 0)
moveamt += NORMAL_SPEED;
} else if (Fast) {
} else if (Fast) { /* intrinsic */
/* gain a free action on 1/3 of turns */
if (rn2(3) == 0)
moveamt += NORMAL_SPEED;
@@ -313,8 +316,7 @@ boolean resuming;
}
}
}
} while (youmonst.movement
< NORMAL_SPEED); /* hero can't move loop */
} while (youmonst.movement < NORMAL_SPEED); /* hero can't move */
/******************************************/
/* once-per-hero-took-time things go here */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1555022326 2019/04/11 22:38:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.281 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1555552629 2019/04/18 01:57:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.282 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -654,12 +654,12 @@ struct monst *mon;
mmove = ((rn2(2) ? 4 : 5) * mmove) / 3;
}
/* Randomly round the monster's speed to a multiple of NORMAL_SPEED. This
makes it impossible for the player to predict when they'll get a free
turn (thus preventing exploits like "melee kiting"), while retaining
guarantees about shopkeepers not being outsped by a normal-speed player,
normal-speed players being unable to open up a gap when fleeing a
normal-speed monster, etc.*/
/* Randomly round the monster's speed to a multiple of NORMAL_SPEED.
This makes it impossible for the player to predict when they'll get
a free turn (thus preventing exploits like "melee kiting"), while
retaining guarantees about shopkeepers not being outsped by a
normal-speed player, normal-speed players being unable to open up
a gap when fleeing a normal-speed monster, etc. */
mmove_adj = mmove % NORMAL_SPEED;
mmove -= mmove_adj;
if (rn2(NORMAL_SPEED) < mmove_adj)
@@ -680,8 +680,9 @@ mcalcdistress()
if (DEADMONSTER(mtmp))
continue;
/* must check non-moving monsters once/turn in case
* they managed to end up in liquid */
/* must check non-moving monsters once/turn in case they managed
to end up in water or lava; note: when not in liquid they regen,
shape-shift, timeout temporary maladies just like other monsters */
if (mtmp->data->mmove == 0) {
if (vision_full_recalc)
vision_recalc(0);