Legend_of_the_Invincibles icon indicating copy to clipboard operation
Legend_of_the_Invincibles copied to clipboard

Spirits of a Madman's Alacrity is permanent for Lethalia

Open arobinson opened this issue 4 years ago • 8 comments

This never happened when I played your scenario before, so I think it is a bug? I have a Spirits of a Madman's Alacrity to Lethalia in the 2nd campaign and she never lost the 2nd attack during upgrades.

Including a save game for reproduction LotI2-Shores of Abyss-Auto-Save8.gz

arobinson avatar Nov 04 '20 17:11 arobinson

I think your report is confused. Potions go away when you level. Lethalia is not about to level, so that is a poor save to demonstrate the bug. If I level her, the potions go away. Are you thinking they go away if you change equipment?

dalong76 avatar Nov 24 '20 13:11 dalong76

I have been reported this on the forums and it seems that there is really such an issue. However, there is a critical additional condition that has to apply - the unit must levelup during the enemy turn. This save file should allow repeating it: LotI2-Test Scenario - potions dont vanish during enemy turn.gz

Dugy avatar Nov 29 '20 22:11 Dugy

What workflow is supposed to happen when leveling? I think leveling on enemy turn vs your turn ends up in very different places. On your own turn, I think global_events.cfg calls main.lua pre_advance_stuff and advance_stuff, and that's the big work.

On the enemy turn, I think it looks like this: pre_advance_stuff from global_events.cfg pre_advance_stuff from main.lua sets may_need_respec turn refresh in global_events.cfg checks may_need_respec and fires force respec, which does a ton In other words, I think the main work happens in global_events.cfg under force respec instead of in main.lua under advance_stuff

Am I correct? Where am I wrong? I'm a professional computer programmer, but lua confuses me.

dalong76 avatar Dec 07 '20 08:12 dalong76

The advancement code is wacky because it needs a messy workaround that prevents an issue causing massive FPS drops. I developed it entirely through trial and error, later, I was told that its behaviour was a bug, when they fixed it, it had to be rewritten again. Also, I wasn't good at software design when I was writing LotI. The rewrite of some parts to lua helped, but it definitely didn't solve all problems.

The potion removal part is supposed to take place in advance_stuff in main.cfg. The force respec event only triggers an advancement that is necessary to start the core advancement process.

Dugy avatar Dec 07 '20 18:12 Dugy

If the purpose of force respec now is just to trigger an advancement, why does it have all that stuff in it? It looks like force respec is changing to the special "Advancing" unit type. But lua pre_advance_stuff does that too.

dalong76 avatar Dec 08 '20 20:12 dalong76

It also has a purpose with altering the last advancement the unit had, but I can't remember which one is responsible for what. This part was trial and error.

Dugy avatar Dec 08 '20 20:12 Dugy

There is an event fur turn refresh that checks variable may_need_respec and uses that to fire force respec. If that skipped force respec and went straight to lua pre_advance_stuff and advance_stuff, is that reasonable? I'm asking before trying some of these because you might see horrible side effects that I don't.

dalong76 avatar Dec 08 '20 21:12 dalong76

That check in turn_refresh checks for units that had advanced during the enemy turn. I think that skipping force respec would not start the unit advancement process and never open the dialogue that bids the player to select the advancement. However, I am not sure, it's probably the best to try and see.

Dugy avatar Dec 08 '20 21:12 Dugy