*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))
{
RemoveAurasDueToSpell(mod->spellId, AURA_REMOVE_BY_EXPIRE);
RemoveAurasDueToSpell(mod->spellId, 0, AURA_REMOVE_BY_EXPIRE);
if (m_spellMods[i].empty())
break;
else
+13 -15
View File
@@ -307,6 +307,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_triggeringContainer = triggeringContainer;
m_referencedFromCurrentSpell = false;
m_executedCurrently = false;
m_needComboPoints = NeedsComboPoints(m_spellInfo);
m_delayStart = 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
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
{
uint32 tempMask = 0;
@@ -2184,6 +2189,10 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
// Prepare data for triggers
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)
m_casttime = GetSpellCastTime(m_spellInfo, this);
@@ -2418,23 +2427,8 @@ void Spell::handle_immediate()
// process immediate effects (items, ground, etc.) also initialize some variables
_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)
{
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)
DoAllEffectOnTarget(&(*ihit));
@@ -2552,6 +2546,10 @@ void Spell::_handle_immediate_phase()
void Spell::_handle_finish_phase()
{
// Take for real after all targets are processed
if (m_needComboPoints)
((Player*)m_caster)->ClearComboPoints();
// spell log
if(m_needSpellLog)
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_executedCurrently; // mark as executed to prevent deleted and access by dead pointers
bool m_needSpellLog; // need to send spell log?
bool m_needComboPoints;
uint8 m_applyMultiplierMask; // by effect: damage multiplier needed?
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)
return;
SpellEntry const *spellInfo = NULL;
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()))
{
aur->GetParentAura()->RefreshAura();
spellInfo = aur->GetSpellProto();
stack = aur->GetParentAura()->GetStackAmount();
maxStack = aur->GetSpellProto()->StackAmount;
break;
}
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
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)
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (!spellInfo)
SpellEntry const *spellProto = sSpellStore.LookupEntry(itr->first);
if (!spellProto)
continue;
if (spellInfo->SpellFamilyFlags.IsEqual(SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR)
&& spellInfo->Id != m_spellInfo->Id
&& spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR)
if (spellProto->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR
&& spellProto->Id != m_spellInfo->Id
&& spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR)
{
m_caster->CastSpell(unitTarget, spellInfo, true);
spellInfo = spellProto;
break;
}
}
}
if (!spellInfo)
break;
m_caster->CastSpell(unitTarget, spellInfo, true);
if (stack)
spell_bonus += stack * CalculateDamage(2, unitTarget);
}
+1 -1
View File
@@ -4020,7 +4020,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit
else
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);
new_aur->SetLoadedState(aur->GetCasterGUID(), dur, dur, aur->GetAuraCharges(), aur->GetStackAmount(), &damage[0]);