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
296 stars 286 forks source link

Bug: Floating Turrets cant be targeted but can Target Player under certain LOS circumstances. #3362

Open Thom293 opened 2 years ago

Thom293 commented 2 years ago

Environment

14:38:33,484 INFO [mekhq.MekHQ] {AWT-EventQueue-0} mekhq.MekHQ.showInfo(MekHQ.java:276) - Starting MekHQ v0.49.6 Compiled on Fri Dec 31 15:31:02 CST 2021 Today is 2022-01-08 Java Vendor: AdoptOpenJDK Java Version: 11.0.10 Platform: Windows 10 10.0 (amd64) Total memory available to MegaMek: 2,147,483,648 GB

Description

So I have seen this for a while but it didnt become an issue until the turret was a double PPC turret.

Basic diagram below.

A B C

So A B and C are all on same level. A is Mech. B is Height 2 building. C is Turret on Height 2 building.

Mech A cannot shoot turret C. But turret C can shoot mech A, because, at least as its described to me, Turret is "Floating" one level above building. When dealing with a PPC turret or the like, this is very detrimental to the health of the mech at A.

It was described thusly to me in Discord, so I thought I would just copy and paste.

That's a known issue, I believe. Although worth checking to see if there's a current bug logged on the Git. You need to have LOS to the building, which is what you're targeting, rather than the turret itself. Meanwhile, the turret is occupying the empty level above the building to draw LOS to you, as far as I can tell in your situation. (Yep, I've had that one too.)

Files

I apologize I did not get a save mid battle, but you can see it in this screen. Turrets on height 1 wall. They can target the Crusader, but for the Crusader LOS is blocked.

Screenshot (147)

SimonLandmine commented 1 year ago

As Turrets are implemented as a strange kind of immobile vehicle, would it be possible to make them targetable, like a vehicle or infantry unit parked on or in a building? This would enable a turret "on top" to be targeted like any other unit on top of a building, rather than having this strange invulnerability. As they don't track damage to themselves, it would have to be applied to the building on which they are mounted, as at present.

(An alternative suggestion from one of the Discord users is to simply make it impossible to deploy turrets on the roof of buildings - I'm not sure how that tallies with the tabletop rules for turrets, although many of the computer games appear to depict turrets on rooftops.)

repligator commented 3 months ago

I replicated the setup from #3573 in version 50.00. Princess still can't seem to shoot the turret, but I am getting some interesting log entries.

21:08:22,272 ERROR [megamek.client.bot.princess.Princess] {Princess Turn 0 Calc Thread} megamek.client.bot.princess.Princess.calculateFiringTurn(Princess.java:857) - class megamek.common.BuildingTarget cannot be cast to class megamek.common.Entity (megamek.common.BuildingTarget and megamek.common.Entity are in unnamed module of loader 'app') java.lang.ClassCastException: class megamek.common.BuildingTarget cannot be cast to class megamek.common.Entity (megamek.common.BuildingTarget and megamek.common.Entity are in unnamed module of loader 'app') at megamek.client.bot.princess.Princess.calculateFiringTurn(Princess.java:720) at megamek.client.bot.BotClient.calculateMyTurnWorker(BotClient.java:529) at megamek.client.bot.BotClient.calculateMyTurn(BotClient.java:487) at megamek.client.bot.BotClient$CalculateBotTurn.run(BotClient.java:65) at java.base/java.lang.Thread.run(Thread.java:840)

I was testing some other old bugs, so ignore the lines above 1964. I played one game with the turret on the roof, and next (see attached save) with the turret on level 2. I've also attached a lobby save (pirate_camp_b4) for testing purposes. megamek.log pirate_camp_b4.sav.gz pirate_camp_turret.sav.gz