*Take combo points for delayed spells

*Fix a typo in spellsteal handling and a typo causing freeze while removing spellmods.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-04-12 13:12:08 +02:00
parent b1b53addcc
commit 7409df2dc9
5 changed files with 29 additions and 27 deletions
+1 -1
View File
@@ -16896,7 +16896,7 @@ void Player::RemoveSpellMods(Spell const* spell)
if (mod && mod->charges == -1 && (mod->lastAffected == spell || mod->lastAffected==NULL)) if (mod && mod->charges == -1 && (mod->lastAffected == spell || mod->lastAffected==NULL))
{ {
RemoveAurasDueToSpell(mod->spellId, AURA_REMOVE_BY_EXPIRE); RemoveAurasDueToSpell(mod->spellId, 0, AURA_REMOVE_BY_EXPIRE);
if (m_spellMods[i].empty()) if (m_spellMods[i].empty())
break; break;
else else
+13 -15
View File
@@ -307,6 +307,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_triggeringContainer = triggeringContainer; m_triggeringContainer = triggeringContainer;
m_referencedFromCurrentSpell = false; m_referencedFromCurrentSpell = false;
m_executedCurrently = false; m_executedCurrently = false;
m_needComboPoints = NeedsComboPoints(m_spellInfo);
m_delayStart = 0; m_delayStart = 0;
m_delayAtDamageCount = 0; m_delayAtDamageCount = 0;
@@ -945,6 +946,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
DoSpellHitOnUnit(m_caster, mask); DoSpellHitOnUnit(m_caster, mask);
} }
// Do not take combo points on dodge
if (m_needComboPoints && m_targets.getUnitTargetGUID() == target->targetGUID)
if( missInfo != SPELL_MISS_NONE && missInfo != SPELL_MISS_MISS)
m_needComboPoints = false;
/*else //TODO: This is a hack. need fix /*else //TODO: This is a hack. need fix
{ {
uint32 tempMask = 0; uint32 tempMask = 0;
@@ -2184,6 +2189,10 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
// Prepare data for triggers // Prepare data for triggers
prepareDataForTriggerSystem(); prepareDataForTriggerSystem();
// Set combo point requirement
if (m_IsTriggeredSpell || m_CastItem || m_caster->GetTypeId()!=TYPEID_PLAYER)
m_needComboPoints = false;
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail) // calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
m_casttime = GetSpellCastTime(m_spellInfo, this); m_casttime = GetSpellCastTime(m_spellInfo, this);
@@ -2418,23 +2427,8 @@ void Spell::handle_immediate()
// process immediate effects (items, ground, etc.) also initialize some variables // process immediate effects (items, ground, etc.) also initialize some variables
_handle_immediate_phase(); _handle_immediate_phase();
bool checkCp =
!m_IsTriggeredSpell && !m_CastItem
&& NeedsComboPoints(m_spellInfo)
&& m_caster->GetTypeId()==TYPEID_PLAYER;
bool comboPoints = false;
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
{
DoAllEffectOnTarget(&(*ihit)); DoAllEffectOnTarget(&(*ihit));
// Take combo points after effects handling (combo points are used in effect handling)
if(checkCp)
if(ihit->targetGUID == m_targets.getUnitTargetGUID()
&& (ihit->missCondition == SPELL_MISS_NONE || ihit->missCondition == SPELL_MISS_MISS))
comboPoints=true;
}
// Take for real after all targets are processed
if (comboPoints)
((Player*)m_caster)->ClearComboPoints();
for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit) for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit)
DoAllEffectOnTarget(&(*ihit)); DoAllEffectOnTarget(&(*ihit));
@@ -2552,6 +2546,10 @@ void Spell::_handle_immediate_phase()
void Spell::_handle_finish_phase() void Spell::_handle_finish_phase()
{ {
// Take for real after all targets are processed
if (m_needComboPoints)
((Player*)m_caster)->ClearComboPoints();
// spell log // spell log
if(m_needSpellLog) if(m_needSpellLog)
SendLogExecute(); SendLogExecute();
+1
View File
@@ -508,6 +508,7 @@ class Spell
bool m_referencedFromCurrentSpell; // mark as references to prevent deleted and access by dead pointers bool m_referencedFromCurrentSpell; // mark as references to prevent deleted and access by dead pointers
bool m_executedCurrently; // mark as executed to prevent deleted and access by dead pointers bool m_executedCurrently; // mark as executed to prevent deleted and access by dead pointers
bool m_needSpellLog; // need to send spell log? bool m_needSpellLog; // need to send spell log?
bool m_needComboPoints;
uint8 m_applyMultiplierMask; // by effect: damage multiplier needed? uint8 m_applyMultiplierMask; // by effect: damage multiplier needed?
float m_damageMultipliers[3]; // by effect: damage multiplier float m_damageMultipliers[3]; // by effect: damage multiplier
+13 -10
View File
@@ -4074,14 +4074,14 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
{ {
if (m_caster->GetTypeId()!=TYPEID_PLAYER) if (m_caster->GetTypeId()!=TYPEID_PLAYER)
return; return;
SpellEntry const *spellInfo = NULL;
uint32 stack = 0; uint32 stack = 0;
int32 maxStack = 0;
if (AuraEffect * aur = unitTarget->GetAura(SPELL_AURA_MOD_RESISTANCE,SPELLFAMILY_WARRIOR,SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR, 0, 0, m_caster->GetGUID())) if (AuraEffect * aur = unitTarget->GetAura(SPELL_AURA_MOD_RESISTANCE,SPELLFAMILY_WARRIOR,SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR, 0, 0, m_caster->GetGUID()))
{ {
aur->GetParentAura()->RefreshAura(); aur->GetParentAura()->RefreshAura();
spellInfo = aur->GetSpellProto();
stack = aur->GetParentAura()->GetStackAmount(); stack = aur->GetParentAura()->GetStackAmount();
maxStack = aur->GetSpellProto()->StackAmount;
break;
} }
for(int j = 0; j < 3; j++) for(int j = 0; j < 3; j++)
@@ -4093,7 +4093,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
} }
} }
if(stack < maxStack) if(!spellInfo)
{ {
// get highest rank of the Sunder Armor spell // get highest rank of the Sunder Armor spell
const PlayerSpellMap& sp_list = ((Player*)m_caster)->GetSpellMap(); const PlayerSpellMap& sp_list = ((Player*)m_caster)->GetSpellMap();
@@ -4103,19 +4103,22 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
if(!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED) if(!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED)
continue; continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); SpellEntry const *spellProto = sSpellStore.LookupEntry(itr->first);
if (!spellInfo) if (!spellProto)
continue; continue;
if (spellInfo->SpellFamilyFlags.IsEqual(SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR) if (spellProto->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR
&& spellInfo->Id != m_spellInfo->Id && spellProto->Id != m_spellInfo->Id
&& spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR) && spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR)
{ {
m_caster->CastSpell(unitTarget, spellInfo, true); spellInfo = spellProto;
break; break;
} }
} }
} }
if (!spellInfo)
break;
m_caster->CastSpell(unitTarget, spellInfo, true);
if (stack) if (stack)
spell_bonus += stack * CalculateDamage(2, unitTarget); spell_bonus += stack * CalculateDamage(2, unitTarget);
} }
+1 -1
View File
@@ -4020,7 +4020,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit
else else
damage[i]=NULL; damage[i]=NULL;
} }
int32 dur = 2*MINUTE*IN_MILISECONDS > aur->GetAuraDuration() ? 2*MINUTE*IN_MILISECONDS : aur->GetAuraDuration(); int32 dur = 2*MINUTE*IN_MILISECONDS < aur->GetAuraDuration() ? 2*MINUTE*IN_MILISECONDS : aur->GetAuraDuration();
Aura * new_aur = new Aura(aur->GetSpellProto(),aur->GetEffectMask(), NULL, stealer, stealer, NULL); Aura * new_aur = new Aura(aur->GetSpellProto(),aur->GetEffectMask(), NULL, stealer, stealer, NULL);
new_aur->SetLoadedState(aur->GetCasterGUID(), dur, dur, aur->GetAuraCharges(), aur->GetStackAmount(), &damage[0]); new_aur->SetLoadedState(aur->GetCasterGUID(), dur, dur, aur->GetAuraCharges(), aur->GetStackAmount(), &damage[0]);