zcdziura / dreadnought

An automated aetherhunting system for Lusternia
The Unlicense
5 stars 3 forks source link

Autopilot not properly handling multi-creature fighting #3

Open johnathansult opened 8 years ago

johnathansult commented 8 years ago

This bug is triggered when you are fighting two monsters, A and B; A is in your room, B is not, and you are targeting B. When B is destroyed, dreadnought.pilot.aetherbeastsPresent is decremented, even though B was not in your room. This results in the autopilot refusing to move while the ship is attacked at melee range by A.

zcdziura commented 8 years ago

Ah, that's a tricky one to fix. I've run into that issue before occasionally. What would you say is a good solution to fix the problem?

johnathansult commented 8 years ago

If there were a way to get the individual ID numbers of the aetherspace creatures, that would present a clean solution to the problem; unfortunately, I don't know of anything to enable that, so the best solution I can think of is a bit hacky. It'd involve breaking out the .aetherbeastsTotal and .pilot.aetherbeastsPresent quantities such that they track the quantities of each type of creature (both present and in total). This would allow for logic that continues moving if the ranged creature is of a different type than the present creature.

That would still leave the edge case of two same-type creatures, one ranged, one melee. The best fix I can think of for that would be to trigger the melee attack messages to increment .pilot.aetherbeastsPresent if it's not greater than 0, and then immediately trigger the autopilot function.