diff options
author | maximius <none@none> | 2009-09-21 12:31:36 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-09-21 12:31:36 -0700 |
commit | 9e5c8db01f792231ecff7e3f60a31ebfea733ff1 (patch) | |
tree | 51a91be79cd07dc18955264bcc3d5944f5b21cad /src | |
parent | f093c18ca105418ff921343c45cc9ac0c77ff455 (diff) |
*[8508] Not assign boolean value to integer variable, expecting to always be 0. Also renaming member variables. Author: NoFantasy
*[8516] Implement spell 53271. Author: Shendor
*[8519] Use RuneType enum where appropriate and more explicit data for rune init. Author: VladimirMangos
Thanks to: Stryker
*[8520] Limit telent 49182 and ranks triggering expected:wq runes cooldown case. Author: Shendor
*Fix Herald Volazj wrongly targeting himself on Shadow Bolt Volley instead of randomly targeting on Shiver, by tlexii.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp | 5 | ||||
-rw-r--r-- | src/game/Player.cpp | 26 | ||||
-rw-r--r-- | src/game/Player.h | 11 | ||||
-rw-r--r-- | src/game/PoolHandler.cpp | 21 | ||||
-rw-r--r-- | src/game/PoolHandler.h | 4 | ||||
-rw-r--r-- | src/game/Spell.cpp | 6 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 4 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 21 | ||||
-rw-r--r-- | src/game/Unit.cpp | 5 |
9 files changed, 75 insertions, 28 deletions
diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp index cc7f100f015..c56d801c135 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/ahnkahet/boss_herald_volazj.cpp @@ -92,13 +92,14 @@ struct TRINITY_DLL_DECL boss_volazjAI : public ScriptedAI if (uiShadowBoltVolleyTimer < diff) { - DoCast(m_creature, HeroicMode ? H_SPELL_SHADOW_BOLT_VOLLEY : SPELL_SHADOW_BOLT_VOLLEY); + DoCast(m_creature->getVictim(), HeroicMode ? H_SPELL_SHADOW_BOLT_VOLLEY : SPELL_SHADOW_BOLT_VOLLEY); uiShadowBoltVolleyTimer = 5000; } else uiShadowBoltVolleyTimer -= diff; if (uiShiverTimer < diff) { - DoCast(m_creature, HeroicMode ? H_SPELL_SHIVER : SPELL_SHIVER); + if (Unit * target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target, HeroicMode ? H_SPELL_SHIVER : SPELL_SHIVER); uiShiverTimer = 15000; } else uiShiverTimer -= diff; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 24c1604fe06..8db30d47e68 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -20861,7 +20861,7 @@ void Player::UpdateCharmedAI() } } -void Player::ConvertRune(uint8 index, uint8 newType) +void Player::ConvertRune(uint8 index, RuneType newType) { SetCurrentRune(index, newType); @@ -20889,6 +20889,15 @@ void Player::AddRunePower(uint8 index) GetSession()->SendPacket(&data); } +static RuneType runeSlotTypes[MAX_RUNES] = { + /*0*/ RUNE_BLOOD, + /*1*/ RUNE_BLOOD, + /*2*/ RUNE_UNHOLY, + /*3*/ RUNE_UNHOLY, + /*4*/ RUNE_FROST, + /*5*/ RUNE_FROST +}; + void Player::InitRunes() { if(getClass() != CLASS_DEATH_KNIGHT) @@ -20901,9 +20910,9 @@ void Player::InitRunes() for(uint32 i = 0; i < MAX_RUNES; ++i) { - SetBaseRune(i, i / 2); // init base types - SetCurrentRune(i, i / 2); // init current types - SetRuneCooldown(i, 0); // reset cooldowns + SetBaseRune(i, runeSlotTypes[i]); // init base types + SetCurrentRune(i, runeSlotTypes[i]); // init current types + SetRuneCooldown(i, 0); // reset cooldowns m_runes->SetRuneState(i); } @@ -20911,6 +20920,15 @@ void Player::InitRunes() SetFloatValue(PLAYER_RUNE_REGEN_1 + i, 0.1f); } +bool Player::IsBaseRuneSlotsOnCooldown(RuneType runeType) const +{ + for(uint32 i = 0; i < MAX_RUNES; ++i) + if (GetBaseRune(i) == runeType && GetRuneCooldown(i) == 0) + return false; + + return true; +} + void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast) { Loot loot; diff --git a/src/game/Player.h b/src/game/Player.h index 43533743879..31750eaa1a5 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2191,15 +2191,16 @@ class MANGOS_DLL_SPEC Player : public Unit DeclinedName const* GetDeclinedNames() const { return m_declinedname; } uint8 GetRunesState() const { return m_runes->runeState; } - uint8 GetBaseRune(uint8 index) const { return m_runes->runes[index].BaseRune; } - uint8 GetCurrentRune(uint8 index) const { return m_runes->runes[index].CurrentRune; } + RuneType GetBaseRune(uint8 index) const { return RuneType(m_runes->runes[index].BaseRune); } + RuneType GetCurrentRune(uint8 index) const { return RuneType(m_runes->runes[index].CurrentRune); } uint8 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; } + bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const; 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 SetBaseRune(uint8 index, RuneType baseRune) { m_runes->runes[index].BaseRune = baseRune; } + void SetCurrentRune(uint8 index, RuneType 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); } - void ConvertRune(uint8 index, uint8 newType); + void ConvertRune(uint8 index, RuneType newType); void ResyncRunes(uint8 count); void AddRunePower(uint8 index); void InitRunes(); diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp index 43f726c42a8..03b09f9a483 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolHandler.cpp @@ -32,6 +32,7 @@ template <class T> PoolGroup<T>::PoolGroup() { m_SpawnedPoolAmount = 0; + m_LastDespawnedNode = 0; } // Method to add a gameobject/creature guid to the proper list depending on pool type and chance value @@ -107,7 +108,7 @@ void PoolGroup<T>::DespawnObject(uint32 guid) if (!guid || EqualChanced[i].guid == guid) { if (guid) - CacheValue = EqualChanced[i].guid; + m_LastDespawnedNode = EqualChanced[i].guid; else Despawn1Object(EqualChanced[i].guid); @@ -183,9 +184,11 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache) if (limit == 1) // This is the only case where explicit chance is used { uint32 roll = RollOne(); - if (cache && CacheValue != roll) - Despawn1Object(CacheValue); - CacheValue = Spawn1Object(roll); + if (cache && m_LastDespawnedNode != roll) + Despawn1Object(m_LastDespawnedNode); + + m_LastDespawnedNode = 0; + Spawn1Object(roll); } else if (limit < EqualChanced.size() && m_SpawnedPoolAmount < limit) { @@ -198,10 +201,10 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache) { uint32 roll = urand(1, IndexList.size()) - 1; uint32 index = IndexList[roll]; - if (!cache || (cache && EqualChanced[index].guid != CacheValue)) + if (!cache || (cache && EqualChanced[index].guid != m_LastDespawnedNode)) { if (cache) - Despawn1Object(CacheValue); + Despawn1Object(m_LastDespawnedNode); EqualChanced[index].spawned = Spawn1Object(EqualChanced[index].guid); } else @@ -213,7 +216,7 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache) std::vector<uint32>::iterator itr = IndexList.begin()+roll; IndexList.erase(itr); } - CacheValue = 0; + m_LastDespawnedNode = 0; } else // Not enough objects in pool, so spawn all { @@ -332,7 +335,7 @@ bool PoolGroup<Pool>::ReSpawn1Object(uint32 /*guid*/) PoolHandler::PoolHandler() { - isSystemInit = false; + m_IsPoolSystemStarted = false; } void PoolHandler::LoadFromDB() @@ -626,7 +629,7 @@ void PoolHandler::Initialize() } sLog.outBasic("Pool handling system initialized, %u pools spawned.", count); - isSystemInit = true; + m_IsPoolSystemStarted = true; } // Call to spawn a pool, if cache if true the method will spawn only if cached entry is different diff --git a/src/game/PoolHandler.h b/src/game/PoolHandler.h index 7efdae48097..10ed000ea25 100644 --- a/src/game/PoolHandler.h +++ b/src/game/PoolHandler.h @@ -56,9 +56,9 @@ class PoolGroup void RemoveOneRelation(uint16 child_pool_id); private: typedef std::vector<PoolObject> PoolObjectList; - uint32 CacheValue; // Store the guid of the removed creature/gameobject during a pool update PoolObjectList ExplicitlyChanced; PoolObjectList EqualChanced; + uint32 m_LastDespawnedNode ; // Store the guid of the removed creature/gameobject during a pool update uint32 m_SpawnedPoolAmount; // Used to know the number of spawned objects }; @@ -81,7 +81,7 @@ class PoolHandler void Initialize(); protected: - bool isSystemInit; + bool m_IsPoolSystemStarted; uint16 max_pool_id; typedef std::vector<PoolTemplateData> PoolTemplateDataMap; typedef std::vector<PoolGroup<Creature> > PoolGroupCreatureMap; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index b214ce5067b..e3aa3e995f1 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4114,7 +4114,7 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID) for(uint32 i = 0; i < MAX_RUNES; ++i) { - uint8 rune = plr->GetCurrentRune(i); + RuneType rune = plr->GetCurrentRune(i); if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0)) runeCost[rune]--; } @@ -4156,7 +4156,7 @@ void Spell::TakeRunePower() for(uint32 i = 0; i < MAX_RUNES; ++i) { - uint8 rune = plr->GetCurrentRune(i); + RuneType rune = plr->GetCurrentRune(i); if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0)) { plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec @@ -4171,7 +4171,7 @@ void Spell::TakeRunePower() { for(uint32 i = 0; i < MAX_RUNES; ++i) { - uint8 rune = plr->GetCurrentRune(i); + RuneType rune = plr->GetCurrentRune(i); if((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH)) { plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 34a3ea2347d..f6871b00072 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6709,14 +6709,14 @@ void AuraEffect::HandleAuraConvertRune(bool apply, bool Real, bool changeAmount) continue; if(!plr->GetRuneCooldown(i)) { - plr->ConvertRune(i, GetSpellProto()->EffectMiscValueB[m_effIndex]); + plr->ConvertRune(i, RuneType(GetSpellProto()->EffectMiscValueB[m_effIndex])); runes |= 1<<i; --m_amount; } } else { - if(plr->GetCurrentRune(i) == GetSpellProto()->EffectMiscValueB[m_effIndex]) + if(plr->GetCurrentRune(i) == RuneType(GetSpellProto()->EffectMiscValueB[m_effIndex])) { if (m_amount & (1<<i)) plr->ConvertRune(i, plr->GetBaseRune(i)); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index e0e84b7c2bb..e01744710e3 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1619,6 +1619,15 @@ void Spell::EffectDummy(uint32 i) m_caster->CastCustomSpell(m_caster, 53479, &healthModSpellBasePoints0, NULL, NULL, true, NULL); return; } + // Master's Call + case 53271: + { + if (!m_caster->isHunterPet() || !unitTarget) + return; + else + m_caster->CastSpell(unitTarget, m_spellInfo->CalculateSimpleValue(i), true); + return; + } } break; case SPELLFAMILY_PALADIN: @@ -5588,6 +5597,16 @@ void Spell::EffectScriptEffect(uint32 effIndex) m_caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true); return; } + // Master's Call + case 53271: + { + if (!unitTarget) + return; + + // script effect have in value, but this outdated removed part + unitTarget->CastSpell(unitTarget, 62305, true); + return; + } default: break; } @@ -6953,7 +6972,7 @@ void Spell::EffectActivateRune(uint32 eff_idx) for(uint32 j = 0; j < MAX_RUNES; ++j) { - if(plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == m_spellInfo->EffectMiscValue[eff_idx]) + if(plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == RuneType(m_spellInfo->EffectMiscValue[eff_idx])) { plr->SetRuneCooldown(j, 0); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 8b77f5a4036..f9aa1a964c0 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7604,6 +7604,11 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig break; } + // Blade Barrier + if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && auraSpellInfo->SpellIconID == 85) + if (this->GetTypeId() != TYPEID_PLAYER || !((Player*)this)->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD)) + return false; + // Custom basepoints/target for exist spell // dummy basepoints or other customs switch(trigger_spell_id) |