Arkania/ArkCORE-NG

[BUG] World of Glory

Closed this issue · 4 comments

Class: Paladin
What should do : Consumes all Holy Power to heal a friendly target for an amount per charge of Holy Power
What does : Consumes all holly power but consume all the charge as it only had one
Example in player level 50
1 charge must heal 230, real consume 230
2 charge must heal 230x2 , real consume 230
3 charge must heal 230x2 , real consume 230

Maybe this can help you

class spell_pal_word_of_glory_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pal_word_of_glory_AuraScript);

bool Validate(SpellInfo const* /*spellInfo*/) override
{
    return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_PURPOSE_PROC });
}

void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
    Unit* caster = GetCaster();
    if (!caster)
        return;

    if (caster->HasAura(SPELL_PALADIN_DIVINE_PURPOSE_PROC))
        amount += amount * 2;
    else
        amount += amount * caster->GetPower(POWER_HOLY_POWER);

    if (caster != GetUnitOwner())
        if (AuraEffect* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PALADIN, PALADIN_ICOM_ID_SELFLESS_HEALER, EFFECT_0))
            amount += CalculatePct(amount, aurEff->GetAmount());
}

void Register() override
{
    DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_word_of_glory_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_PERIODIC_HEAL);
}

};

SPELL_PALADIN_ETERNAL_GLORY_PROC = 88676,
SPELL_PALADIN_DIVINE_PURPOSE_PROC = 90174,

// 85673 - Word of Glory
class spell_pal_word_of_glory: public SpellScript
{
PrepareSpellScript(spell_pal_word_of_glory);

bool Load() override
{
    if (GetCaster()->GetTypeId() != TYPEID_PLAYER)
        return false;

    if (GetCaster()->ToPlayer()->getClass() != CLASS_PALADIN)
        return false;

    return true;
}

bool Validate(SpellInfo const* /*spellInfo*/) override
{
    return ValidateSpellInfo(
        {
            SPELL_PALADIN_DIVINE_PURPOSE_PROC,
            SPELL_PALADIN_ETERNAL_GLORY_PROC
        });
}

void HandleHeal(SpellEffIndex /*effIndex*/)
{
    Unit* caster = GetCaster();
    if (!caster)
        return;

    int32 heal = GetHitHeal();

    if (caster->HasAura(SPELL_PALADIN_DIVINE_PURPOSE_PROC))
        heal += heal * 2;
    else
        heal += heal * caster->GetPower(POWER_HOLY_POWER);

    if (caster != GetHitUnit())
        if (AuraEffect* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PALADIN, PALADIN_ICOM_ID_SELFLESS_HEALER, EFFECT_0))
            heal += CalculatePct(heal, aurEff->GetAmount());

    SetHitHeal(heal);
}

void HandleEternalGlory()
{
    if (Unit* caster = GetCaster())
    {
        if (AuraEffect* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PALADIN, PALADIN_ICON_ID_ETERNAL_GLORY, EFFECT_0))
        {
            if (roll_chance_i(aurEff->GetAmount()))
            {
                uint8 powerCost = 1 + GetSpell()->GetPowerCost();
                caster->CastCustomSpell(SPELL_PALADIN_ETERNAL_GLORY_PROC, SPELLVALUE_BASE_POINT0, powerCost, caster, true, nullptr, aurEff);
            }
        }
    }
}

void Register() override
{
    OnEffectHitTarget += SpellEffectFn(spell_pal_word_of_glory::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL);
    AfterCast += SpellCastFn(spell_pal_word_of_glory::HandleEternalGlory);
}

};

i have inserted several new spell i found for paladin, includet youre script..
you are welcome to test

it work