From 5e32d078603e9fdaaccd8a2c3e05ced2901d7086 Mon Sep 17 00:00:00 2001 From: talamortis Date: Fri, 18 Nov 2016 19:52:14 +0000 Subject: [PATCH 1/5] Core/Script Paladin Argent Defender Fix Spell Paladin Argent Defender --- src/scripts/Spells/spell_paladin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/Spells/spell_paladin.cpp b/src/scripts/Spells/spell_paladin.cpp index c65a925b5..4e51ca62d 100644 --- a/src/scripts/Spells/spell_paladin.cpp +++ b/src/scripts/Spells/spell_paladin.cpp @@ -336,7 +336,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader // Max heal when defense skill denies critical hits from raid bosses // Formula: max defense at level + 140 (raiting from gear) uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140; - float pctFromDefense = (defenseSkillValue - victim->getLevel()*5.0f) / 140.0f; + float pctFromDefense = (defenseSkillValue = victim->getLevel()*5.0f) / 140.0f; if (pctFromDefense < 0.0f) pctFromDefense = 0.0f; else if (pctFromDefense > 1.0f) From c1ee9c737b8a6b7c488e510d3b9bc1c10241ea32 Mon Sep 17 00:00:00 2001 From: talamortis Date: Fri, 18 Nov 2016 21:05:06 +0000 Subject: [PATCH 2/5] Update spell_paladin.cpp --- src/scripts/Spells/spell_paladin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/Spells/spell_paladin.cpp b/src/scripts/Spells/spell_paladin.cpp index 4e51ca62d..9435105e0 100644 --- a/src/scripts/Spells/spell_paladin.cpp +++ b/src/scripts/Spells/spell_paladin.cpp @@ -336,7 +336,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader // Max heal when defense skill denies critical hits from raid bosses // Formula: max defense at level + 140 (raiting from gear) uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140; - float pctFromDefense = (defenseSkillValue = victim->getLevel()*5.0f) / 140.0f; + float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal); if (pctFromDefense < 0.0f) pctFromDefense = 0.0f; else if (pctFromDefense > 1.0f) From 7f4e075003071da2b7ea388da7e18a3945a1243e Mon Sep 17 00:00:00 2001 From: talamortis Date: Fri, 18 Nov 2016 21:49:47 +0000 Subject: [PATCH 3/5] Kurzan Commando Kurzan Commando SmartAI Fix --- data/sql/updates/pending_db_world/rev_1479505563721235300 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1479505563721235300 diff --git a/data/sql/updates/pending_db_world/rev_1479505563721235300 b/data/sql/updates/pending_db_world/rev_1479505563721235300 new file mode 100644 index 000000000..48451954b --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1479505563721235300 @@ -0,0 +1,8 @@ +INSERT INTO version_db_world (`sql_rev`) VALUES ('1479505563721235300'); + +DELETE FROM `smart_scripts` WHERE `entryorguid` = "938"; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(938, 0, 0, 0, 1, 0, 100, 1, 1000, 1000, 0, 0, 11, 1784, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Kurzen Commando - Out of Combat - Cast \'Stealth\''), +(938, 0, 1, 0, 0, 0, 100, 0, 2400, 4100, 2400, 4100, 11, 2591, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Kurzen Commando - In Combat - Cast \'Backstab\''), +(938, 0, 2, 0, 2, 0, 100, 1, 0, 15, 0, 0, 11, 7964, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Kurzen Commando - Between 0-15% Health - Cast \'Smoke Bomb\''); From 5ca25a8362b610f67e29b2339c1161e85ddba45b Mon Sep 17 00:00:00 2001 From: talamortis Date: Mon, 19 Dec 2016 21:36:06 +0000 Subject: [PATCH 4/5] Fix Argent Defender --- src/scripts/Spells/spell_paladin.cpp | 146 ++++++++++++++------------- 1 file changed, 78 insertions(+), 68 deletions(-) diff --git a/src/scripts/Spells/spell_paladin.cpp b/src/scripts/Spells/spell_paladin.cpp index 9435105e0..2def3f844 100644 --- a/src/scripts/Spells/spell_paladin.cpp +++ b/src/scripts/Spells/spell_paladin.cpp @@ -293,82 +293,92 @@ class spell_pal_sacred_shield_base : public SpellScriptLoader // 31850 - Ardent Defender class spell_pal_ardent_defender : public SpellScriptLoader { +public: + spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { } + + class spell_pal_ardent_defender_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pal_ardent_defender_AuraScript); + public: - spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { } - - class spell_pal_ardent_defender_AuraScript : public AuraScript + spell_pal_ardent_defender_AuraScript() { - PrepareAuraScript(spell_pal_ardent_defender_AuraScript); + absorbPct = 0; + healPct = 0; + } - uint32 absorbPct, healPct; + private: + uint32 absorbPct, healPct; - enum Spell - { - PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235, - }; - - bool Load() - { - healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; - } - - void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) - { - // Set absorbtion amount to unlimited - amount = -1; - } - - void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) - { - Unit* victim = GetTarget(); - int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage(); - uint32 allowedHealth = victim->CountPctFromMaxHealth(35); - // If damage kills us - if (remainingHealth <= 0 && !victim->ToPlayer()->HasSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL)) - { - // Cast healing spell, completely avoid damage - absorbAmount = dmgInfo.GetDamage(); - - // xinef: fix logics - uint32 defenseSkillValue = victim->GetDefenseSkillValue(); - // Max heal when defense skill denies critical hits from raid bosses - // Formula: max defense at level + 140 (raiting from gear) - uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140; - float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal); - if (pctFromDefense < 0.0f) - pctFromDefense = 0.0f; - else if (pctFromDefense > 1.0f) - pctFromDefense = 1.0f; - - int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense))); - if (healAmount) - victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff); - - victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, 120000); - } - else if (remainingHealth < int32(allowedHealth)) - { - // Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x% - uint32 damageToReduce = (victim->GetHealth() < allowedHealth) - ? dmgInfo.GetDamage() - : allowedHealth - remainingHealth; - absorbAmount = CalculatePct(damageToReduce, absorbPct); - } - } - - void Register() - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_ardent_defender_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_pal_ardent_defender_AuraScript::Absorb, EFFECT_0); - } + enum Spell + { + PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235 }; - AuraScript* GetAuraScript() const + bool Validate(SpellInfo const* /*spellInfo*/) override { - return new spell_pal_ardent_defender_AuraScript(); + if (!sSpellMgr->GetSpellInfo(PAL_SPELL_ARDENT_DEFENDER_HEAL)) + return false; + return true; } + + bool Load() override + { + healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; + } + + void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + { + // Set absorbtion amount to unlimited + amount = -1; + } + + void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + Unit* victim = GetTarget(); + int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage(); + uint32 allowedHealth = victim->CountPctFromMaxHealth(35); + // If damage kills us + if (remainingHealth <= 0 && !victim->ToPlayer()->HasSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL)) + { + // Cast healing spell, completely avoid damage + absorbAmount = dmgInfo.GetDamage(); + + uint32 defenseSkillValue = victim->GetDefenseSkillValue(); + // Max heal when defense skill denies critical hits from raid bosses + // Formula: max defense at level + 140 (raiting from gear) + uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140; + float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal) + ? 1.0f + : float(defenseSkillValue) / float(reqDefForMaxHeal); + + int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense))); + victim->CastCustomSpell(PAL_SPELL_ARDENT_DEFENDER_HEAL, SPELLVALUE_BASE_POINT0, healAmount, victim, true, nullptr, aurEff); + victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, 120000); + } + else if (remainingHealth < int32(allowedHealth)) + { + // Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x% + uint32 damageToReduce = (victim->GetHealth() < allowedHealth) + ? dmgInfo.GetDamage() + : allowedHealth - remainingHealth; + absorbAmount = CalculatePct(damageToReduce, absorbPct); + } + } + + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_ardent_defender_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_pal_ardent_defender_AuraScript::Absorb, EFFECT_0); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_pal_ardent_defender_AuraScript(); + } }; // 31884 - Avenging Wrath From 17d6fd941817a17ac77aba63df542379bfdfa15d Mon Sep 17 00:00:00 2001 From: talamortis Date: Tue, 20 Dec 2016 07:45:32 +0000 Subject: [PATCH 5/5] indention fix fix indention --- src/scripts/Spells/spell_paladin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/Spells/spell_paladin.cpp b/src/scripts/Spells/spell_paladin.cpp index 2def3f844..164980aee 100644 --- a/src/scripts/Spells/spell_paladin.cpp +++ b/src/scripts/Spells/spell_paladin.cpp @@ -293,8 +293,8 @@ class spell_pal_sacred_shield_base : public SpellScriptLoader // 31850 - Ardent Defender class spell_pal_ardent_defender : public SpellScriptLoader { -public: - spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { } + public: + spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { } class spell_pal_ardent_defender_AuraScript : public AuraScript {