MegaMek / megamek

MegaMek is a networked Java clone of BattleTech, a turn-based sci-fi boardgame for 2+ players. Fight using giant robots, tanks, and/or infantry on a hex-based map.
http://www.megamek.org
GNU General Public License v2.0
297 stars 287 forks source link

Bad String in Round Report for Thunder LRMs #225

Closed scJazz2 closed 7 years ago

scJazz2 commented 8 years ago

Weapons fire for Griffin GRF-1N (McCarron's Armoured Cavalry)     LRM 10 at Hex: 3452 (Deliver minefield); needs 8, rolls 4 : Weapons fire for Awesome AWS-8Q (McCarron's Armoured Cavalry)     PPC at Ostroc OSR-2C (Michi) (Reaper Company); needs 12, rolls 7 : misses

    PPC at Ostroc OSR-2C (Michi) (Reaper Company); needs 12, rolls 4 : misses

There should be a new line, etc there in the bolded section.

pheonixstorm commented 8 years ago

I think there should also be a message on where that minefield scattered too.

scJazz2 commented 8 years ago

It is double blind play which is probably why that part is missing and hence the error. But yes if it is visible then it should show the scatter.

arlith commented 8 years ago

Report formatting issues can be incredibly tedious to fix. Basically, without a saved game I can reproduce this with, it won't get fixed. It would be super helpful to not have to reproduce this saved game myself.

BLOODWOLF333 commented 8 years ago

Here is the saved game 0.41.20 (saved during the firing phase).

Player name: BLOODWOLF thunder.zip

arlith commented 7 years ago

What am I supposed to do with this saved game? I see one Griffin with thunder-augmented LRMs, but when I fire them the report looks correct.

arlith commented 7 years ago

Nevermind, I figured this one out. Will post later when I have time.

arlith commented 7 years ago

Alright, so the issue is with LRMScatterHandler.specialResolution which handles applying the mines. The way the reports work is that there's a list of Report objects which store a report # and some data, and that gets turned into the text report that is shown during the report phases.

For double-blind, each Report has a visibility type, which is generally PUBLIC, HIDDEN, or PLAYER. These indicate that the reports should either be seen by all, seen by players who can see the entity the report is related to, or seen only by a specific player.

The bug here is that the reports for delivering the thunder munitions will set the Report type to PLAYER, and for the first two reports the player ID is properly set, however for the later two reports the player ID is not set. This would cause the report to filter incorrectly.

Initially, I set the player ids, thinking it would work, but upon further thought, I've decided that the PLAYER type is wrong here. It doesn't actually obscure anything, because the previous report (ie, "LRM 10 at Hex: 3452 (Deliver minefield); needs 8, rolls 4 : ") already reveals that it is a mine delivery and the location.

Leaving the report as PLAYER would lead to issues like shown up above. The only thing that makes sense here, imo, is HIDDEN, which is what I changed it to. Note that this doesn't affect the visibility of the minefield one deployed. That works with a different mechanism.

Note that this is all theorycrafting, as no saved game was given. I assume double-blind must have been on, because that's the only way this makes sense. It's also an annoying situation to setup.