scotty0100 / wowascension-issues

Issues for WoW Ascension
4 stars 0 forks source link

Class - Warrior - Spell: Last Stand #422

Open kamicolo opened 10 years ago

kamicolo commented 10 years ago

SpellAuras.cpp

    case 12976:                                         // Warrior Last Stand triggered spell (Cast with percentage-value by CastCustomSpell)
    {
        if (Real)
        {
            if (apply)
            {
                target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
                target->ModifyHealth(m_modifier.m_amount);
            }
            else
            {
                if (int32(target->GetHealth()) > m_modifier.m_amount)
                    target->ModifyHealth(-m_modifier.m_amount);
                else
                    target->SetHealth(1);
                    target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
            }
        }
        return;
    }

This will return value 1 healthpoint when you die with the buff last stand.

kamicolo commented 10 years ago

Unit.cpp

int32 Unit::ModifyHealth(int32 dVal) { int32 gain = 0;

if (dVal == 0)
    return 0;

int32 curHealth = (int32)GetHealth();

int32 val = dVal + curHealth;
if (val <= 0)
{
    SetHealth(0);
    return -curHealth;
}

int32 maxHealth = (int32)GetMaxHealth();

if (val < maxHealth)
{
    SetHealth(val);
    gain = val - curHealth;
}
else
{
    SetHealth(maxHealth);
    gain = maxHealth - curHealth;
}

return gain;

}

SetHealth(1) does not exist.

kamicolo commented 10 years ago

Possible FIX SpellAuras.cpp

Change code to:

    case 12976:                                         // Warrior Last Stand triggered spell (Cast with percentage-value by CastCustomSpell)
    {
        if (Real)
        {
            if (apply)
            {
                target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
                target->ModifyHealth(m_modifier.m_amount);
            }
            else
            {
                if (int32(target->GetHealth()) > m_modifier.m_amount)
                    target->ModifyHealth(-m_modifier.m_amount);
                else
                    target->SetHealth(0);
                    target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
            }
        }
        return;
    }

In this case SetHealth(0) will return -curHealth