Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up[bugfix] Exise speed attribute from monster. #9007
Conversation
kevingranade
added
the
(S2 - Confirmed)
label
Sep 15, 2014
Rivet-the-Zombie
added a commit
that referenced
this pull request
Sep 15, 2014
Rivet-the-Zombie
merged commit bd401ab
into
CleverRaven:master
Sep 15, 2014
1 check passed
kevingranade
removed
the
(S2 - Confirmed)
label
Sep 15, 2014
BevapDin
reviewed
Sep 15, 2014
| @@ -361,7 +361,7 @@ void mdeath::blobsplit(monster *z) | |||
| return; | |||
| } | |||
| monster blob(GetMType((speed < 50 ? "mon_blob_small" : "mon_blob"))); | |||
| blob.speed = speed; | |||
| blob.set_speed_bonus( speed - blob.get_speed_base() ); | |||
This comment has been minimized.
This comment has been minimized.
BevapDin
Sep 15, 2014
Contributor
This should probably set the base speed. The speed bonus is reset and lost at the end of the turn, so every blob ends up with the default speed again. The above should also test the local variable speed, not z->get_speed, because the local variable has been reduces by a random amount and the previous code used the local variable.
Edit: a similar problem might be in mattack::resurrect / mattack::formblob. The speed bonus is gone on the next turn and the function would behave like on the first call.
BevapDin
reviewed
Sep 15, 2014
| @@ -1871,6 +1871,8 @@ void monster::load_legacy(std::stringstream & dump) { | |||
| // load->int->str->int (possibly shifted) | |||
| type = GetMType( legacy_mon_id[idtmp] ); | |||
|
|
|||
| Creature::set_speed_bonus( speed - type->speed ); | |||
This comment has been minimized.
This comment has been minimized.
BevapDin
Sep 15, 2014
Contributor
I think in this situation the base speed is not initialized to the monster type specific value. The monster type is first known at line 1872, the base speed can not be known before that and there is no setting of the based speed afterwards. The speed is actually initialized to 100 in the Creature constructor, but is not monster type specific.
This comment has been minimized.
This comment has been minimized.
|
Thanks, I had missed that speed bonus resets every turn. |
kevingranade commentedSep 15, 2014
Fixes being unable to hit monsters due to superspeed as reported at http://smf.cataclysmdda.com/index.php?topic=7771
Fixes #8991
Fixes #9006
The fix is super long, because there was actually a huge latent bug in that the transition from using monster::speed to creature::get_speed() and friends was stopped part way through, so roughly half the code was using one, and half was using the other.
This was triggered by BevapDin's save/load streamlining, because the old code was actually saving/loading more than it should have and hiding this bug.
The extra good news is that it didn't mutate any values, so it's a rare save/load bug that will go back to normal after applying the fix.