Apotheosis

Apotheosis

90M Downloads

[BUG] Usage of add_multiplied_total/add_multiplied_base on generic.max_health

caprichozow opened this issue · 1 comments

commented

I was messing around with the mod, tweaking values to balance health and other stats to my taste. I managed to modify pretty much everything I needed—except for max_health. When using add_multiplied_total or add_multiplied_base instead of add_value, the mob's HP ends up being incorrect upon spawn.

Here’s exactly what I modded:

{
    "type": "apotheosis:attribute",
    "modifier": {
        "attribute": "minecraft:generic.max_health",
        "operation": "add_value",
        "value": 53.6
    },
    "modifier_id": "minecraft:generic.max_health",
    "sort_index": 100,
    "target": "monsters",
    "tier": "frontier"
}

This was added to \data\apotheosis\tier_augments\frontier, named "max_health". By itself, it doesn’t cause any significant issues—HP on spawn is off by about 5 or less, which is probably due to affixes or other modifiers.

However, the part that broke everything was when I started modifying the values of invaders—specifically, the Uncommon Husk, used as a test dummy. The relevant modifications are as follows:

    "stats": {
        "apotheosis:uncommon": {
            "attribute_modifiers": [
                {
                    "attribute": "minecraft:generic.max_health",
                    "operation": "add_multiplied_total",
                    "value": {
                        "min": 5.0,
                        "max": 6.0
                    }
                },
                {
                    "attribute": "minecraft:generic.movement_speed",
                    "operation": "add_multiplied_base",
                    "value": {
                        "min": 0.46,
                        "max": 0.72
                    }
                },
                {
                    "attribute": "minecraft:generic.attack_damage",
                    "operation": "add_multiplied_base",
                    "value": {
                        "min": 5.14,
                        "max": 7.0
                    }
                },
                {
                    "attribute": "minecraft:generic.knockback_resistance",
                    "operation": "add_value",
                    "value": 0.3
                },
                {
                    "attribute": "minecraft:generic.scale",
                    "operation": "add_multiplied_total",
                    "value": {
                        "min": -0.15,
                        "max": 0.25
                    }
                }
            ],
            "effects": [
                {
                    "amplifier": 1.0,
                    "effect": "minecraft:fire_resistance"
                }
            ],
            "enchant_chance": 0.25,
            "enchantment_levels": {
                "primary": 20,
                "secondary": 12
            }
        }

Using either add_multiplied_total or add_multiplied_base on minecraft:generic.max_health causes odd behavior—on spawn, the mob's current health is significantly off, by around 400 or more depending on the value used. With the values above, the mob spawns with about 135 health out of ~450 max health.

Image

This was tested using only Apotheosis + WTHIT (and dependencies).

It doesn't seem like the issue is specific to applying the modifier to invaders or world tiers. In fact, if you swap them—putting the add_multiplied operation in /frontier and using add_value in invaders—the behavior remains largely the same:

Image

However, doing that makes the behavior predictable: the mob always spawns with 73.6 HP out of its max HP, which matches the add_value (53.6) plus vanilla health (20).

TL;DR / Conclusion:
Using add_multiplied_base or add_multiplied_total causes the entity’s HP not to be fully filled at spawn.

Where max_health is modified with add_multiplied_base or add_multiplied_total affects the results:

If the multiplier is on world tier stats and add_value is on invaders, spawn HP will always be add_value + vanilla health.

If it's the opposite, spawn HP seems to be around (add_value * 2) + vanilla health.

Increasing max health with add_value always increases the mob's current HP at spawn.

In contrast, using add_multiplied_base or add_multiplied_total only changes the max HP, not the current HP at spawn—if at all, just ever so slightly.

Neoforge: 21.1.169
Apotheosis-1.21.1-8.3.4.jar
ApothicEnchanting-1.21.1-1.4.0
ApothicSpawners-1.21.1-1.3.0
ApothicAttributes-1.21.1-2.8.0
Placebo-1.21.1-9.8.1
badpackets-neo-0.8.1
wthit-neo-12.4.3

commented

This issue, or at least some part thereof, appears to be a duplicate of #1514, fixed in a9f19fe which will be released in the next release after 8.3.4.