diff options
author | Charles Otto <ottochar@gmail.com> | 2009-11-05 01:51:40 -0500 |
---|---|---|
committer | Charles Otto <ottochar@gmail.com> | 2009-11-05 01:51:40 -0500 |
commit | 1dcf964cd3782c4e559d9422f199d127eb4eb8a4 (patch) | |
tree | eba96bab37811422121b55628a66f66d6972430f /crawl-ref/source/mon-abil.cc | |
parent | b9593f0b29d9201502c53a35a43389b175943b61 (diff) | |
download | crawl-ref-1dcf964cd3782c4e559d9422f199d127eb4eb8a4.tar.gz crawl-ref-1dcf964cd3782c4e559d9422f199d127eb4eb8a4.zip |
Make merging slime creatures lose at most 1 turn after the merge.
If two (or more I guess) slime merge onto a third slime in one turn
make the merged slime only lose 1 turn.
Diffstat (limited to 'crawl-ref/source/mon-abil.cc')
-rw-r--r-- | crawl-ref/source/mon-abil.cc | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc index b6e430ca40..69fbcf3a03 100644 --- a/crawl-ref/source/mon-abil.cc +++ b/crawl-ref/source/mon-abil.cc @@ -246,20 +246,33 @@ static bool _do_merge(monsters *initial_slime, monsters *merge_to) // Merging costs the combined slime some energy. monsterentry* entry = get_monster_data(merge_to->type); - merge_to->speed_increment -= entry->energy_usage.move; - - // This is dumb. With that said, the idea is that if 2 slimes merge - // you can gain a space by moving away the turn after (maybe this is - // too nice but there will probably be a lot of complaints about the - // damage on higher level slimes). So we subtracted some energy - // above, but if merge_to hasn't moved yet this turn, that will just - // cancel its turn in this round of world_reacts(). So we are going - // to see if merge_to has gone already by checking its mindex (this - // works because handle_monsters just iterates over env.mons in - // ascending order). - if (initial_slime->mindex() < merge_to->mindex()) + + // We want to find out if merge_to will move next time it has a turn + // (assuming for the sake of argument the next delay is 10). The + // purpose of subtracting energy from merge_to is to make it lose a + // turn after the merge takes place, if it's already going to lose + // a turn we don't need to do anything. + merge_to->speed_increment += entry->speed; + bool can_move = merge_to->has_action_energy(); + merge_to->speed_increment -= entry->speed; + + if(can_move) + { merge_to->speed_increment -= entry->energy_usage.move; + // This is dumb. With that said, the idea is that if 2 slimes merge + // you can gain a space by moving away the turn after (maybe this is + // too nice but there will probably be a lot of complaints about the + // damage on higher level slimes). So we subtracted some energy + // above, but if merge_to hasn't moved yet this turn, that will just + // cancel its turn in this round of world_reacts(). So we are going + // to see if merge_to has gone already by checking its mindex (this + // works because handle_monsters just iterates over env.mons in + // ascending order). + if (initial_slime->mindex() < merge_to->mindex()) + merge_to->speed_increment -= entry->energy_usage.move; + } + // Overwrite the state of the slime getting merged into, because it // might have been resting or something. merge_to->behaviour = initial_slime->behaviour; |