Merge pull request #287 from talamortis/talamortis-patch-2

Fix and Argent Defender & Kurzan Commando stealth
This commit is contained in:
talamortis
2017-01-10 20:30:26 +00:00
committed by GitHub
2 changed files with 84 additions and 66 deletions
@@ -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\'');
+23 -13
View File
@@ -300,14 +300,29 @@ class spell_pal_ardent_defender : public SpellScriptLoader
{
PrepareAuraScript(spell_pal_ardent_defender_AuraScript);
public:
spell_pal_ardent_defender_AuraScript()
{
absorbPct = 0;
healPct = 0;
}
private:
uint32 absorbPct, healPct;
enum Spell
{
PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235,
PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235
};
bool Load()
bool Validate(SpellInfo const* /*spellInfo*/) override
{
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();
@@ -331,21 +346,16 @@ class spell_pal_ardent_defender : public SpellScriptLoader
// 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 - victim->getLevel()*5.0f) / 140.0f;
if (pctFromDefense < 0.0f)
pctFromDefense = 0.0f;
else if (pctFromDefense > 1.0f)
pctFromDefense = 1.0f;
float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
? 1.0f
: float(defenseSkillValue) / float(reqDefForMaxHeal);
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->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))
@@ -358,14 +368,14 @@ class spell_pal_ardent_defender : public SpellScriptLoader
}
}
void Register()
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
AuraScript* GetAuraScript() const override
{
return new spell_pal_ardent_defender_AuraScript();
}