Skip to content

Instantly share code, notes, and snippets.

@tobmaps
Created November 26, 2011 19:23
Show Gist options
  • Save tobmaps/1396175 to your computer and use it in GitHub Desktop.
Save tobmaps/1396175 to your computer and use it in GitHub Desktop.
damage reduction buffs v0.1
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index f0b48a5..65c038e 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1359,6 +1359,51 @@ public:
}
};
+enum PlayerBuffs
+{
+ SPELL_BLESSING_OF_SANCTUARY = 20911,
+ SPELL_GREATER_BLESSING_OF_SANCTUARY = 25899,
+ SPELL_VIGILANCE = 50720,
+ SPELL_RENEWED_HOPE = 63944,
+ SPELL_DAMAGE_REDUCTION = 68066
+};
+
+class spell_player_damage_reduction_buffs : public SpellScriptLoader
+{
+ public:
+ spell_player_damage_reduction_buffs() : SpellScriptLoader("spell_player_damage_reduction_buffs") { }
+
+ class spell_player_damage_reduction_buffs_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_player_damage_reduction_buffs_AuraScript);
+
+ void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->CastSpell(target, SPELL_DAMAGE_REDUCTION, true);
+ }
+
+ void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ if (!target->HasAura(SPELL_BLESSING_OF_SANCTUARY) && !target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) &&
+ !target->HasAura(SPELL_VIGILANCE) && !target->HasAura(SPELL_RENEWED_HOPE))
+ target->RemoveAura(SPELL_DAMAGE_REDUCTION);
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_player_damage_reduction_buffs_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_player_damage_reduction_buffs_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_player_damage_reduction_buffs_AuraScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -1390,4 +1435,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_launch();
new spell_gen_vehicle_scaling();
new spell_gen_oracle_wolvar_reputation();
+ new spell_player_damage_reduction_buffs();
}
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index be6e1c4..aa607e6 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -89,8 +89,52 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader
}
};
+enum PlayerBuffs
+{
+ SPELL_BLESSING_OF_SANCTUARY = 20911,
+ SPELL_GREATER_BLESSING_OF_SANCTUARY = 25899,
+ SPELL_RENEWED_HOPE = 63944,
+ SPELL_DAMAGE_REDUCTION = 68066
+};
+
+class spell_warr_vigilance : public SpellScriptLoader
+{
+ public:
+ spell_warr_vigilance() : SpellScriptLoader("spell_warr_vigilance") { }
+
+ class spell_warr_vigilance_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warr_vigilance_AuraScript);
+
+ void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->CastSpell(target, SPELL_DAMAGE_REDUCTION, true);
+ }
+
+ void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ if (!target->HasAura(SPELL_BLESSING_OF_SANCTUARY) &&!target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) && !target->HasAura(SPELL_RENEWED_HOPE))
+ target->RemoveAura(SPELL_DAMAGE_REDUCTION);
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_warr_vigilance_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_warr_vigilance_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warr_vigilance_AuraScript();
+ }
+};
+
void AddSC_warrior_spell_scripts()
{
new spell_warr_last_stand();
new spell_warr_improved_spell_reflection();
+ new spell_warr_vigilance();
}
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_warr_vigilance','spell_player_damage_reduction_buffs');
INSERT INTO `spell_script_names` VALUES
(50720,'spell_warr_vigilance'),
(20911,'spell_player_damage_reduction_buffs'),
(25899,'spell_player_damage_reduction_buffs'),
(63944,'spell_player_damage_reduction_buffs');
@tobmaps
Copy link
Author

tobmaps commented Nov 26, 2011

didn't tested even for compile, requires some sql data ofc.

Also requires same aura script for Vigilance, it can't be done in one place with others because it doesn't have spell_aura_dummy

@Expecto
Copy link

Expecto commented Nov 26, 2011

sql file?

@tobmaps
Copy link
Author

tobmaps commented Nov 27, 2011

updated, still didn't tested yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment