Ejemplo n.º 1
0
void PaladinSpellHandler::HandleEffectWeaponDamage(Spell* spell, int32 &spell_bonus, bool &weaponDmgMod, float &totalDmgPctMod)
{
	// Judgement of Command
    if(spell->m_spellInfo->SpellFamilyFlags & FLAG_JUDGEMENT_COMMAND)
    {
        float ap = spell->GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK);
        int32 holy = spell->GetCaster()->SpellBaseDamageBonus(GetSpellSchoolMask(spell->m_spellInfo)) +
                     spell->GetCaster()->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(spell->m_spellInfo), spell->getUnitTarget());
        spell_bonus += int32(ap * 0.08f) + int32(holy * 13 / 100);
    }
	else if(spell->m_spellInfo->Id == SPELL_CRUSADER_STRIKE && spell->GetCaster()->GetTypeId() == TYPEID_PLAYER)
	{
		Item* weapon = ((Player*)spell->GetCaster())->GetWeaponForAttack(spell->getAttackType(),true,true);
		if (weapon && weapon->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER)
			spell_bonus += int32(spell->GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK) / 14 * 1.7);
		else
			spell_bonus += int32(spell->GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK) / 14 * 2.2);
	}
}
Ejemplo n.º 2
0
void HostileRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
    uint32 size = pSingleTarget ? 1 : getSize();            // if pSingleTarget do not devide threat
    float threat = pThreat/size;
    HostileReference* ref = getFirst();
    while (ref)
    {
        ref->getSource()->addThreat(pVictim, threat, false, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);

        ref = ref->next();
    }
}
Ejemplo n.º 3
0
AuraState GetSpellAuraState(SpellEntry const * spellInfo)
{
    // Seals
    if (IsSealSpell(spellInfo))
        return AURA_STATE_JUDGEMENT;

    // Conflagrate aura state on Immolate
    if (spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellInfo->SpellFamilyFlags[0] & 4))
        return AURA_STATE_CONFLAGRATE;

    // Faerie Fire (druid versions)
    if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && spellInfo->SpellFamilyFlags[0] & 0x400)
        return AURA_STATE_FAERIE_FIRE;

    // Sting (hunter's pet ability)
    if (spellInfo->Category == 1133)
        return AURA_STATE_FAERIE_FIRE;

    // Victorious
    if (spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR &&  spellInfo->SpellFamilyFlags[1] & 0x00040000)
        return AURA_STATE_WARRIOR_VICTORY_RUSH;

    // Swiftmend state on Regrowth & Rejuvenation
    if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && spellInfo->SpellFamilyFlags[0] & 0x50)
        return AURA_STATE_SWIFTMEND;

    // Deadly poison aura state
    if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && spellInfo->SpellFamilyFlags[0] & 0x10000)
        return AURA_STATE_DEADLY_POISON;

    // Enrage aura state
    if (spellInfo->Dispel == DISPEL_ENRAGE)
        return AURA_STATE_ENRAGE;

    // Bleeding aura state
    if (GetAllSpellMechanicMask(spellInfo) & 1<<MECHANIC_BLEED)
        return AURA_STATE_BLEEDING;

    if (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST)
    {
        for (uint8 i = 0; i<MAX_SPELL_EFFECTS; ++i)
        {
            if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STUN
                || spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_ROOT)
                return AURA_STATE_FROZEN;
        }
    }
    return AURA_STATE_NONE;
}
Ejemplo n.º 4
0
    void HandleDummy(SpellEffIndex effIndex)
    {
        Unit *caster = GetCaster();

        if (caster->GetTypeId() != TYPEID_PLAYER)
            return;

        // immediately finishes the cooldown on Frost spells
        const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
        for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
        {
            SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);

            if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE &&
                (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) &&
                spellInfo->Id != SPELL_MAGE_COLD_SNAP && GetSpellRecoveryTime(spellInfo) > 0)
            {
                caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
            }
            else
                ++itr;
        }
    }
