Legend_of_the_Invincibles icon indicating copy to clipboard operation
Legend_of_the_Invincibles copied to clipboard

enemy (at least) wrath not wrathing very wrathfully

Open white-haired-uncle opened this issue 10 months ago • 3 comments

I noticed recently that lesser lethargy doesn't seem to do much. The wrath is getting set, but it doesn't seem to do anything. I know wrath on side 1 was working in the past, I haven't checked recently.

In the attached, BZB has -2 wrath_intensity. Serves him right. Attack him with the dwarf just to his north and you'll see the attack GUI says he'll do 10 damage, and he does.

Reload, and attack BZB with Argan's great underwear (advance him and take crossbow marksman first?). In my case, BZB's wrath intensity went to -5. Attack him with the dwarf just to his north and you'll see the attack GUI says he'll do 10 damage, and he does.

LotI1-Siege Turn 10.gz

white-haired-uncle avatar Apr 08 '24 19:04 white-haired-uncle

Lethargy and wrath don't work on units controlled by AI. This is not intended.

Dugy avatar Apr 08 '24 23:04 Dugy

Not intended as in it's not working correctly, or it's not intended that wrath/lethargy work for AI units (in which case, why have a lesser lethargy special available to the player)?

white-haired-uncle avatar Apr 08 '24 23:04 white-haired-uncle

Not intended as it's not working correctly. Human controlled units are given a hidden weapon special called latent_wrath which causes the wrath/lethargy variable to have an effect. It's missing on other units, probably as an oversight while moving that code into lua.

The latent_wrath weapon special should be changed to an ability and added to every unit without it by the code that modifies the wrath variable.

Dugy avatar Apr 08 '24 23:04 Dugy

I now see how the latent_wrath works and why AI units don't.

What I don't get is how you would change that from a weapon special to an ability. Don't you need the [damage] weapon special to adjust the damage (before slow/resistance/etc)?

white-haired-uncle avatar May 09 '24 13:05 white-haired-uncle

If a weapon special appears in [abilities], it behaves as an ability that grants the weapon special. It's a relatively new addition.

Dugy avatar May 09 '24 19:05 Dugy

Cool. I'm starting to step through this now, I've moved it from attacks to abilities and I'm starting in on the various levels of events. I'm really wondering if there is (or will be) any reason to have unit.variables.wrath_intensity now, since it's (probably) just going to match unit.abilities.damage.add.

white-haired-uncle avatar May 10 '24 00:05 white-haired-uncle

I'm really wondering if there is (or will be) any reason to have unit.variables.wrath_intensity now, since it's (probably) just going to match unit.abilities.damage.add.

The problem is that there may be multiple [damage] abilities other than wrath.

Dugy avatar May 10 '24 07:05 Dugy

I'm not seeing the problem. There could be other [damage] abilites, but we won't conflict with them as we only touch the one with id=latent_wrath.

white-haired-uncle avatar May 10 '24 10:05 white-haired-uncle

Your question was not explaining it properly. It's not an issue when I see it in your Pull Request.

Dugy avatar May 10 '24 17:05 Dugy

Yeah, I knew when I wrote unit.abilities.damage.add that I was leaving out the "where unit.abilities.damage.id = latent_wrath" part, but I didn't know how to express that.

white-haired-uncle avatar May 10 '24 18:05 white-haired-uncle

I just got an error from my new [set_wrath_intensity] at the start of a scenario. There was a unit on the recall list that had a wrath_intensity and it was trying to decay, but wesnoth.units.get doesn't look at the recall list (I assume, this seems the obvious cause).

I've never paid much attention, so I'm not sure how it's supposed to work. I thought wrath carried over (though I recently ran into something in ch5 which made me think it wanted to be reset at end of scenario), but I've never considered what happens to units on the recall list. Does (should) their wrath_intensity decay as if they were on the map?

white-haired-uncle avatar May 17 '24 00:05 white-haired-uncle

All wrath should be reset to zero at scenario end. Some time is supposed to pass between scenarios, long enough for all wrath to cool down.

Dugy avatar May 17 '24 08:05 Dugy

Before I go looking, any idea where that used to happen?

Hmm, I see it. I even updated it. Now I need to troubleshoot it.

    [event]
        name=start,victory
        first_time_only=no

        [store_unit]
            [filter]
                ability=latent_wrath
            [/filter]
            variable=wrathful
        [/store_unit]
        [for]
            variable=h
            array=wrathful
            [do]
                [set_wrath_intensity]
                    id=$wrathful[$h].id
                    set=0
                [/set_wrath_intensity]
            [/do]
        [/for]
        {CLEAR_VARIABLE wrathful}

```    [/event]

white-haired-uncle avatar May 17 '24 13:05 white-haired-uncle

Shoot, I know why that wasn't working. I had the part that actually removed the ability wrapped inside if debug.

white-haired-uncle avatar May 17 '24 14:05 white-haired-uncle