Skip to content

Commit

Permalink
Implemented the hunter's pet spell "Kill Command"
Browse files Browse the repository at this point in the history
  • Loading branch information
pasdVn committed Jul 31, 2009
1 parent bfeba5e commit b98ea32
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
32 changes: 32 additions & 0 deletions src/game/SpellAuras.cpp
Expand Up @@ -1232,6 +1232,12 @@ bool Aura::modStackAmount(int32 num)
return true; // need remove aura
}

// reset charge when modding stack, update aura in SetStackamount
m_procCharges = m_spellProto->procCharges;
Player* modOwner = GetCaster() ? GetCaster()->GetSpellModOwner() : NULL;
if(modOwner)
modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, m_procCharges);

// Update stack amount
SetStackAmount(stackAmount);
return false;
Expand Down Expand Up @@ -2102,6 +2108,21 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
if(caster)
caster->CastSpell(caster, 13138, true, NULL, this);
return;
case 34026: // kill command
{
if(!caster || caster->GetTypeId() != TYPEID_PLAYER || !caster->GetPet() )
return;
caster->CastSpell(caster,34027,true,NULL,this);

// set 3 stacks
Aura* owner_aura = caster->GetAura(34027,0);
Aura* pet_aura = caster->GetPet()->GetAura(58914,0);
if( owner_aura )
owner_aura->SetStackAmount(3);
if( pet_aura )
pet_aura->SetStackAmount(3);
return;
}
case 39850: // Rocket Blast
if(roll_chance_i(20)) // backfire stun
m_target->CastSpell(m_target, 51581, true, NULL, this);
Expand Down Expand Up @@ -2207,6 +2228,17 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
m_target->CastSpell(m_target, 47287, true, NULL, this);
return;
}
case 58914:
{
// kill command, just eye candy
if(!caster)
return;
// the "casting" dummy aura
caster->RemoveAurasDueToSpell(34026);
// the spellmod aura (e.g. in case pet gets killed)
caster->RemoveAurasDueToSpell(34027);
return;
}
}

if (caster && m_removeMode == AURA_REMOVE_BY_DEATH)
Expand Down
25 changes: 22 additions & 3 deletions src/game/Unit.cpp
Expand Up @@ -1028,7 +1028,16 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S
// Physical Damage
if ( damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL )
{
//Calculate armor mitigation
// FIX ME: physical school damage spells should also get affected from bonus damage
for (int j = 0; j < 3; j++)
if( spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE )
if( Player* modOwner = GetSpellModOwner() )
{
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_DAMAGE, damage);
break;
}

//Calculate armor mitigation
damage = CalcArmorReducedDamage(pVictim, damage);
// Get blocked status
blocked = isSpellBlocked(pVictim, spellInfo, attackType);
Expand Down Expand Up @@ -4834,6 +4843,16 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
target = this;
break;
}
// kill command (pet aura proc)
case 58914:
{
Unit* owner = GetOwner();
if( !owner || owner->GetTypeId() != TYPEID_PLAYER )
break;
// reduce the owner's aura stack
owner->RemoveSingleSpellAurasFromStack(34027);
break;
}
// Vampiric Touch (generic, used by some boss)
case 52723:
case 60501:
Expand Down Expand Up @@ -11061,9 +11080,9 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
// Sort spells and remove dublicates
removedSpells.sort();
removedSpells.unique();
// Remove auras from removedAuras
// Remove auras (one stack) from removedAuras
for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();++i)
RemoveAurasDueToSpell(*i);
RemoveSingleSpellAurasFromStack(*i);
}
}

Expand Down

0 comments on commit b98ea32

Please sign in to comment.