Ejemplo n.º 5
0
void HostilRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
    HostilReference* ref;

    float size = pSingleTarget ? 1.0f : getSize();            // if pSingleTarget do not divide threat
    ref = getFirst();
    while(ref != NULL)
    {
        float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
        if(pVictim == getOwner())
            ref->addThreat(threat / size);          // It is faster to modify the threat durectly if possible
        else
            ref->getSource()->addThreat(pVictim, threat / size);
        ref = ref->next();
    }
}
Ejemplo n.º 6
0
void HostileRefManager::threatAssist(Unit* victim, float baseThreat, SpellEntry const* threatSpell)
{
    if (getSize() == 0)
        return;

    HostileReference* ref = getFirst();
    float threat = ThreatCalcHelper::calcThreat(victim, iOwner, baseThreat, (threatSpell ? GetSpellSchoolMask(threatSpell) : SPELL_SCHOOL_MASK_NORMAL), threatSpell);
    threat /= getSize();
    while (ref)
    {
        if (ThreatCalcHelper::isValidProcess(victim, ref->GetSource()->getOwner(), threatSpell))
            ref->GetSource()->doAddThreat(victim, threat);

        ref = ref->next();
    }
}
Ejemplo n.º 7
0
void HostileRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
	float redirectedMod = pVictim->getHostileRefManager().GetThreatRedirectionMod();
    Unit* redirectedTarget = redirectedMod ? pVictim->getHostileRefManager().GetThreatRedirectionTarget() : NULL;

    uint32 size = pSingleTarget ? 1 : getSize();            // if pSingleTarget do not devide threat
    HostileReference* ref = getFirst();
    while(ref != NULL)
    {
        float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, false, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
        if(pVictim == getOwner())
            ref->addThreat(float (threat) / size);          // It is faster to modify the threat durectly if possible
        else
            ref->getSource()->addThreat(pVictim, float (threat) / size);
        ref = ref->next();
    }
}
Ejemplo n.º 8
0
bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
{
    //No target so we can't cast
    if (!Target || !Spell)
        return false;

    //Silenced so we can't cast
    if (!Triggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
        return false;

    //Check for power
    if (!Triggered && me->GetPower((Powers) Spell->powerType) < CalculatePowerCost(Spell, me, GetSpellSchoolMask(Spell)))
        return false;

    SpellRangeEntry const *TempRange = NULL;
    TempRange = GetSpellRangeStore()->LookupEntry(Spell->rangeIndex);

    //Spell has invalid range store so we can't use it
    if (!TempRange)
        return false;

    //Unit is out of range of this spell
    if (!me->IsInRange(Target, TempRange->minRangeHostile, TempRange->maxRangeHostile))
        return false;

    return true;
}
Ejemplo n.º 9
0
void PaladinSpellHandler::HandleSchoolDmg(Spell *spell,int32 &damage,SpellEffectIndex i)
{
	const SpellEntry* m_spellInfo = spell->m_spellInfo;
	Unit* m_caster = spell->GetCaster();
	Unit* unitTarget = spell->getUnitTarget();
	
	// Judgement of Righteousness - receive benefit from Spell Damage and Attack power
	if (m_spellInfo->Id == SPELL_JUDGEMENT_OF_RIGHTEOUSNESS)
	{
		float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
		int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
		m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
		damage += int32(ap * 0.2f) + int32(holy * 32 / 100);
	}
	// Judgement of Vengeance/Corruption ${1+0.22*$SPH+0.14*$AP} + 10% for each application of Holy Vengeance/Blood Corruption on the target
	else if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x800000000)) && m_spellInfo->SpellIconID==2292)
	{
		uint32 debuf_id;
		switch(m_spellInfo->Id)
		{
			case 53733: debuf_id = 53742; break;// Judgement of Corruption -> Blood Corruption
			case 31804: debuf_id = 31803; break;// Judgement of Vengeance -> Holy Vengeance
			default: return;
		}
		
		float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
		int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
		m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
		damage+=int32(ap * 0.14f) + int32(holy * 22 / 100);
		// Get stack of Holy Vengeance on the target added by caster
		uint32 stacks = 0;
		Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
		for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
		{
			if( ((*itr)->GetId() == debuf_id) && (*itr)->GetCasterGUID()==m_caster->GetGUID())
			{
				stacks = (*itr)->GetStackAmount();
				break;
			}
		}
		// + 10% for each application of Holy Vengeance on the target
		if(stacks)
			damage += damage * stacks * 10 /100;
	}
	// Avenger's Shield ($m1+0.07*$SPH+0.07*$AP) - ranged sdb for future
	else if (m_spellInfo->SpellFamilyFlags & FLAG_AVENGER_SHIELD)
	{
		float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
		int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
		m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
		damage += int32(ap * 0.07f) + int32(holy * 7 / 100);
	}
	// Hammer of Wrath ($m1+0.15*$SPH+0.15*$AP) - ranged type sdb future fix
	else if (m_spellInfo->SpellFamilyFlags & FLAG_HAMMER_OF_WRATH)
	{
		float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
		int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
		m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
		damage += int32(ap * 0.15f) + int32(holy * 15 / 100);
	}
	// Hammer of the Righteous
	else if (m_spellInfo->SpellFamilyFlags & FLAG_HAMMER_OF_THE_RIGHTEOUS)
	{
		// Add main hand dps * effect[2] amount
		float average = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2;
		int32 count = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[2], unitTarget);
		damage += count * int32(average * IN_MILLISECONDS) / m_caster->GetAttackTime(BASE_ATTACK);
	}
	// Shield of Righteousness
	else if (m_spellInfo->SpellFamilyFlags & FLAG_SHIELD_OF_RIGHTEOUSNESS)
	{
		damage+=int32(m_caster->GetShieldBlockValue());
	}
	// Judgement
	else if (m_spellInfo->Id == SPELL_JUDGEMENT)
	{
		// [1 + 0.25 * SPH + 0.16 * AP]
		float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
		int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
		m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
		damage += int32(ap * 0.16f) + int32(holy * 25 / 100);
	}
}