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:
@@ -125,6 +125,7 @@ if a chameleon took vampire form, it would stop periodically changing shape
|
||||
corpses obtained from tipping an ice box wouldn't rot away
|
||||
suppress "you climb up the stairs" message if verbose option is off
|
||||
physical damage from mind flayer attack was being inflicted twice
|
||||
adjust pending movement points when polymorphing into a slower creature
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
@@ -13,6 +13,8 @@ struct monst *mon;
|
||||
struct permonst *ptr;
|
||||
int flag;
|
||||
{
|
||||
int new_speed, old_speed = mon->data ? mon->data->mmove : 0;
|
||||
|
||||
mon->data = ptr;
|
||||
if (flag == -1)
|
||||
return; /* "don't care" */
|
||||
@@ -21,6 +23,15 @@ int flag;
|
||||
mon->mintrinsics |= (ptr->mresists & 0x00FF);
|
||||
else
|
||||
mon->mintrinsics = (ptr->mresists & 0x00FF);
|
||||
|
||||
if (mon->movement) { /* same adjustment as poly'd hero undergoes */
|
||||
new_speed = ptr->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)
|
||||
mon->movement = new_speed * mon->movement / old_speed;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user