Skip to content

Monster::transcribe_monster_actions() does not behave as expected #31

@Lyle-Tafoya

Description

@Lyle-Tafoya

Basically there are 3 closely related problems, but a little bit of explanation is required before we can get to those.

Monsters with '?' in their meleestr are expected to cheat when it comes to their combat actions. In transcribe_monster_actions() it tallies up the total number of times the player blocks and attacks each location (high, center, or low) using 2 different int arrays p_blocks and p_attacks. Whichever location the player blocks the least is where a monster with "A?" in it's meleestr will attack (assuming it passes it's check. Otherwise it attacks a random location). It stands to reason that we should also expect "B?" to result in the monster blocking whichever location the player attacks the most. This leads us to the 2 bugs:

  1. Instead of blocking the location the player attacks the most, it actually blocks the location the player attacks the least. I believe this is the result of a simple copy/paste error by a previous dev for the project (possibly Laurence Brothers himself). Simply flipping from < to > in the relevant if-statements solves this.
  2. The game fails to accurately tally up the number of player attacks for each location. The reason it fails is because it only looks for 'A' or 'L' in Player.meleestr. However, as far as I know, 'A' will never be found in Player.meleestr. When the player sets their combat actions (in tacoptions() found in command3.cpp), 'A' gets turned into 'C' or 'T' in Player.meleestr depending on the type of weapon wielded by the player.
  3. This one may not actually be a real bug, but it kinda smells like one. transcribe_monster_actions() only checks for uppercase characters in Player.meleestr. I haven't checked every location that Player.meleestr is set in the source, but I do know that in goberserk() it sets Player.meleestr to "lLlClH". However, I do think it's' possible it uses lowercase on purpose in this instance in order to avoid having "B?" monsters cheat against the player. As a result of this, the monster will always block low (when it passes it's checks) because of the order of the if-statements it uses to determine which location has the least number of incoming attacks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions