ArkCORE-NG icon indicating copy to clipboard operation
ArkCORE-NG copied to clipboard

[BUG] Guardian of Ancient Kings

Open CrossUCI opened this issue 6 years ago • 3 comments

Class : Paladin Spec : Retribution What should do : Holy Shock : Summons a Guardian of Ancient Kings to protect you for 30 sec. While active, your next 5 heals will cause the Guardian to heal the same target for the amount healed by your heal, and friendly targets within 10 yards of the target for 10% of the amount healed. Avenger's Shield : Summons a Guardian of Ancient Kings to protect you for 12 sec. While the Guardian is active, all incoming damage is reduced by 60%. Templar's Verdict : Summons a Guardian of Ancient Kings to attack your current target for 12 sec. While active, your and your Guardian's attacks cause you to be infused with Ancient Power, increasing your Strength by 20 per application. After 12 sec or when your Guardian is killed, you will release Ancient Fury, causing 100 damage plus 100 per application of Ancient Power, divided among all targets within 10 yards. What does : Only summon the angel and attack the target if you are attacked.

CrossUCI avatar Oct 11 '18 17:10 CrossUCI

This script fix a lot but need to rework , because summon more than one angel but it works

enum PaladinGuardianOfAncientKingsSpells

{

SPELL_PALADIN_GOAK_HOLY_SUMMON = 86669,
SPELL_PALADIN_GOAK_ANCIENT_HEALER = 86674,
SPELL_PALADIN_GOAK_PROTECTION_SUMMON = 86659,
SPELL_PALADIN_GOAK_RETRIBUTION_SUMMON = 86698,
SPELL_PALADIN_GOAK_ANCIENT_POWER = 86700,
SPELL_PALADIN_GOAK_ANCIENT_CRUSADER = 86701,
SPELL_PALADIN_GOAK_ANCIENT_CRUSADER_GUARDIAN = 86703,
SPELL_PALADIN_GOAK_ANCIENT_FURY = 86704,

};

// 86704 - Ancient Fury class spell_pal_ancient_fury : public SpellScriptLoader { public: spell_pal_ancient_fury() : SpellScriptLoader("spell_pal_ancient_fury") { }

class spell_pal_ancient_fury_SpellScript : public SpellScript
{
	PrepareSpellScript(spell_pal_ancient_fury_SpellScript);

	void CountTargets(std::list<WorldObject*>& targetList)
	{
		_targetCount = targetList.size();
	}

	void ChangeDamage(SpellEffIndex /*effIndex*/)
	{
		Unit* caster = GetCaster();
		Unit* target = GetHitUnit();

		if (caster && target && _targetCount)
		{
			int32 damage = GetHitDamage();

			if (Aura* aura = caster->GetAura(SPELL_PALADIN_GOAK_ANCIENT_POWER))
			{
				damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
				damage = (damage * aura->GetStackAmount());

				// "divided evenly among all targets"
				damage /= _targetCount;
			}

			SetHitDamage(damage);
		}
	}
private:
	uint32 _targetCount;

	void Register()
	{
		OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_ancient_fury_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
		OnEffectHitTarget += SpellEffectFn(spell_pal_ancient_fury_SpellScript::ChangeDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
	}
};

SpellScript* GetSpellScript() const
{
	return new spell_pal_ancient_fury_SpellScript();
}

};

// 86698 - Guardian of Ancient Kings Retribution class spell_pal_guardian_of_ancient_kings_retri : public SpellScriptLoader { public: spell_pal_guardian_of_ancient_kings_retri() : SpellScriptLoader("spell_pal_guardian_of_ancient_kings_retri") { }

class spell_pal_guardian_of_ancient_kings_retri_AuraScript : public AuraScript
{
	PrepareAuraScript(spell_pal_guardian_of_ancient_kings_retri_AuraScript);

	void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
	{
		Unit* caster = GetCaster();
		Unit* target = GetTarget();

		if (caster && target)
		{
			if (GetStackAmount())
			{
				caster->CastSpell(target, SPELL_PALADIN_GOAK_ANCIENT_FURY, true);
			}
		}
	}

	void Register()
	{
		OnEffectRemove += AuraEffectRemoveFn(spell_pal_guardian_of_ancient_kings_retri_AuraScript::HandleRemove, EFFECT_2, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
	}
};

AuraScript* GetAuraScript() const
{
	return new spell_pal_guardian_of_ancient_kings_retri_AuraScript();
}

};

// 86150 - Guardian of Ancient Kings action bar spell class spell_pal_guardian_of_ancient_kings : public SpellScriptLoader { public: spell_pal_guardian_of_ancient_kings() : SpellScriptLoader("spell_pal_guardian_of_ancient_kings") { }

class spell_pal_guardian_of_ancient_kings_SpellScript : public SpellScript
{
	PrepareSpellScript(spell_pal_guardian_of_ancient_kings_SpellScript);

	void HandleDummy(SpellEffIndex /*effIndex*/)
	{
		if (Unit* caster = GetCaster())
		{
			if (Player* player = caster->ToPlayer())
			{
				switch (player->GetPrimaryTalentTree(player->GetActiveSpec()))
				{
					// Holy Guardian
				case TALENT_TREE_PALADIN_HOLY:
					caster->CastSpell(caster, SPELL_PALADIN_GOAK_HOLY_SUMMON, true);

					// 5 stack buff
					caster->CastSpell(caster, SPELL_PALADIN_GOAK_ANCIENT_HEALER, true);
					break;
					// Protection Guardian
				case TALENT_TREE_PALADIN_PROTECTION:
					caster->CastSpell(caster, SPELL_PALADIN_GOAK_PROTECTION_SUMMON, true);
					break;
					// Retribution Guardian
				case TALENT_TREE_PALADIN_RETRIBUTION:
					caster->CastSpell(caster, SPELL_PALADIN_GOAK_RETRIBUTION_SUMMON, true);

					// Ancient Power proc buff
					caster->CastSpell(caster, SPELL_PALADIN_GOAK_ANCIENT_CRUSADER, true);
					break;
				}
			}
		}
	}

