DarkstarProject / darkstar

DEPRECATED - FFXI Server Emulator - See Project Topaz
https://github.com/project-topaz/topaz
GNU General Public License v3.0
455 stars 549 forks source link

Mob HP refilled erroneously, fills to fast when idle. #6050

Open TeoTwawki opened 5 years ago

TeoTwawki commented 5 years ago

I have:

Client Version (type /ver in game) : n/a

Source Branch (master/stable) : master

Additional Information (Steps to reproduce/Expected behavior) :

Ignore all of this, see new post below..

canRest() or EFFECTFLAG_NO_REST is basically broken for mobs, I am not sure which and I am to tired and frustrated to dig into this further.

The statsus effect disease has the following flags on it:

    EFFECTFLAG_DEATH            = 32,   // исчезает при смерти
    EFFECTFLAG_NO_REST          = 4096,   // prevents resting, curse II, plague, disease
    EFFECTFLAG_WALTZABLE        = 16384,   // for healing waltzable spells
    EFFECTFLAG_NO_CANCEL        = 8388608, // CAN NOT CLICK IT OFF IN CLIENT

If you add it to a mob in onMobSpawn, that mob will still regenerate when idle even though this code in BattleEntity:

bool CBattleEntity::CanRest()
{
    return !getMod(Mod::REGEN_DOWN) && !StatusEffectContainer->HasStatusEffectByFlag(EFFECTFLAG_NO_REST);
}

which is checked by THIS CODE in the mob controller:

            // can't rest with poison or disease
            if (PMob->CanRest())
            {
                // recover 10% health
                if (PMob->Rest(0.1f))
                {
                    // health updated
                    PMob->updatemask |= UPDATE_HP;
                }

                if (PMob->GetHPP() == 100)
                {
                    // at max health undirty exp
                    PMob->m_giveExp = true;
                }
            }

says it should not.

TeoTwawki commented 5 years ago

SO SOME KNUCKLEHEAD MADE IT SO IF THE ZONE GOES EMPTY, EVERY ENTITY STILL IN IT GETS FULL HIT POINTS WHEN SOMEONE ENTERS AGAIN. OBVIOUSLY NOT WHAT HAPPENS ON RETAIL. EVER.

Some NMs on retail I was only able to solo by zoning them and the resuming the battle before they recovered. Can't do that as it stands on Darkstar.

Separate, unconfirmed: sure as F feels like idle mobs heal quicker here than they do on retail also. Tested by putting a mule in zone so it would not trip the above "empty zone refill" bug.

teschnei commented 5 years ago

I think the only way to handle that is by not suspending the zone timers for unoccupied zones, which obviously has some performance implications. Maybe we could consider only suspending it if every mob is already full hp, or making a config option to not suspend them

TeoTwawki commented 5 years ago

we should just be restoring the HP the mob previously had on resume, rather than totally resetting it.

TeoTwawki commented 5 years ago

Now I wonder - does an empty zone wipe local vars off entities that were in it, like if an NPC uses a localvar for something and the zone goes empty is that lost?