partizanes
10.07.2011, 03:18
Оригинальная тема http://getmangos.com/community/topic/13021/patchspellaura284/
Автор laise
Автор Источника для последней ревизии : RSA
Косяки:
Не обрабатывает все значения , хотя как думаю я ,проблема далеко не в этой ауре ,а в других .
В Поиске Всех упущенных моментов и попытка допилить до конца.
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h
index 6f88c7d..4557ab4 100644
--- a/src/game/SpellAuraDefines.h
+++ b/src/game/SpellAuraDefines.h
@@ -319,7 +319,7 @@ enum AuraType
SPELL_AURA_MOD_HONOR_GAIN = 281,
SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells
- SPELL_AURA_284,
+ SPELL_AURA_TRIGGERED = 284,
SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285,
SPELL_AURA_ABILITY_PERIODIC_CRIT = 286,
SPELL_AURA_DEFLECT_SPELLS = 287,
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index b227526..d3fcdd0 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -334,7 +334,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNoImmediateEffect, //281 SPELL_AURA_MOD_HONOR_GAIN implemented in Player::RewardHonor
&Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
&Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonusTaken
- &Aura::HandleNULL, //284 51 spells
+ &Aura::HandleAuraTriggered, //284 SPELL_AURA_TRIGGERED
&Aura::HandleAuraModAttackPowerOfArmor, //285 SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR implemented in Player::UpdateAttackPowerAndDamage
&Aura::HandleNoImmediateEffect, //286 SPELL_AURA_ABILITY_PERIODIC_CRIT implemented in Aura::IsCritFromAbilityAura called from Aura::PeriodicTick
&Aura::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
@@ -9765,3 +9765,49 @@ void SpellAuraHolder::UnregisterSingleCastHolder()
m_isSingleTarget = false;
}
}
+
+void Aura::HandleAuraTriggered(bool apply, bool Real)
+{
+ if (!Real)
+ return;
+
+ uint32 TriggerSpell = GetSpellProto()->EffectTriggerSpell[m_effIndex];
+ SpellEntry const *spellInfo = sSpellStore.LookupEntry(TriggerSpell);
+ if (!spellInfo)
+ {
+ sLog.outError("TriggerSpell for spell %u effect %u: triggering unknown spell %u", +GetSpellProto()->Id, m_effIndex, TriggerSpell);
+ return;
+ }
+
+ if (apply)
+ {
+ if (GetCaster() &&
+ GetCaster()->GetTypeId() == TYPEID_PLAYER &&
+ GetTarget() &&
+ GetTarget()->GetTypeId() != TYPEID_PLAYER &&
+ spellInfo->AttributesEx & SPELL_ATTR_EX_UNK28 &&
+ spellInfo->Attributes & SPELL_ATTR_UNK8)
+ {
+ float healBonus = +float(GetCaster()->GetTotalAuraModifier(SPELL_AURA_MOD_HEALING_PCT))/100.0;
+ if (healBonus < 0.0)
+ healBonus = 0.0;
+ float damageBonus = float(GetCaster()->CalculateDamage(BASE_ATTACK, +false)/GetCaster()->GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE)) - 1.0;
+ if (damageBonus < 0.0)
+ damageBonus = 0.0;
+ float healthBonus = +float(GetCaster()->GetMaxHealth()/(GetCaster()->GetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE) + +GetCaster()->GetCreateHealth())) - 1.0;
+ if (healthBonus < 0)
+ healthBonus = 0.0;
+
+ int32 bp0 = int32((spellInfo->EffectBasePoints[EFFECT_INDEX_0] + healBonus) * 100);
+ int32 bp1 = int32((spellInfo->EffectBasePoints[EFFECT_INDEX_1] + damageBonus) * 100);
+ int32 bp2 = int32((spellInfo->EffectBasePoints[EFFECT_INDEX_2] + healthBonus) * 100);
+
+ GetTarget()->CastCustomSpell(GetTarget(), spellInfo, &bp0, &bp1, &bp2, +GetCasterGuid());
+ GetTarget()->SetHealth(GetTarget()->GetMaxHealth());
+ }
+ else
+ GetTarget()->CastSpell(GetTarget(), spellInfo, true, NULL, this);
+ }
+ else
+ GetTarget()->RemoveAurasByCasterSpell(TriggerSpell, GetCasterGuid());
+}
\ No newline at end of file
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 51c553a..ffc5af4 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -373,6 +373,7 @@ class MANGOS_DLL_SPEC Aura
void HandleAuraOpenStable(bool apply, bool Real);
void HandleAuraAddMechanicAbilities(bool apply, bool Real);
void HandleAuraStopNaturalManaRegen(bool apply, bool real);
+ void HandleAuraTriggered(bool Apply, bool Real);
virtual ~Aura();
Автор laise
Автор Источника для последней ревизии : RSA
Косяки:
Не обрабатывает все значения , хотя как думаю я ,проблема далеко не в этой ауре ,а в других .
В Поиске Всех упущенных моментов и попытка допилить до конца.
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h
index 6f88c7d..4557ab4 100644
--- a/src/game/SpellAuraDefines.h
+++ b/src/game/SpellAuraDefines.h
@@ -319,7 +319,7 @@ enum AuraType
SPELL_AURA_MOD_HONOR_GAIN = 281,
SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells
- SPELL_AURA_284,
+ SPELL_AURA_TRIGGERED = 284,
SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285,
SPELL_AURA_ABILITY_PERIODIC_CRIT = 286,
SPELL_AURA_DEFLECT_SPELLS = 287,
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index b227526..d3fcdd0 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -334,7 +334,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNoImmediateEffect, //281 SPELL_AURA_MOD_HONOR_GAIN implemented in Player::RewardHonor
&Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
&Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonusTaken
- &Aura::HandleNULL, //284 51 spells
+ &Aura::HandleAuraTriggered, //284 SPELL_AURA_TRIGGERED
&Aura::HandleAuraModAttackPowerOfArmor, //285 SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR implemented in Player::UpdateAttackPowerAndDamage
&Aura::HandleNoImmediateEffect, //286 SPELL_AURA_ABILITY_PERIODIC_CRIT implemented in Aura::IsCritFromAbilityAura called from Aura::PeriodicTick
&Aura::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
@@ -9765,3 +9765,49 @@ void SpellAuraHolder::UnregisterSingleCastHolder()
m_isSingleTarget = false;
}
}
+
+void Aura::HandleAuraTriggered(bool apply, bool Real)
+{
+ if (!Real)
+ return;
+
+ uint32 TriggerSpell = GetSpellProto()->EffectTriggerSpell[m_effIndex];
+ SpellEntry const *spellInfo = sSpellStore.LookupEntry(TriggerSpell);
+ if (!spellInfo)
+ {
+ sLog.outError("TriggerSpell for spell %u effect %u: triggering unknown spell %u", +GetSpellProto()->Id, m_effIndex, TriggerSpell);
+ return;
+ }
+
+ if (apply)
+ {
+ if (GetCaster() &&
+ GetCaster()->GetTypeId() == TYPEID_PLAYER &&
+ GetTarget() &&
+ GetTarget()->GetTypeId() != TYPEID_PLAYER &&
+ spellInfo->AttributesEx & SPELL_ATTR_EX_UNK28 &&
+ spellInfo->Attributes & SPELL_ATTR_UNK8)
+ {
+ float healBonus = +float(GetCaster()->GetTotalAuraModifier(SPELL_AURA_MOD_HEALING_PCT))/100.0;
+ if (healBonus < 0.0)
+ healBonus = 0.0;
+ float damageBonus = float(GetCaster()->CalculateDamage(BASE_ATTACK, +false)/GetCaster()->GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE)) - 1.0;
+ if (damageBonus < 0.0)
+ damageBonus = 0.0;
+ float healthBonus = +float(GetCaster()->GetMaxHealth()/(GetCaster()->GetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE) + +GetCaster()->GetCreateHealth())) - 1.0;
+ if (healthBonus < 0)
+ healthBonus = 0.0;
+
+ int32 bp0 = int32((spellInfo->EffectBasePoints[EFFECT_INDEX_0] + healBonus) * 100);
+ int32 bp1 = int32((spellInfo->EffectBasePoints[EFFECT_INDEX_1] + damageBonus) * 100);
+ int32 bp2 = int32((spellInfo->EffectBasePoints[EFFECT_INDEX_2] + healthBonus) * 100);
+
+ GetTarget()->CastCustomSpell(GetTarget(), spellInfo, &bp0, &bp1, &bp2, +GetCasterGuid());
+ GetTarget()->SetHealth(GetTarget()->GetMaxHealth());
+ }
+ else
+ GetTarget()->CastSpell(GetTarget(), spellInfo, true, NULL, this);
+ }
+ else
+ GetTarget()->RemoveAurasByCasterSpell(TriggerSpell, GetCasterGuid());
+}
\ No newline at end of file
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 51c553a..ffc5af4 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -373,6 +373,7 @@ class MANGOS_DLL_SPEC Aura
void HandleAuraOpenStable(bool apply, bool Real);
void HandleAuraAddMechanicAbilities(bool apply, bool Real);
void HandleAuraStopNaturalManaRegen(bool apply, bool real);
+ void HandleAuraTriggered(bool Apply, bool Real);
virtual ~Aura();