	void Register()
	{
		OnEffectHitTarget += SpellEffectFn(spell_pal_guardian_of_ancient_kings_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
	}
};

SpellScript* GetSpellScript() const
{
	return new spell_pal_guardian_of_ancient_kings_SpellScript();
}

};

void AddSC_paladin_spell_scripts() { new spell_pal_guardian_of_ancient_kings_retri(); new spell_pal_guardian_of_ancient_kings(); new spell_pal_ancient_fury(); }

DELETE FROM spell_script_names WHERE spell_id=86698 and ScriptName="spell_pal_guardian_of_ancient_kings_retri"; INSERT INTO spell_script_names VALUES (86698, "spell_pal_guardian_of_ancient_kings_retri");

DELETE FROM spell_script_names WHERE spell_id=86150 and ScriptName="spell_pal_guardian_of_ancient_kings"; INSERT INTO spell_script_names VALUES (86150, "spell_pal_guardian_of_ancient_kings");

DELETE FROM spell_script_names WHERE spell_id=86704 and ScriptName="spell_pal_ancient_fury"; INSERT INTO spell_script_names VALUES (86704, "spell_pal_ancient_fury");

CrossUCI avatar Oct 11 '18 18:10 CrossUCI

i fixed the issue of multiple angels and the remove buff from retribuition summon, but in the holy specialization when i summon the angel after the healing number 5, the server not reponse

CrossUCI avatar Oct 14 '18 15:10 CrossUCI

Acient Fury Script still remaining the same...

// 86698 - Guardian of Ancient Kings Retribution class spell_pal_guardian_of_ancient_kings_retri : public SpellScriptLoader { public: spell_pal_guardian_of_ancient_kings_retri() : SpellScriptLoader("spell_pal_guardian_of_ancient_kings_retri") { }

class spell_pal_guardian_of_ancient_kings_retri_AuraScript : public AuraScript
{
    PrepareAuraScript(spell_pal_guardian_of_ancient_kings_retri_AuraScript);

	void Remove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
	{
		if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
			return;

		Unit* target = GetTarget();
		Aura* stacks = target->GetAura(SPELL_PALADIN_GOAK_ANCIENT_POWER, target->GetGUID());
		if (!stacks)
			return;

		int32 bp0 = sSpellMgr->GetSpellInfo(SPELL_PALADIN_GOAK_ANCIENT_FURY)->Effects[EFFECT_0].CalcValue(target) * stacks->GetStackAmount();
		target->CastCustomSpell(target, SPELL_PALADIN_GOAK_ANCIENT_FURY, &bp0, NULL, NULL, true);
		target->RemoveAurasDueToSpell(SPELL_PALADIN_GOAK_ANCIENT_POWER);
		target->RemoveAurasDueToSpell(SPELL_PALADIN_GOAK_ANCIENT_CRUSADER);
	}

	void Register()
	{
		OnEffectRemove += AuraEffectRemoveFn(spell_pal_guardian_of_ancient_kings_retri_AuraScript::Remove, EFFECT_2, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
	}
};

AuraScript* GetAuraScript() const
{
    return new spell_pal_guardian_of_ancient_kings_retri_AuraScript();
}

};

// 86150 - Guardian of Ancient Kings action bar spell class spell_pal_guardian_of_ancient_kings : public SpellScriptLoader { public: spell_pal_guardian_of_ancient_kings() : SpellScriptLoader("spell_pal_guardian_of_ancient_kings") { }

class spell_pal_guardian_of_ancient_kings_SpellScript : public SpellScript
{
    PrepareSpellScript(spell_pal_guardian_of_ancient_kings_SpellScript);

	void HandleOnHit()
	{
		Unit* caster = GetCaster();
		if (!caster)
			return;

		// Choose which guardian to summon based on spec
		switch (caster->ToPlayer()->GetPrimaryTalentTree(caster->ToPlayer()->GetActiveSpec()))
		{
		case TALENT_TREE_PALADIN_HOLY:
			caster->RemoveAllMinionsByEntry(46499);
			caster->CastSpell(caster, SPELL_PALADIN_GOAK_HOLY_SUMMON, true);
			caster->CastSpell(caster, SPELL_PALADIN_GOAK_ANCIENT_HEALER, true);
			break;
		case TALENT_TREE_PALADIN_PROTECTION:
			caster->RemoveAllMinionsByEntry(46490);
			caster->CastSpell(caster, SPELL_PALADIN_GOAK_PROTECTION_SUMMON, true);
			break;
		case TALENT_TREE_PALADIN_RETRIBUTION:
			caster->RemoveAllMinionsByEntry(46506);
			caster->CastSpell(caster, SPELL_PALADIN_GOAK_RETRIBUTION_SUMMON, true);
			caster->CastSpell(caster, SPELL_PALADIN_GOAK_ANCIENT_CRUSADER, true);
			break;
		default:
			return;
		}
	}

    void Register()
    {
		OnHit += SpellHitFn(spell_pal_guardian_of_ancient_kings_SpellScript::HandleOnHit);
    }
};

SpellScript* GetSpellScript() const
{
    return new spell_pal_guardian_of_ancient_kings_SpellScript();
}

};

CrossUCI avatar Oct 14 '18 15:10 CrossUCI