aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorQAston <none@none>2009-08-05 02:36:26 +0200
committerQAston <none@none>2009-08-05 02:36:26 +0200
commit50ce9f8cfa6321be87ee797834bd9300c2cbd32d (patch)
tree0aeda0a0f699ed361f027eab1b4b43f1fe2f7e92 /src/game
parent172a6f127979af0744c2ba905065e7189ad92a7d (diff)
*Correct implementation and use of dbc data for aura SPELL_AURA_CONVERT_RUNE(249)
*Fix Blood of the North, Reaping - original patch by thenecromancer *Fix Death Rune Mastery. --HG-- branch : trunk
Diffstat (limited to 'src/game')
-rw-r--r--src/game/Player.cpp1
-rw-r--r--src/game/Player.h3
-rw-r--r--src/game/Spell.cpp45
-rw-r--r--src/game/SpellAuras.cpp66
-rw-r--r--src/game/SpellAuras.h2
-rw-r--r--src/game/Unit.cpp56
6 files changed, 159 insertions, 14 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 0b75d090152..9f28c399c1f 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -20474,6 +20474,7 @@ void Player::InitRunes()
m_runes = new Runes;
m_runes->runeState = 0;
+ m_runes->lastUsedRune = RUNE_BLOOD;
for(uint32 i = 0; i < MAX_RUNES; ++i)
{
diff --git a/src/game/Player.h b/src/game/Player.h
index fa9e48e4e01..fa0153e8b51 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -294,6 +294,7 @@ struct Runes
{
RuneInfo runes[MAX_RUNES];
uint8 runeState; // mask of available runes
+ RuneType lastUsedRune;
void SetRuneState(uint8 index, bool set = true)
{
@@ -2133,6 +2134,8 @@ class TRINITY_DLL_SPEC Player : public Unit
uint8 GetBaseRune(uint8 index) const { return m_runes->runes[index].BaseRune; }
uint8 GetCurrentRune(uint8 index) const { return m_runes->runes[index].CurrentRune; }
uint8 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
+ RuneType GetLastUsedRune() { return m_runes->lastUsedRune; }
+ void SetLastUsedRune(RuneType type) { m_runes->lastUsedRune = type; }
void SetBaseRune(uint8 index, uint8 baseRune) { m_runes->runes[index].BaseRune = baseRune; }
void SetCurrentRune(uint8 index, uint8 currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
void SetRuneCooldown(uint8 index, uint8 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); }
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 999cdd8c893..8690412d733 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -4128,6 +4128,7 @@ void Spell::TakeRunePower()
if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
{
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
+ plr->SetLastUsedRune(RuneType(rune));
runeCost[rune]--;
}
}
@@ -4142,8 +4143,52 @@ void Spell::TakeRunePower()
if((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH))
{
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
+ plr->SetLastUsedRune(RuneType(rune));
runeCost[rune]--;
+ bool auraFound = false;
plr->ConvertRune(i, plr->GetBaseRune(i));
+ // * * * * * * * * * * *
+ // update convert rune auras
+ // * * * * * * * * * * *
+ // Remove rune from SPELL_AURA_CONVERT_RUNE when rune is used
+ // To prevent overriding other rune convert effects
+ Unit::AuraEffectList const& runeconvert = m_caster->GetAurasByType(SPELL_AURA_CONVERT_RUNE);
+ for(Unit::AuraEffectList::const_iterator itr = runeconvert.begin(); itr != runeconvert.end(); ++itr)
+ {
+ // Remove rune of aura if avalible
+ if ((*itr)->GetAmount() & (1<<i))
+ {
+ (*itr)->SetAmount((*itr)->GetAmount() & ~(1<<i));
+ auraFound = true;
+ }
+ // All runes from aura used - remove aura
+ if (!(*itr)->GetAmount())
+ plr->RemoveAura((*itr)->GetParentAura(), AURA_REMOVE_BY_EXPIRE);
+ break;
+ }
+ if (!auraFound)
+ {
+ // Decrease used rune count for dk talent auras
+ // To prevent overriding other rune convert effects
+ Unit::AuraEffectList const& runeconvert = m_caster->GetAurasByType(SPELL_AURA_CONVERT_RUNE);
+ for(Unit::AuraEffectList::const_iterator itr = runeconvert.begin(); itr != runeconvert.end(); ++itr)
+ {
+ if (plr->GetBaseRune(i) != RUNE_DEATH)
+ {
+ if ((*itr)->GetSpellProto()->SpellIconID != 2622)
+ continue;
+ }
+ else if ((*itr)->GetSpellProto()->SpellIconID != 3041 &&
+ (*itr)->GetSpellProto()->SpellIconID != 22)
+ continue;
+
+ // Remove rune of aura if avalible
+ if ((*itr)->GetAmount() & (1<<i))
+ (*itr)->SetAmount((*itr)->GetAmount() & ~(1<<i));
+ break;
+ }
+ }
+
if(runeCost[RUNE_DEATH] == 0)
break;
}
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index aa8c2014b7a..546d6492300 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -4817,6 +4817,12 @@ void AuraEffect::HandleAuraPeriodicDummy(bool apply, bool Real, bool changeAmoun
m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 14 / 100);
break;
}
+ case SPELLFAMILY_DEATHKNIGHT:
+ {
+ if (spell->SpellIconID == 3041 || spell->SpellIconID == 22 || spell->SpellIconID == 2622)
+ m_amount = 0;
+ break;
+ }
}
m_isPeriodic = apply;
@@ -7225,9 +7231,6 @@ void AuraEffect::PeriodicDummyTick()
// Being pursuaded by Gargoyle - AI related?
// if (spell->SpellFamilyFlags[1] & 0x00000080)
// break;
- // Death Rune Mastery
-// if (spell->SpellFamilyFlags & 0x0000000000004000LL)
-// return;
// Bladed Armor
if (spell->SpellIconID == 2653)
{
@@ -7237,12 +7240,43 @@ void AuraEffect::PeriodicDummyTick()
m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, 0, true, 0, this);
return;
}
- // Reaping
-// if (spell->SpellIconID == 22)
-// return;
// Blood of the North
-// if (spell->SpellIconID == 30412)
-// return;
+ // Reaping
+ // Death Rune Mastery
+ if (spell->SpellIconID == 3041 || spell->SpellIconID == 22 || spell->SpellIconID == 2622)
+ {
+ if (m_target->GetTypeId() != TYPEID_PLAYER)
+ return;
+ // Aura not used - prevent removing death runes from other effects
+ if (!GetAmount())
+ return;
+ if(((Player*)m_target)->getClass() != CLASS_DEATH_KNIGHT)
+ return;
+
+ // Remove death rune added on proc
+ for (uint8 i=0;i<MAX_RUNES && m_amount;++i)
+ {
+ if (m_spellProto->SpellIconID == 2622)
+ {
+ if (((Player*)m_target)->GetCurrentRune(i) != RUNE_DEATH ||
+ ((Player*)m_target)->GetBaseRune(i) == RUNE_BLOOD )
+ continue;
+ }
+ else
+ {
+ if (((Player*)m_target)->GetCurrentRune(i) != RUNE_DEATH ||
+ ((Player*)m_target)->GetBaseRune(i) != RUNE_BLOOD )
+ continue;
+ }
+
+ if (!(m_amount & (1<<i)))
+ continue;
+
+ ((Player*)m_target)->ConvertRune(i,((Player*)m_target)->GetBaseRune(i));
+ }
+ m_amount = 0;
+ return;
+ }
break;
}
default:
@@ -7363,26 +7397,32 @@ void AuraEffect::HandleAuraConvertRune(bool apply, bool Real, bool /*changeAmoun
if(plr->getClass() != CLASS_DEATH_KNIGHT)
return;
- // how to determine what rune need to be converted?
- for(uint32 i = 0; i < MAX_RUNES; ++i)
+ uint32 runes = 0;
+ // convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb
+ for(uint32 i = 0; i < MAX_RUNES && m_amount; ++i)
{
if(apply)
{
+ if (GetMiscValue() != plr->GetCurrentRune(i))
+ continue;
if(!plr->GetRuneCooldown(i))
{
plr->ConvertRune(i, GetSpellProto()->EffectMiscValueB[m_effIndex]);
- break;
+ runes |= 1<<i;
+ --m_amount;
}
}
else
{
if(plr->GetCurrentRune(i) == GetSpellProto()->EffectMiscValueB[m_effIndex])
{
- plr->ConvertRune(i, plr->GetBaseRune(i));
- break;
+ if (m_amount & (1<<i))
+ plr->ConvertRune(i, plr->GetBaseRune(i));
}
}
}
+ if (apply)
+ m_amount = runes;
}
// Control Auras
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 637c8054524..6a1c11e49c9 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -350,6 +350,8 @@ class TRINITY_DLL_SPEC AuraEffect
uint32 GetEffIndex() const { return m_effIndex; }
int32 GetBasePoints() const { return m_currentBasePoints; }
int32 GetAuraAmplitude(){return m_amplitude;}
+ void ResetPeriodicTimer(){m_periodicTimer = m_amplitude;}
+
virtual void Update(uint32 diff);
uint32 GetTickNumber() const { return m_tickNumber; }
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 396f944f33b..c8b375269bc 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -7164,12 +7164,66 @@ bool Unit::HandleAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, S
{
case SPELLFAMILY_DEATHKNIGHT:
{
+ // Blood of the North
+ // Reaping
+ // Death Rune Mastery
+ if (dummySpell->SpellIconID == 3041 || dummySpell->SpellIconID == 22 || dummySpell->SpellIconID == 2622)
+ {
+ *handled = true;
+ // Convert recently used Blood Rune to Death Rune
+ if (GetTypeId() == TYPEID_PLAYER)
+ {
+ if(((Player*)this)->getClass() != CLASS_DEATH_KNIGHT)
+ return false;
+ RuneType rune = ((Player*)this)->GetLastUsedRune();
+ // can't proc from death rune use
+ if (rune == RUNE_DEATH)
+ return false;
+ AuraEffect * aurEff = triggeredByAura->GetPartAura(0);
+ if (!aurEff)
+ return false;
+ // Reset amplitude - set death rune remove timer to 30s
+ aurEff->ResetPeriodicTimer();
+ uint32 runesLeft;
+
+ if (dummySpell->SpellIconID == 2622)
+ runesLeft = 2;
+ else
+ runesLeft = 1;
+
+ for (uint8 i=0;i<MAX_RUNES && runesLeft;++i)
+ {
+ if (dummySpell->SpellIconID == 2622)
+ {
+ if (((Player*)this)->GetCurrentRune(i) == RUNE_DEATH ||
+ ((Player*)this)->GetBaseRune(i) == RUNE_BLOOD )
+ continue;
+ }
+ else
+ {
+ if (((Player*)this)->GetCurrentRune(i) == RUNE_DEATH ||
+ ((Player*)this)->GetBaseRune(i) != RUNE_BLOOD )
+ continue;
+ }
+ if (GetRuneCooldown(i) != RUNE_COOLDOWN)
+ continue;
+
+ --runesLeft;
+ // Mark aura as used
+ aurEff->SetAmount(aurEff->GetAmount() | (1<<i));
+ ((Player*)this)->ConvertRune(i,RUNE_DEATH);
+ }
+ return true;
+ }
+ return false;
+ }
+
switch(dummySpell->Id)
{
// Hungering Cold aura drop
case 51209:
*handled = true;
- // Drop only in disease case
+ // Drop only in not disease case
if (procSpell && procSpell->Dispel == DISPEL_DISEASE)
return false;
return true;