fix part of #H2343 - youmonst.movement vs poly

From a July 2011 report listing multiple movement anomalies, fix one
of the easier ones.  If you polymorph from a fast from into a slow
one, pending movement points can let the slow form get in some moves
it shouldn't.

I've deliberately avoided adjusting pending movement when you change
into a faster form, which will get it's own movement boost on the
next turn.
This commit is contained in:
PatR
2016-01-25 18:18:35 -08:00
parent 5a9e00d0dd
commit 489445da02
3 changed files with 23 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ void
set_uasmon()
{
struct permonst *mdat = &mons[u.umonnum];
int new_speed, old_speed = youmonst.data ? youmonst.data->mmove : 0;
set_mon_data(&youmonst, mdat, 0);
@@ -92,16 +93,23 @@ set_uasmon()
PROPSET(PASSES_WALLS, passes_walls(mdat));
PROPSET(REGENERATION, regenerates(mdat));
PROPSET(REFLECTING, (mdat == &mons[PM_SILVER_DRAGON]));
#undef PROPSET
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
polysense();
#undef PROPSET
if (youmonst.movement) {
new_speed = mdat->mmove;
/* prorate unused movement if new form is slower so that
it doesn't get extra moves leftover from previous form;
if new form is faster, leave unused movement as is */
if (new_speed < old_speed)
youmonst.movement = new_speed * youmonst.movement / old_speed;
}
#ifdef STATUS_VIA_WINDOWPORT
status_initialize(REASSESS_ONLY);
#endif
polysense();
}
/* Levitation overrides Flying; set or clear BFlying|I_SPECIAL */