dkfans / keeperfx

Open source remake and Fan Expansion of Dungeon Keeper.
https://keeperfx.net/
GNU General Public License v2.0
748 stars 77 forks source link

Power Lightning broken on battle menu #3272

Open Loobinex opened 3 months ago

Loobinex commented 3 months ago

Bug 1) Does not keep charge To reproduce: 1) Start a fight 2) Open the Battle menu 3) Fully charge lightning outside of the battle menu, keep LMB held 4) Move cursor over to the enemy units to cast it -> notice you cannot cast the charged spell.

Bug 2) Ignores the spell cooldown To reproduce: 1) Start a fight 2) Open the Battle menu 3) Rapidly click the enemy creature while lightning is active -> notice how you can cast as quickly as you can click, while you should have 20 frames delay from the Cooldown value on the [power]

Both got introduced in alpha 3960

PieterVdc commented 1 month ago

somthing with playerstates.toml

Linvail commented 3 days ago

Do we support using overcharge inside the battle menu? I mean the following steps. Do we support this kind of operation?

  1. Start a combat, and open the battle menu.
  2. Go to Keeper's spell menu, and click Lightning spell.
  3. Move the mouse cursor into the battle menu. Move it onto the enemy's icon.
  4. Hold the left mouse key. Try to overcharge. Release the key to cast the spell.
Loobinex commented 2 days ago

When you have your cursor over the battle menu, you should neither lose charge, or be able to charge up more.

EDIT: Seems that actually you should be able to charge up in the menu, you could in the original game at least. But in KeeperFX this has been impossible for many years.

Linvail commented 2 days ago

From what I heard and what I observed in my tests, the current behaviors are:

Bug 1 can be easily fixed by adding "ENEMY_CRTRS" to the Castability of POWER_LIGHTNING. However, it will cause another bug: When moving the cursor out of the battle menu, a non-charged Lightning will be cast on the ground, right on the edge between the battle menu and the normal map. This might be caused by an unwanted Left button release event.

Bug 2 is related to the handling of holding the left button. I can let the charging happen inside the battle menu by hacking get_packet_control_mouse_clicks(), but it causes a bad side effect - one additional Lightning will be cast on the normal map behind the battle menu. It seems related to the left button handling, too.