Scripts/Spells: Convert code from Spell::EffectDummy to spell scripts.
This commit is contained in:
@@ -9768,6 +9768,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
|
||||
{
|
||||
// Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
|
||||
|
||||
if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE))
|
||||
ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, NULL, true);
|
||||
}
|
||||
|
||||
@@ -530,26 +530,24 @@ namespace Trinity
|
||||
class RaiseDeadObjectCheck
|
||||
{
|
||||
public:
|
||||
RaiseDeadObjectCheck(Unit* source, float range) : _source(source), i_range(range) {}
|
||||
RaiseDeadObjectCheck(Unit* source, float range) : _source(source), _range(range) {}
|
||||
bool operator()(Creature* u)
|
||||
{
|
||||
if (_source->GetTypeId() != TYPEID_PLAYER || !((Player*)_source)->isHonorOrXPTarget(u) ||
|
||||
u->getDeathState() != CORPSE ||
|
||||
u->getDeathState() != CORPSE ||
|
||||
(u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0 ||
|
||||
(u->GetDisplayId() != u->GetNativeDisplayId()))
|
||||
return false;
|
||||
|
||||
return _source->IsWithinDistInMap(u, i_range);
|
||||
return _source->IsWithinDistInMap(u, _range);
|
||||
}
|
||||
|
||||
bool operator()(Player* u)
|
||||
{
|
||||
if (_source == u || _source->GetTypeId() != TYPEID_PLAYER || !((Player*)_source)->isHonorOrXPTarget(u) ||
|
||||
u->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) || u->isInFlight() || !u->isDead() ||
|
||||
(u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0)
|
||||
return false;
|
||||
|
||||
return _source->IsWithinDistInMap(u, i_range);
|
||||
return _source->IsWithinDistInMap(u, _range);
|
||||
}
|
||||
|
||||
bool operator()(Corpse* u)
|
||||
@@ -557,12 +555,12 @@ namespace Trinity
|
||||
if (_source->GetTypeId() != TYPEID_PLAYER || u->GetType() == CORPSE_BONES)
|
||||
return false;
|
||||
|
||||
return _source->IsWithinDistInMap(u, i_range);
|
||||
return _source->IsWithinDistInMap(u, _range);
|
||||
}
|
||||
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
|
||||
private:
|
||||
Unit* const _source;
|
||||
float i_range;
|
||||
float _range;
|
||||
};
|
||||
|
||||
class ExplodeCorpseObjectCheck
|
||||
|
||||
@@ -751,600 +751,6 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
|
||||
// selection by spell family
|
||||
switch (m_spellInfo->SpellFamilyName)
|
||||
{
|
||||
case SPELLFAMILY_GENERIC:
|
||||
{
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
case 31225: // Shimmering Vessel (restore creature to life)
|
||||
{
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
unitTarget->ToCreature()->setDeathState(JUST_ALIVED);
|
||||
return;
|
||||
}
|
||||
case 12162: // Deep wounds
|
||||
case 12850: // (now good common check for this spells)
|
||||
case 12868:
|
||||
{
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
// apply percent damage mods
|
||||
damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, damage, SPELL_DIRECT_DAMAGE);
|
||||
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
case 12162: ApplyPctN(damage, 16); break; // Rank 1
|
||||
case 12850: ApplyPctN(damage, 32); break; // Rank 2
|
||||
case 12868: ApplyPctN(damage, 48); break; // Rank 3
|
||||
default:
|
||||
sLog->outError("Spell::EffectDummy: Spell %u not handled in DW", m_spellInfo->Id);
|
||||
return;
|
||||
}
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(12721);
|
||||
uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude;
|
||||
|
||||
// Add remaining ticks to damage done
|
||||
if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(12721, EFFECT_0, m_caster->GetGUID()))
|
||||
damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber());
|
||||
|
||||
damage = damage / ticks;
|
||||
m_caster->CastCustomSpell(unitTarget, 12721, &damage, NULL, NULL, true);
|
||||
return;
|
||||
}
|
||||
case 13567: // Dummy Trigger
|
||||
{
|
||||
// can be used for different aura triggering, so select by aura
|
||||
if (!m_triggeredByAuraSpell || !unitTarget)
|
||||
return;
|
||||
|
||||
switch (m_triggeredByAuraSpell->Id)
|
||||
{
|
||||
case 26467: // Persistent Shield
|
||||
m_caster->CastCustomSpell(unitTarget, 26470, &damage, NULL, NULL, true);
|
||||
break;
|
||||
default:
|
||||
sLog->outError("EffectDummy: Non-handled case for spell 13567 for triggered aura %u", m_triggeredByAuraSpell->Id);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 17251: // Spirit Healer Res
|
||||
{
|
||||
if (!unitTarget || !m_originalCaster)
|
||||
return;
|
||||
|
||||
if (m_originalCaster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8);
|
||||
data << uint64(unitTarget->GetGUID());
|
||||
m_originalCaster->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 23019: // Crystal Prison Dummy DND
|
||||
{
|
||||
if (!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || unitTarget->ToCreature()->isPet())
|
||||
return;
|
||||
|
||||
Creature* creatureTarget = unitTarget->ToCreature();
|
||||
|
||||
m_caster->SummonGameObject(179644, creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), creatureTarget->GetOrientation(), 0, 0, 0, 0, uint32(creatureTarget->GetRespawnTime()-time(NULL)));
|
||||
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SummonGameObject at SpellEfects.cpp EffectDummy for Spell 23019");
|
||||
|
||||
creatureTarget->DespawnOrUnsummon();
|
||||
|
||||
return;
|
||||
}
|
||||
case 23448: // Transporter Arrival - Ultrasafe Transporter: Gadgetzan - backfires
|
||||
{
|
||||
int32 r = irand(0, 119);
|
||||
if (r < 20) // Transporter Malfunction - 1/6 polymorph
|
||||
m_caster->CastSpell(m_caster, 23444, true);
|
||||
else if (r < 100) // Evil Twin - 4/6 evil twin
|
||||
m_caster->CastSpell(m_caster, 23445, true);
|
||||
else // Transporter Malfunction - 1/6 miss the target
|
||||
m_caster->CastSpell(m_caster, 36902, true);
|
||||
return;
|
||||
}
|
||||
case 23453: // Gnomish Transporter - Ultrasafe Transporter: Gadgetzan
|
||||
if (roll_chance_i(50)) // Gadgetzan Transporter - success
|
||||
m_caster->CastSpell(m_caster, 23441, true);
|
||||
else // Gadgetzan Transporter Failure - failure
|
||||
m_caster->CastSpell(m_caster, 23446, true);
|
||||
return;
|
||||
case 25860: // Reindeer Transformation
|
||||
{
|
||||
if (!m_caster->HasAuraType(SPELL_AURA_MOUNTED))
|
||||
return;
|
||||
|
||||
float flyspeed = m_caster->GetSpeedRate(MOVE_FLIGHT);
|
||||
float speed = m_caster->GetSpeedRate(MOVE_RUN);
|
||||
|
||||
m_caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
|
||||
//5 different spells used depending on mounted speed and if mount can fly or not
|
||||
if (flyspeed >= 4.1f)
|
||||
// Flying Reindeer
|
||||
m_caster->CastSpell(m_caster, 44827, true); //310% flying Reindeer
|
||||
else if (flyspeed >= 3.8f)
|
||||
// Flying Reindeer
|
||||
m_caster->CastSpell(m_caster, 44825, true); //280% flying Reindeer
|
||||
else if (flyspeed >= 1.6f)
|
||||
// Flying Reindeer
|
||||
m_caster->CastSpell(m_caster, 44824, true); //60% flying Reindeer
|
||||
else if (speed >= 2.0f)
|
||||
// Reindeer
|
||||
m_caster->CastSpell(m_caster, 25859, true); //100% ground Reindeer
|
||||
else
|
||||
// Reindeer
|
||||
m_caster->CastSpell(m_caster, 25858, true); //60% ground Reindeer
|
||||
|
||||
return;
|
||||
}
|
||||
case 26074: // Holiday Cheer
|
||||
// implemented at client side
|
||||
return;
|
||||
// Polarity Shift
|
||||
case 28089:
|
||||
if (unitTarget)
|
||||
unitTarget->CastSpell(unitTarget, roll_chance_i(50) ? 28059 : 28084, true, NULL, NULL, m_caster->GetGUID());
|
||||
break;
|
||||
// Polarity Shift
|
||||
case 39096:
|
||||
if (unitTarget)
|
||||
unitTarget->CastSpell(unitTarget, roll_chance_i(50) ? 39088 : 39091, true, NULL, NULL, m_caster->GetGUID());
|
||||
break;
|
||||
case 29200: // Purify Helboar Meat
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
spell_id = roll_chance_i(50)
|
||||
? 29277 // Summon Purified Helboar Meat
|
||||
: 29278; // Summon Toxic Helboar Meat
|
||||
|
||||
m_caster->CastSpell(m_caster, spell_id, true, NULL);
|
||||
return;
|
||||
}
|
||||
case 29858: // Soulshatter
|
||||
if (unitTarget && unitTarget->CanHaveThreatList()
|
||||
&& unitTarget->getThreatManager().getThreat(m_caster) > 0.0f)
|
||||
m_caster->CastSpell(unitTarget, 32835, true);
|
||||
return;
|
||||
case 30458: // Nigh Invulnerability
|
||||
if (!m_CastItem) return;
|
||||
if (roll_chance_i(86)) // Nigh-Invulnerability - success
|
||||
m_caster->CastSpell(m_caster, 30456, true, m_CastItem);
|
||||
else // Complete Vulnerability - backfire in 14% casts
|
||||
m_caster->CastSpell(m_caster, 30457, true, m_CastItem);
|
||||
return;
|
||||
case 30507: // Poultryizer
|
||||
if (!m_CastItem) return;
|
||||
if (roll_chance_i(80)) // Poultryized! - success
|
||||
m_caster->CastSpell(unitTarget, 30501, true, m_CastItem);
|
||||
else // Poultryized! - backfire 20%
|
||||
m_caster->CastSpell(unitTarget, 30504, true, m_CastItem);
|
||||
return;
|
||||
case 35745: // Socrethar's Stone
|
||||
{
|
||||
switch (m_caster->GetAreaId())
|
||||
{
|
||||
case 3900:
|
||||
spell_id = 35743;
|
||||
break; // Socrethar Portal
|
||||
case 3742:
|
||||
spell_id = 35744;
|
||||
break; // Socrethar Portal
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
m_caster->CastSpell(m_caster, spell_id, true);
|
||||
return;
|
||||
}
|
||||
case 37674: // Chaos Blast
|
||||
{
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
int32 basepoints0 = 100;
|
||||
m_caster->CastCustomSpell(unitTarget, 37675, &basepoints0, NULL, NULL, true);
|
||||
return;
|
||||
}
|
||||
// Wrath of the Astromancer
|
||||
case 42784:
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
||||
if (ihit->effectMask & (1<<effIndex))
|
||||
++count;
|
||||
|
||||
damage = 12000; // maybe wrong value
|
||||
damage /= count;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(42784);
|
||||
|
||||
// now deal the damage
|
||||
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
||||
if (ihit->effectMask & (1<<effIndex))
|
||||
{
|
||||
if (Unit* casttarget = Unit::GetUnit((*unitTarget), ihit->targetGUID))
|
||||
m_caster->DealDamage(casttarget, damage, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, spellInfo, false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
// Demon Broiled Surprise
|
||||
case 43723:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = (Player*)m_caster;
|
||||
|
||||
if (player && player->GetQuestStatus(11379) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
Creature* creature = player->FindNearestCreature(19973, 10, false);
|
||||
if (!creature)
|
||||
{
|
||||
SendCastResult(SPELL_FAILED_NOT_HERE);
|
||||
return;
|
||||
}
|
||||
|
||||
player->CastSpell(player, 43753, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 44875: // Complete Raptor Capture
|
||||
{
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
unitTarget->ToCreature()->DespawnOrUnsummon();
|
||||
|
||||
//cast spell Raptor Capture Credit
|
||||
m_caster->CastSpell(m_caster, 42337, true, NULL);
|
||||
return;
|
||||
}
|
||||
case 47170: // Impale Leviroth
|
||||
{
|
||||
if (!unitTarget || (unitTarget->GetEntry() != 26452 && unitTarget->HealthAbovePct(95)))
|
||||
return;
|
||||
|
||||
m_caster->DealDamage(unitTarget, unitTarget->CountPctFromMaxHealth(93));
|
||||
return;
|
||||
}
|
||||
case 49357: // Brewfest Mount Transformation
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
if (!m_caster->HasAuraType(SPELL_AURA_MOUNTED))
|
||||
return;
|
||||
m_caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
// Ram for Alliance, Kodo for Horde
|
||||
if (m_caster->ToPlayer()->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (m_caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
// 100% Ram
|
||||
m_caster->CastSpell(m_caster, 43900, true);
|
||||
else
|
||||
// 60% Ram
|
||||
m_caster->CastSpell(m_caster, 43899, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_caster->ToPlayer()->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
// 100% Kodo
|
||||
m_caster->CastSpell(m_caster, 49379, true);
|
||||
else
|
||||
// 60% Kodo
|
||||
m_caster->CastSpell(m_caster, 49378, true);
|
||||
}
|
||||
return;
|
||||
case 52845: // Brewfest Mount Transformation (Faction Swap)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
if (!m_caster->HasAuraType(SPELL_AURA_MOUNTED))
|
||||
return;
|
||||
m_caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
// Ram for Horde, Kodo for Alliance
|
||||
if (m_caster->ToPlayer()->GetTeam() == HORDE)
|
||||
{
|
||||
if (m_caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
// 100% Ram
|
||||
m_caster->CastSpell(m_caster, 43900, true);
|
||||
else
|
||||
// 60% Ram
|
||||
m_caster->CastSpell(m_caster, 43899, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_caster->ToPlayer()->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
// 100% Kodo
|
||||
m_caster->CastSpell(m_caster, 49379, true);
|
||||
else
|
||||
// 60% Kodo
|
||||
m_caster->CastSpell(m_caster, 49378, true);
|
||||
}
|
||||
return;
|
||||
case 55004: // Nitro Boosts
|
||||
if (!m_CastItem)
|
||||
return;
|
||||
if (roll_chance_i(95)) // Nitro Boosts - success
|
||||
m_caster->CastSpell(m_caster, 54861, true, m_CastItem);
|
||||
else // Knocked Up - backfire 5%
|
||||
m_caster->CastSpell(m_caster, 46014, true, m_CastItem);
|
||||
return;
|
||||
case 50243: // Teach Language
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
// spell has a 1/3 chance to trigger one of the below
|
||||
if (roll_chance_i(66))
|
||||
return;
|
||||
if (m_caster->ToPlayer()->GetTeam() == ALLIANCE)
|
||||
{
|
||||
// 1000001 - gnomish binary
|
||||
m_caster->CastSpell(m_caster, 50242, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 01001000 - goblin binary
|
||||
m_caster->CastSpell(m_caster, 50246, true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
case 51582: //Rocket Boots Engaged (Rocket Boots Xtreme and Rocket Boots Xtreme Lite)
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (Battleground* bg = m_caster->ToPlayer()->GetBattleground())
|
||||
bg->EventPlayerDroppedFlag(m_caster->ToPlayer());
|
||||
|
||||
m_caster->CastSpell(m_caster, 30452, true, NULL);
|
||||
return;
|
||||
}
|
||||
case 52759: // Ancestral Awakening
|
||||
if (!unitTarget)
|
||||
return;
|
||||
m_caster->CastCustomSpell(unitTarget, 52752, &damage, NULL, NULL, true);
|
||||
return;
|
||||
case 54171: // Divine Storm
|
||||
{
|
||||
if (m_UniqueTargetInfo.size())
|
||||
{
|
||||
int32 heal = damage / m_UniqueTargetInfo.size();
|
||||
m_caster->CastCustomSpell(unitTarget, 54172, &heal, NULL, NULL, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 58418: // Portal to Orgrimmar
|
||||
case 58420: // Portal to Stormwind
|
||||
return; // implemented in EffectScript[0]
|
||||
case 62324: // Throw Passenger
|
||||
{
|
||||
if (m_targets.HasTraj())
|
||||
{
|
||||
if (Vehicle* vehicle = m_caster->GetVehicleKit())
|
||||
if (Unit* passenger = vehicle->GetPassenger(damage - 1))
|
||||
{
|
||||
std::list<Unit*> unitList;
|
||||
// use 99 because it is 3d search
|
||||
SearchAreaTarget(unitList, 99, PUSH_DST_CENTER, SPELL_TARGETS_ENTRY, 33114);
|
||||
float minDist = 99 * 99;
|
||||
Unit* target = NULL;
|
||||
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
|
||||
{
|
||||
if (Vehicle* seat = (*itr)->GetVehicleKit())
|
||||
if (!seat->GetPassenger(0))
|
||||
if (Unit* device = seat->GetPassenger(2))
|
||||
if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
{
|
||||
float dist = (*itr)->GetExactDistSq(m_targets.GetDst());
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
target = (*itr);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target && target->IsWithinDist2d(m_targets.GetDst(), m_spellInfo->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct
|
||||
passenger->EnterVehicle(target, 0);
|
||||
else
|
||||
{
|
||||
passenger->ExitVehicle();
|
||||
float x, y, z;
|
||||
m_targets.GetDst()->GetPosition(x, y, z);
|
||||
passenger->GetMotionMaster()->MoveJump(x, y, z, m_targets.GetSpeedXY(), m_targets.GetSpeedZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 64385: // Unusual Compass
|
||||
{
|
||||
m_caster->SetOrientation(float(urand(0, 62832)) / 10000.0f);
|
||||
WorldPacket data;
|
||||
m_caster->BuildHeartBeatMsg(&data);
|
||||
m_caster->SendMessageToSet(&data, true);
|
||||
return;
|
||||
}
|
||||
case 53808: // Pygmy Oil
|
||||
{
|
||||
Aura* pAura = m_caster->GetAura(53806);
|
||||
if (pAura)
|
||||
pAura->RefreshDuration();
|
||||
else
|
||||
{
|
||||
pAura = m_caster->GetAura(53805);
|
||||
if (!pAura || pAura->GetStackAmount() < 5 || !roll_chance_i(50))
|
||||
m_caster->CastSpell(m_caster, 53805, true);
|
||||
else
|
||||
{
|
||||
pAura->Remove();
|
||||
m_caster->CastSpell(m_caster, 53806, true);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 54577: // U.D.E.D.
|
||||
{
|
||||
if (unitTarget->GetEntry() != 29402)
|
||||
return;
|
||||
|
||||
m_caster->SummonGameObject(192693, unitTarget->GetPositionX(), unitTarget->GetPositionY(),
|
||||
unitTarget->GetPositionZ(), unitTarget->GetOrientation(), 0, 0, 0, 0, 100);
|
||||
|
||||
for (uint8 i = 0; i < 4; ++i)
|
||||
m_caster->SummonGameObject(191567, float(unitTarget->GetPositionX() + irand(-7, 7)),
|
||||
float(unitTarget->GetPositionY() + irand(-7, 7)), unitTarget->GetPositionZ(), unitTarget->GetOrientation(),
|
||||
0, 0, 0, 0, 100);
|
||||
|
||||
unitTarget->Kill(unitTarget);
|
||||
return;
|
||||
}
|
||||
case 51961: // Captured Chicken Cover - Quest 12702 & 12532
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER
|
||||
|| !unitTarget->HasAura(51959)
|
||||
|| !(m_caster->ToPlayer()->GetQuestStatus(12702) == QUEST_STATUS_INCOMPLETE || m_caster->ToPlayer()->GetQuestStatus(12532) == QUEST_STATUS_INCOMPLETE))
|
||||
return;
|
||||
|
||||
m_caster->CastSpell(m_caster, 51037, true);
|
||||
unitTarget->Kill(unitTarget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SPELLFAMILY_WARRIOR:
|
||||
// Charge
|
||||
if (m_spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_WARRIOR_CHARGE && m_spellInfo->SpellVisual[0] == 867)
|
||||
{
|
||||
int32 chargeBasePoints0 = damage;
|
||||
m_caster->CastCustomSpell(m_caster, 34846, &chargeBasePoints0, NULL, NULL, true);
|
||||
|
||||
//Juggernaut crit bonus
|
||||
if (m_caster->HasAura(64976))
|
||||
m_caster->CastSpell(m_caster, 65156, true);
|
||||
return;
|
||||
}
|
||||
// Slam
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_SLAM && m_spellInfo->SpellIconID == 559)
|
||||
{
|
||||
int32 bp0 = damage;
|
||||
m_caster->CastCustomSpell(unitTarget, 50783, &bp0, NULL, NULL, true, 0);
|
||||
return;
|
||||
}
|
||||
// Execute
|
||||
if (m_spellInfo->SpellFamilyFlags[EFFECT_0] & SPELLFAMILYFLAG_WARRIOR_EXECUTE)
|
||||
{
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
spell_id = 20647;
|
||||
|
||||
int32 rageUsed = std::min<int32>(300 - m_powerCost, m_caster->GetPower(POWER_RAGE));
|
||||
int32 newRage = std::max<int32>(0, m_caster->GetPower(POWER_RAGE) - rageUsed);
|
||||
|
||||
// Sudden Death rage save
|
||||
if (AuraEffect* aurEff = m_caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, 1989, EFFECT_0))
|
||||
{
|
||||
int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10;
|
||||
newRage = std::max(newRage, ragesave);
|
||||
}
|
||||
|
||||
m_caster->SetPower(POWER_RAGE, uint32(newRage));
|
||||
|
||||
// Glyph of Execution bonus
|
||||
if (AuraEffect* aurEff = m_caster->GetAuraEffect(58367, EFFECT_0))
|
||||
rageUsed += aurEff->GetAmount() * 10;
|
||||
|
||||
bp = damage + int32(rageUsed * m_spellInfo->Effects[effIndex].DamageMultiplier + m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
|
||||
break;
|
||||
}
|
||||
// Concussion Blow
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_CONCUSSION_BLOW)
|
||||
{
|
||||
m_damage += CalculatePctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
|
||||
return;
|
||||
}
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
// Bloodthirst
|
||||
case 23881:
|
||||
{
|
||||
m_caster->CastCustomSpell(unitTarget, 23885, &damage, NULL, NULL, true, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SPELLFAMILY_WARLOCK:
|
||||
// Life Tap
|
||||
if ((m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARLOCK_LIFETAP) && m_caster->ToPlayer())
|
||||
{
|
||||
float spFactor = 0.0f;
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
case 11689: spFactor = 0.2f; break;
|
||||
case 27222:
|
||||
case 57946: spFactor = 0.5f; break;
|
||||
}
|
||||
int32 damage = int32(m_spellInfo->Effects[EFFECT_0].CalcValue() + (6.3875 * m_spellInfo->BaseLevel));
|
||||
int32 mana = int32(damage + (m_caster->ToPlayer()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor));
|
||||
|
||||
if (unitTarget && (int32(unitTarget->GetHealth()) > damage))
|
||||
{
|
||||
// Shouldn't Appear in Combat Log
|
||||
unitTarget->ModifyHealth(-damage);
|
||||
|
||||
// Improved Life Tap mod
|
||||
if (AuraEffect const* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 208, 0))
|
||||
AddPctN(mana, aurEff->GetAmount());
|
||||
|
||||
m_caster->CastCustomSpell(unitTarget, 31818, &mana, NULL, NULL, false);
|
||||
|
||||
// Mana Feed
|
||||
int32 manaFeedVal = 0;
|
||||
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, 1982, 0))
|
||||
manaFeedVal = aurEff->GetAmount();
|
||||
|
||||
if (manaFeedVal > 0)
|
||||
{
|
||||
ApplyPctN(manaFeedVal, mana);
|
||||
m_caster->CastCustomSpell(m_caster, 32553, &manaFeedVal, NULL, NULL, true, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
SendCastResult(SPELL_FAILED_FIZZLE);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SPELLFAMILY_DRUID:
|
||||
// Starfall
|
||||
if (m_spellInfo->SpellFamilyFlags[2] & SPELLFAMILYFLAG2_DRUID_STARFALL)
|
||||
{
|
||||
//Shapeshifting into an animal form or mounting cancels the effect.
|
||||
if (m_caster->GetCreatureType() == CREATURE_TYPE_BEAST || m_caster->IsMounted())
|
||||
{
|
||||
if (m_triggeredByAuraSpell)
|
||||
m_caster->RemoveAurasDueToSpell(m_triggeredByAuraSpell->Id);
|
||||
return;
|
||||
}
|
||||
|
||||
//Any effect which causes you to lose control of your character will supress the starfall effect.
|
||||
if (m_caster->HasUnitState(UNIT_STATE_CONTROLLED))
|
||||
return;
|
||||
|
||||
m_caster->CastSpell(unitTarget, damage, true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SPELLFAMILY_PALADIN:
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
@@ -1378,128 +784,40 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SPELLFAMILY_SHAMAN:
|
||||
// Cleansing Totem Pulse
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_TOTEM_EFFECTS && m_spellInfo->SpellIconID == 1673)
|
||||
{
|
||||
int32 bp1 = 1;
|
||||
// Cleansing Totem Effect
|
||||
if (unitTarget)
|
||||
m_caster->CastCustomSpell(unitTarget, 52025, NULL, &bp1, NULL, true, NULL, NULL, m_originalCasterGUID);
|
||||
return;
|
||||
}
|
||||
// Healing Stream Totem
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_HEALING_STREAM)
|
||||
{
|
||||
if (!unitTarget)
|
||||
return;
|
||||
if (Unit* owner = m_caster->GetOwner())
|
||||
{
|
||||
if (m_triggeredByAuraSpell)
|
||||
damage = int32(owner->SpellHealingBonus(unitTarget, m_triggeredByAuraSpell, damage, HEAL));
|
||||
|
||||
// Restorative Totems
|
||||
if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 338, 1))
|
||||
AddPctN(damage, dummy->GetAmount());
|
||||
|
||||
// Glyph of Healing Stream Totem
|
||||
if (AuraEffect const* aurEff = owner->GetAuraEffect(55456, EFFECT_0))
|
||||
AddPctN(damage, aurEff->GetAmount());
|
||||
}
|
||||
m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID);
|
||||
return;
|
||||
}
|
||||
// Mana Spring Totem
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_MANA_SPRING)
|
||||
{
|
||||
if (!unitTarget || unitTarget->getPowerType() != POWER_MANA)
|
||||
return;
|
||||
m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID);
|
||||
return;
|
||||
}
|
||||
// Lava Lash
|
||||
if (m_spellInfo->SpellFamilyFlags[2] & SPELLFAMILYFLAG2_SHAMAN_LAVA_LASH)
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (m_caster->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
||||
{
|
||||
// Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue.
|
||||
if (m_caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0))
|
||||
AddPctN(m_damage, damage);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SPELLFAMILY_DEATHKNIGHT:
|
||||
// Death strike
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_STRIKE)
|
||||
{
|
||||
uint32 count = unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
|
||||
bp = int32(count * m_caster->CountPctFromMaxHealth(int32(m_spellInfo->Effects[EFFECT_0].DamageMultiplier)));
|
||||
// Improved Death Strike
|
||||
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2751, 0))
|
||||
AddPctN(bp, m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellInfo(), 2));
|
||||
m_caster->CastCustomSpell(m_caster, 45470, &bp, NULL, NULL, false);
|
||||
return;
|
||||
}
|
||||
// Death Coil
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_COIL)
|
||||
{
|
||||
if (m_caster->IsFriendlyTo(unitTarget))
|
||||
{
|
||||
bp = int32(damage * 1.5f);
|
||||
m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
bp = damage;
|
||||
m_caster->CastCustomSpell(unitTarget, 47632, &bp, NULL, NULL, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
case 49560: // Death Grip
|
||||
Position pos;
|
||||
GetSummonPosition(effIndex, pos);
|
||||
if (Unit* unit = unitTarget->GetVehicleBase()) // what is this for?
|
||||
unit->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true);
|
||||
else if (!unitTarget->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
|
||||
unitTarget->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true);
|
||||
return;
|
||||
case 46584: // Raise Dead
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
case 46584: // Raise Dead
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
// Do we have talent Master of Ghouls?
|
||||
if (m_caster->HasAura(52143))
|
||||
// summon as pet
|
||||
bp = 52150;
|
||||
else
|
||||
// or guardian
|
||||
bp = 46585;
|
||||
// Do we have talent Master of Ghouls?
|
||||
if (m_caster->HasAura(52143))
|
||||
// summon as pet
|
||||
bp = 52150;
|
||||
else
|
||||
// or guardian
|
||||
bp = 46585;
|
||||
|
||||
if (m_targets.HasDst())
|
||||
targets.SetDst(*m_targets.GetDst());
|
||||
else
|
||||
{
|
||||
targets.SetDst(*m_caster);
|
||||
// Corpse not found - take reagents (only not triggered cast can take them)
|
||||
triggered = false;
|
||||
}
|
||||
// Remove cooldown - summon spellls have category
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
|
||||
spell_id = 48289;
|
||||
break;
|
||||
// Raise dead - take reagents and trigger summon spells
|
||||
case 48289:
|
||||
if (m_targets.HasDst())
|
||||
targets.SetDst(*m_targets.GetDst());
|
||||
if (m_targets.HasDst())
|
||||
targets.SetDst(*m_targets.GetDst());
|
||||
else
|
||||
{
|
||||
targets.SetDst(*m_caster);
|
||||
// Corpse not found - take reagents (only not triggered cast can take them)
|
||||
triggered = false;
|
||||
}
|
||||
// Remove cooldown - summon spellls have category
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
|
||||
spell_id = 48289;
|
||||
break;
|
||||
// Raise dead - take reagents and trigger summon spells
|
||||
case 48289:
|
||||
if (m_targets.HasDst())
|
||||
targets.SetDst(*m_targets.GetDst());
|
||||
|
||||
spell_id = CalculateDamage(0, NULL);
|
||||
break;
|
||||
spell_id = CalculateDamage(0, NULL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -468,6 +468,16 @@ void SpellScript::PreventHitAura()
|
||||
m_spell->m_spellAura->Remove();
|
||||
}
|
||||
|
||||
void SpellScript::GetSummonPosition(uint32 i, Position &pos, float radius = 0.0f, uint32 count = 0)
|
||||
{
|
||||
m_spell->GetSummonPosition(i, pos, radius, count);
|
||||
}
|
||||
|
||||
void SpellScript::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry)
|
||||
{
|
||||
m_spell->SearchAreaTarget(TagUnitMap, radius, type, TargetType, entry);
|
||||
}
|
||||
|
||||
void SpellScript::PreventHitEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
if (!IsInHitPhase() && !IsInEffectHook())
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Util.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "SpellAuraDefines.h"
|
||||
#include "Spell.h"
|
||||
#include <stack>
|
||||
|
||||
class Unit;
|
||||
@@ -333,7 +334,9 @@ class SpellScript : public _SpellScript
|
||||
int32 GetHitHeal();
|
||||
void SetHitHeal(int32 heal);
|
||||
void PreventHitHeal() { SetHitHeal(0); }
|
||||
|
||||
Spell* GetSpell() { return m_spell; }
|
||||
void GetSummonPosition(uint32 i, Position &pos, float radius, uint32 count);
|
||||
void SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry);
|
||||
// returns current spell hit target aura
|
||||
Aura* GetHitAura();
|
||||
// prevents applying aura on current spell hit target
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "naxxramas.h"
|
||||
|
||||
//Stalagg
|
||||
@@ -87,7 +86,9 @@ enum ThaddiusSpells
|
||||
SPELL_POSITIVE_CHARGE = 28062,
|
||||
SPELL_POSITIVE_CHARGE_STACK = 29659,
|
||||
SPELL_NEGATIVE_CHARGE = 28085,
|
||||
SPELL_NEGATIVE_CHARGE_STACK = 29660
|
||||
SPELL_NEGATIVE_CHARGE_STACK = 29660,
|
||||
SPELL_POSITIVE_POLARITY = 28059,
|
||||
SPELL_NEGATIVE_POLARITY = 28084,
|
||||
};
|
||||
|
||||
enum Events
|
||||
@@ -503,6 +504,41 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
class spell_thaddius_polarity_shift : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_thaddius_polarity_shift() : SpellScriptLoader("spell_thaddius_polarity_shift") { }
|
||||
|
||||
class spell_thaddius_polarity_shift_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_thaddius_polarity_shift_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_POLARITY) || !sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_POLARITY))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, NULL, NULL, caster->GetGUID());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_thaddius_polarity_shift_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_thaddius_polarity_shift_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class achievement_polarity_switch : public AchievementCriteriaScript
|
||||
{
|
||||
public:
|
||||
@@ -520,5 +556,6 @@ void AddSC_boss_thaddius()
|
||||
new mob_stalagg();
|
||||
new mob_feugen();
|
||||
new spell_thaddius_pos_neg_charge();
|
||||
new spell_thaddius_polarity_shift();
|
||||
new achievement_polarity_switch();
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "Vehicle.h"
|
||||
#include "VehicleDefines.h"
|
||||
#include "ulduar.h"
|
||||
#include "Spell.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
@@ -1718,6 +1719,67 @@ class spell_pursue : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
class spell_vehicle_throw_passenger : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_vehicle_throw_passenger() : SpellScriptLoader("spell_vehicle_throw_passenger") {}
|
||||
|
||||
class spell_vehicle_throw_passenger_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_vehicle_throw_passenger_SpellScript);
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
Spell* baseSpell = GetSpell();
|
||||
SpellCastTargets targets = baseSpell->m_targets;
|
||||
int32 damage = GetEffectValue();
|
||||
if (targets.HasTraj())
|
||||
if (Vehicle* vehicle = GetCaster()->GetVehicleKit())
|
||||
if (Unit* passenger = vehicle->GetPassenger(damage - 1))
|
||||
{
|
||||
std::list<Unit*> unitList;
|
||||
// use 99 because it is 3d search
|
||||
SearchAreaTarget(unitList, 99, PUSH_DST_CENTER, SPELL_TARGETS_ENTRY, NPC_SEAT);
|
||||
float minDist = 99 * 99;
|
||||
Unit* target = NULL;
|
||||
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
|
||||
{
|
||||
if (Vehicle* seat = (*itr)->GetVehicleKit())
|
||||
if (!seat->GetPassenger(0))
|
||||
if (Unit* device = seat->GetPassenger(2))
|
||||
if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
{
|
||||
float dist = (*itr)->GetExactDistSq(targets.GetDst());
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
target = (*itr);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target && target->IsWithinDist2d(targets.GetDst(), GetSpellInfo()->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct
|
||||
passenger->EnterVehicle(target, 0);
|
||||
else
|
||||
{
|
||||
passenger->ExitVehicle();
|
||||
float x, y, z;
|
||||
targets.GetDst()->GetPosition(x, y, z);
|
||||
passenger->GetMotionMaster()->MoveJump(x, y, z, targets.GetSpeedXY(), targets.GetSpeedZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_vehicle_throw_passenger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_vehicle_throw_passenger_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_flame_leviathan()
|
||||
{
|
||||
new boss_flame_leviathan();
|
||||
@@ -1752,4 +1814,5 @@ void AddSC_boss_flame_leviathan()
|
||||
new spell_auto_repair();
|
||||
new spell_systems_shutdown();
|
||||
new spell_pursue();
|
||||
new spell_vehicle_throw_passenger();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ SDComment:
|
||||
SDCategory: Tempest Keep, The Eye
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "the_eye.h"
|
||||
|
||||
enum eEnums
|
||||
@@ -40,6 +39,7 @@ enum eEnums
|
||||
|
||||
SPELL_ARCANE_MISSILES = 33031,
|
||||
SPELL_WRATH_OF_THE_ASTROMANCER = 42783,
|
||||
SPELL_WRATH_OF_THE_ASTROMANCER_DOT = 42784,
|
||||
SPELL_BLINDING_LIGHT = 33009,
|
||||
SPELL_FEAR = 34322,
|
||||
SPELL_VOID_BOLT = 39329,
|
||||
@@ -491,9 +491,74 @@ class mob_solarium_priest : public CreatureScript
|
||||
return new mob_solarium_priestAI (Creature);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_astromancer_wrath_of_the_astromancer() : SpellScriptLoader("spell_astromancer_wrath_of_the_astromancer") { }
|
||||
|
||||
class spell_astromancer_wrath_of_the_astromancer_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_astromancer_wrath_of_the_astromancer_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WRATH_OF_THE_ASTROMANCER_DOT))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
_targetCount = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CountTargets(std::list<Unit*>& targetList)
|
||||
{
|
||||
_targetCount = targetList.size();
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
if (Unit* caster = GetOriginalCaster())
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
if (!target->isAlive() || !_targetCount)
|
||||
return;
|
||||
|
||||
int32 damage = 10000 / _targetCount;
|
||||
|
||||
SpellNonMeleeDamage damageInfo(caster, target, GetSpellInfo()->Id, GetSpellInfo()->SchoolMask);
|
||||
damageInfo.damage = damage;
|
||||
|
||||
caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &damageInfo.absorb, &damageInfo.resist, GetSpellInfo());
|
||||
caster->DealDamageMods(target, damageInfo.damage, &damageInfo.absorb);
|
||||
caster->SendSpellNonMeleeDamageLog(&damageInfo);
|
||||
caster->DealSpellDamage(&damageInfo, false);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int32 _targetCount;
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_astromancer_wrath_of_the_astromancer_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_high_astromancer_solarian()
|
||||
{
|
||||
new boss_high_astromancer_solarian();
|
||||
new mob_solarium_priest();
|
||||
new spell_astromancer_wrath_of_the_astromancer();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,20 +22,22 @@
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_POSITIVE_CHARGE = 39090,
|
||||
SPELL_POSITIVE_POLARITY = 39088,
|
||||
SPELL_POSITIVE_CHARGE_STACK = 39089,
|
||||
SPELL_POSITIVE_CHARGE = 39090,
|
||||
SPELL_NEGATIVE_POLARITY = 39091,
|
||||
SPELL_NEGATIVE_CHARGE_STACK = 39092,
|
||||
SPELL_NEGATIVE_CHARGE = 39093,
|
||||
SPELL_NEGATIVE_CHARGE_STACK = 39092
|
||||
};
|
||||
|
||||
class spell_capacitus_polarity_shift : public SpellScriptLoader
|
||||
class spell_capacitus_polarity_charge : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_capacitus_polarity_shift() : SpellScriptLoader("spell_capacitus_polarity_shift") { }
|
||||
spell_capacitus_polarity_charge() : SpellScriptLoader("spell_capacitus_polarity_charge") { }
|
||||
|
||||
class spell_capacitus_polarity_shift_SpellScript : public SpellScript
|
||||
class spell_capacitus_polarity_charge_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_capacitus_polarity_shift_SpellScript);
|
||||
PrepareSpellScript(spell_capacitus_polarity_charge_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
@@ -85,8 +87,44 @@ class spell_capacitus_polarity_shift : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_capacitus_polarity_shift_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_capacitus_polarity_shift_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_capacitus_polarity_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_capacitus_polarity_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_capacitus_polarity_charge_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_capacitus_polarity_shift : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_capacitus_polarity_shift() : SpellScriptLoader("spell_capacitus_polarity_shift") { }
|
||||
|
||||
class spell_capacitus_polarity_shift_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_capacitus_polarity_shift_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_POLARITY) || !sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_POLARITY))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* target = GetHitUnit();
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, NULL, NULL, caster->GetGUID());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_capacitus_polarity_shift_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -98,5 +136,6 @@ class spell_capacitus_polarity_shift : public SpellScriptLoader
|
||||
|
||||
void AddSC_boss_mechano_lord_capacitus()
|
||||
{
|
||||
new spell_capacitus_polarity_charge();
|
||||
new spell_capacitus_polarity_shift();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_dk_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "Spell.h"
|
||||
|
||||
enum DeathKnightSpells
|
||||
@@ -103,7 +102,9 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
return sSpellMgr->GetSpellInfo(DK_SPELL_RUNIC_POWER_ENERGIZE);
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_RUNIC_POWER_ENERGIZE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
@@ -160,17 +161,16 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
return sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT);
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
{
|
||||
SpellInfo const* talentSpell = sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT);
|
||||
amount = talentSpell->Effects[EFFECT_0].CalcValue(GetCaster());
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
if (Player* player = caster->ToPlayer())
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
amount += int32(2 * player->GetTotalAttackPowerValue(BASE_ATTACK));
|
||||
}
|
||||
|
||||
@@ -204,9 +204,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_GHOUL_EXPLODE))
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED) || !sSpellMgr->GetSpellInfo(DK_SPELL_GHOUL_EXPLODE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_VISUAL))
|
||||
return false;
|
||||
@@ -257,6 +255,13 @@ class spell_dk_ghoul_explode : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_dk_ghoul_explode_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Suicide(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
@@ -301,9 +306,8 @@ class spell_dk_death_gate : public SpellScriptLoader
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (!GetHitUnit())
|
||||
return;
|
||||
GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), false);
|
||||
if (Unit* target = GetHitUnit())
|
||||
target->CastSpell(target, GetEffectValue(), false);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -567,12 +571,11 @@ public:
|
||||
|
||||
class spell_dk_improved_blood_presence_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dk_improved_blood_presence_AuraScript)
|
||||
PrepareAuraScript(spell_dk_improved_blood_presence_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*entry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_PRESENCE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_PRESENCE) || !sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -615,12 +618,11 @@ public:
|
||||
|
||||
class spell_dk_improved_unholy_presence_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dk_improved_unholy_presence_AuraScript)
|
||||
PrepareAuraScript(spell_dk_improved_unholy_presence_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*entry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_UNHOLY_PRESENCE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
|
||||
if (!sSpellMgr->GetSpellInfo(DK_SPELL_UNHOLY_PRESENCE) || !sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -656,6 +658,141 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
enum DeathStrike
|
||||
{
|
||||
ICON_ID_IMPROVED_DEATH_STRIKE = 2751,
|
||||
SPELL_DEATH_STRIKE_HEAL = 45470,
|
||||
};
|
||||
|
||||
class spell_dk_death_strike : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_dk_death_strike() : SpellScriptLoader("spell_dk_death_strike") { }
|
||||
|
||||
class spell_dk_death_strike_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_dk_death_strike_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_STRIKE_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
uint32 count = target->GetDiseasesByCaster(caster->GetGUID());
|
||||
int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier)));
|
||||
// Improved Death Strike
|
||||
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0))
|
||||
AddPctN(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
|
||||
caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dk_death_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_dk_death_strike_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum DeathCoil
|
||||
{
|
||||
SPELL_DEATH_COIL_DAMAGE = 47632,
|
||||
SPELL_DEATH_COIL_HEAL = 47633,
|
||||
};
|
||||
|
||||
class spell_dk_death_coil : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_dk_death_coil() : SpellScriptLoader("spell_dk_death_coil") { }
|
||||
|
||||
class spell_dk_death_coil_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_dk_death_coil_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (caster->IsFriendlyTo(target))
|
||||
{
|
||||
int32 bp = int32(damage * 1.5f);
|
||||
caster->CastCustomSpell(target, SPELL_DEATH_COIL_HEAL, &bp, NULL, NULL, true);
|
||||
}
|
||||
else
|
||||
caster->CastCustomSpell(target, SPELL_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_dk_death_coil_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_dk_death_grip : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_dk_death_grip() : SpellScriptLoader("spell_dk_death_grip") { }
|
||||
|
||||
class spell_dk_death_grip_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_dk_death_grip_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
Spell* baseSpell = GetSpell();
|
||||
Position pos;
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
GetSummonPosition(effIndex, pos, 0.0f, 0);
|
||||
|
||||
if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
|
||||
target->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_dk_death_grip_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_deathknight_spell_scripts()
|
||||
{
|
||||
new spell_dk_anti_magic_shell_raid();
|
||||
@@ -671,4 +808,7 @@ void AddSC_deathknight_spell_scripts()
|
||||
new spell_dk_will_of_the_necropolis();
|
||||
new spell_dk_improved_blood_presence();
|
||||
new spell_dk_improved_unholy_presence();
|
||||
new spell_dk_death_strike();
|
||||
new spell_dk_death_coil();
|
||||
new spell_dk_death_grip();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_dru_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
enum DruidSpells
|
||||
@@ -42,9 +41,7 @@ class spell_dru_glyph_of_starfire : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(DRUID_INCREASED_MOONFIRE_DURATION))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(DRUID_NATURES_SPLENDOR))
|
||||
if (!sSpellMgr->GetSpellInfo(DRUID_INCREASED_MOONFIRE_DURATION) || !sSpellMgr->GetSpellInfo(DRUID_NATURES_SPLENDOR))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -305,14 +302,16 @@ class spell_dru_swift_flight_passive : public SpellScriptLoader
|
||||
{
|
||||
PrepareAuraScript(spell_dru_swift_flight_passive_AuraScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster || !caster->ToPlayer())
|
||||
return;
|
||||
|
||||
if (caster->ToPlayer()->Has310Flyer(false))
|
||||
amount = 310;
|
||||
if (Player* caster = GetCaster()->ToPlayer())
|
||||
if (caster->Has310Flyer(false))
|
||||
amount = 310;
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -327,6 +326,47 @@ class spell_dru_swift_flight_passive : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
class spell_dru_starfall_dummy : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_dru_starfall_dummy() : SpellScriptLoader("spell_dru_starfall_dummy") { }
|
||||
|
||||
class spell_dru_starfall_dummy_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_dru_starfall_dummy_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
if (GetTriggeringSpell())
|
||||
sLog->outString("triggering spell = %u",GetTriggeringSpell()->Id);
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->IsInDisallowedMountForm() || caster->IsMounted())
|
||||
{
|
||||
if (SpellInfo const* spellInfo = GetTriggeringSpell())
|
||||
caster->RemoveAurasDueToSpell(spellInfo->Id);
|
||||
return;
|
||||
}
|
||||
|
||||
//Any effect which causes you to lose control of your character will supress the starfall effect.
|
||||
if (caster->HasUnitState(UNIT_STATE_CONTROLLED))
|
||||
return;
|
||||
|
||||
caster->CastSpell(GetHitUnit(), GetEffectValue(), true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dru_starfall_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_dru_starfall_dummy_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_druid_spell_scripts()
|
||||
{
|
||||
new spell_dru_glyph_of_starfire();
|
||||
@@ -336,4 +376,5 @@ void AddSC_druid_spell_scripts()
|
||||
new spell_dru_t10_restoration_4p_bonus();
|
||||
new spell_dru_starfall_aoe();
|
||||
new spell_dru_swift_flight_passive();
|
||||
new spell_dru_starfall_dummy();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_gen_"
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SkillDiscovery.h"
|
||||
#include "GridNotifiers.h"
|
||||
@@ -236,9 +235,7 @@ class spell_gen_parachute : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) || !sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -246,13 +243,11 @@ class spell_gen_parachute : public SpellScriptLoader
|
||||
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (Player* target = GetTarget()->ToPlayer())
|
||||
{
|
||||
if (target->IsFalling())
|
||||
{
|
||||
target->RemoveAurasDueToSpell(SPELL_PARACHUTE);
|
||||
target->CastSpell(target, SPELL_PARACHUTE_BUFF, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -283,13 +278,14 @@ class spell_gen_pet_summoned : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_gen_pet_summoned_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = caster->ToPlayer();
|
||||
Player* player = GetCaster()->ToPlayer();
|
||||
if (player->GetLastPetNumber())
|
||||
{
|
||||
PetType newPetType = (player->getClass() == CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET;
|
||||
@@ -340,10 +336,14 @@ class spell_gen_remove_flight_auras : public SpellScriptLoader
|
||||
class spell_gen_remove_flight_auras_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_remove_flight_auras_SpellScript);
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetHitUnit()->RemoveAurasByType(SPELL_AURA_FLY);
|
||||
GetHitUnit()->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED);
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
target->RemoveAurasByType(SPELL_AURA_FLY);
|
||||
target->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -376,22 +376,21 @@ class spell_gen_leeching_swarm : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG) || !sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetTarget())
|
||||
{
|
||||
int32 lifeLeeched = GetTarget()->CountPctFromCurHealth(aurEff->GetAmount());
|
||||
int32 lifeLeeched = target->CountPctFromCurHealth(aurEff->GetAmount());
|
||||
if (lifeLeeched < 250)
|
||||
lifeLeeched = 250;
|
||||
// Damage
|
||||
caster->CastCustomSpell(GetTarget(), SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false);
|
||||
caster->CastCustomSpell(target, SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false);
|
||||
// Heal
|
||||
caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &lifeLeeched, 0, 0, false);
|
||||
}
|
||||
@@ -500,31 +499,16 @@ class spell_gen_trick : public SpellScriptLoader
|
||||
PrepareSpellScript(spell_gen_trick_SpellScript);
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SKELETON_COSTUME))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRICK_BUFF))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_SKELETON_COSTUME) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_TRICK_BUFF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
uint8 gender = target->getGender();
|
||||
@@ -550,7 +534,7 @@ class spell_gen_trick : public SpellScriptLoader
|
||||
break;
|
||||
}
|
||||
|
||||
GetCaster()->CastSpell(target, spellId, true, NULL);
|
||||
caster->CastSpell(target, spellId, true, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,21 +569,18 @@ class spell_gen_trick_or_treat : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRICK))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TREAT))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRICKED_OR_TREATED))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRICK) || !sSpellMgr->GetSpellInfo(SPELL_TREAT) || !sSpellMgr->GetSpellInfo(SPELL_TRICKED_OR_TREATED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
GetCaster()->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, NULL);
|
||||
GetCaster()->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, NULL);
|
||||
caster->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, NULL);
|
||||
caster->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,11 +642,14 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_pvp_trinket_wotf_shared_cd_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -673,10 +657,7 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (!caster)
|
||||
return;
|
||||
SpellInfo const* spellInfo = GetSpellInfo();
|
||||
|
||||
caster->AddSpellCooldown(spellInfo->Id, 0, time(NULL) + sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER)->GetRecoveryTime() / IN_MILLISECONDS);
|
||||
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4);
|
||||
data << uint64(caster->GetGUID());
|
||||
@@ -729,8 +710,9 @@ class spell_gen_animal_blood : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetUnitOwner()->IsInWater())
|
||||
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SPAWN_BLOOD_POOL, true);
|
||||
if (Unit* owner = GetUnitOwner())
|
||||
if (owner->IsInWater())
|
||||
owner->CastSpell(owner, SPELL_SPAWN_BLOOD_POOL, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -761,6 +743,11 @@ class spell_gen_divine_storm_cd_reset : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_gen_divine_storm_cd_reset_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM))
|
||||
@@ -770,9 +757,9 @@ class spell_gen_divine_storm_cd_reset : public SpellScriptLoader
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* caster = GetCaster()->ToPlayer())
|
||||
if (caster->HasSpellCooldown(SPELL_DIVINE_STORM))
|
||||
caster->RemoveSpellCooldown(SPELL_DIVINE_STORM, true);
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (caster->HasSpellCooldown(SPELL_DIVINE_STORM))
|
||||
caster->RemoveSpellCooldown(SPELL_DIVINE_STORM, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -796,13 +783,15 @@ class spell_gen_gunship_portal : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_gen_gunship_portal_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (Battleground* bg = caster->ToPlayer()->GetBattleground())
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (Battleground* bg = caster->GetBattleground())
|
||||
if (bg->GetTypeID(true) == BATTLEGROUND_IC)
|
||||
bg->DoAction(1, caster->GetGUID());
|
||||
}
|
||||
@@ -821,7 +810,7 @@ class spell_gen_gunship_portal : public SpellScriptLoader
|
||||
|
||||
enum parachuteIC
|
||||
{
|
||||
SPELL_PARACHUTE_IC = 66657
|
||||
SPELL_PARACHUTE_IC = 66657,
|
||||
};
|
||||
|
||||
class spell_gen_parachute_ic : public SpellScriptLoader
|
||||
@@ -835,13 +824,9 @@ class spell_gen_parachute_ic : public SpellScriptLoader
|
||||
|
||||
void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
|
||||
if (!target->ToPlayer())
|
||||
return;
|
||||
|
||||
if (target->ToPlayer()->m_movementInfo.fallTime > 2000)
|
||||
target->CastSpell(target, SPELL_PARACHUTE_IC, true);
|
||||
if (Player* target = GetTarget()->ToPlayer())
|
||||
if (target->m_movementInfo.fallTime > 2000)
|
||||
target->CastSpell(target, SPELL_PARACHUTE_IC, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -868,7 +853,7 @@ class spell_gen_dungeon_credit : public SpellScriptLoader
|
||||
bool Load()
|
||||
{
|
||||
_handled = false;
|
||||
return true;
|
||||
return GetCaster()->GetTypeId() == TYPEID_UNIT;
|
||||
}
|
||||
|
||||
void CreditEncounter()
|
||||
@@ -878,9 +863,9 @@ class spell_gen_dungeon_credit : public SpellScriptLoader
|
||||
return;
|
||||
|
||||
_handled = true;
|
||||
if (GetCaster()->GetTypeId() == TYPEID_UNIT)
|
||||
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
|
||||
instance->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, GetSpellInfo()->Id, GetCaster());
|
||||
Unit* caster = GetCaster();
|
||||
if (InstanceScript* instance = caster->GetInstanceScript())
|
||||
instance->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, GetSpellInfo()->Id, caster);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -906,9 +891,14 @@ class spell_gen_profession_research : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_gen_profession_research_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
if (GetCaster()->GetTypeId() == TYPEID_PLAYER && HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer()))
|
||||
if (HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer()))
|
||||
{
|
||||
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_NOTHING_TO_DISCOVER);
|
||||
return SPELL_FAILED_CUSTOM_ERROR;
|
||||
@@ -978,19 +968,11 @@ class spell_generic_clone_weapon : public SpellScriptLoader
|
||||
class spell_generic_clone_weapon_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_generic_clone_weapon_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -999,57 +981,56 @@ class spell_generic_clone_weapon : public SpellScriptLoader
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetHitUnit();
|
||||
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
|
||||
target->CastSpell(caster, spellId, true);
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
switch (GetSpellInfo()->Id)
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
case SPELL_COPY_WEAPON:
|
||||
case SPELL_COPY_WEAPON_2:
|
||||
case SPELL_COPY_WEAPON_3:
|
||||
|
||||
uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
|
||||
target->CastSpell(caster, spellId, true);
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
switch (GetSpellInfo()->Id)
|
||||
{
|
||||
if (Player* player = caster->ToPlayer())
|
||||
case SPELL_COPY_WEAPON:
|
||||
case SPELL_COPY_WEAPON_2:
|
||||
case SPELL_COPY_WEAPON_3:
|
||||
{
|
||||
if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
|
||||
if (Player* player = caster->ToPlayer())
|
||||
{
|
||||
if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
|
||||
break;
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
|
||||
break;
|
||||
}
|
||||
case SPELL_COPY_OFFHAND:
|
||||
case SPELL_COPY_OFFHAND_2:
|
||||
{
|
||||
if (Player* player = caster->ToPlayer())
|
||||
case SPELL_COPY_OFFHAND:
|
||||
case SPELL_COPY_OFFHAND_2:
|
||||
{
|
||||
if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
|
||||
if (Player* player = caster->ToPlayer())
|
||||
{
|
||||
if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
|
||||
break;
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
|
||||
break;
|
||||
}
|
||||
case SPELL_COPY_RANGED:
|
||||
{
|
||||
if (Player* player = caster->ToPlayer())
|
||||
case SPELL_COPY_RANGED:
|
||||
{
|
||||
if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
|
||||
if (Player* player = caster->ToPlayer())
|
||||
{
|
||||
if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
|
||||
break;
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1095,10 +1076,10 @@ class spell_gen_seaforium_blast : public SpellScriptLoader
|
||||
void AchievementCredit(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
// but in effect handling OriginalCaster can become NULL
|
||||
if (!GetOriginalCaster() || !GetHitGObj() || GetHitGObj()->GetGOInfo()->type != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
|
||||
return;
|
||||
|
||||
GetOriginalCaster()->CastSpell(GetOriginalCaster(), SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT, true);
|
||||
if (Unit* originalCaster = GetOriginalCaster())
|
||||
if (GameObject* go = GetHitGObj())
|
||||
if (GetHitGObj()->GetGOInfo()->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
|
||||
originalCaster->CastSpell(originalCaster, SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -1131,10 +1112,11 @@ class spell_gen_turkey_marker : public SpellScriptLoader
|
||||
{
|
||||
// store stack apply times, so we can pop them while they expire
|
||||
_applyTimes.push_back(getMSTime());
|
||||
Unit* target = GetTarget();
|
||||
|
||||
// on stack 15 cast the achievement crediting spell
|
||||
if (GetStackAmount() >= 15)
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID());
|
||||
target->CastSpell(target, SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID());
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect const* /*aurEff*/)
|
||||
@@ -1208,29 +1190,28 @@ class spell_gen_magic_rooster : public SpellScriptLoader
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
Player* target = GetHitPlayer();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
// prevent client crashes from stacking mounts
|
||||
target->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
|
||||
uint32 spellId = SPELL_MAGIC_ROOSTER_NORMAL;
|
||||
switch (target->getRace())
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
case RACE_DRAENEI:
|
||||
if (target->getGender() == GENDER_MALE)
|
||||
spellId = SPELL_MAGIC_ROOSTER_DRAENEI_MALE;
|
||||
break;
|
||||
case RACE_TAUREN:
|
||||
if (target->getGender() == GENDER_MALE)
|
||||
spellId = SPELL_MAGIC_ROOSTER_TAUREN_MALE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// prevent client crashes from stacking mounts
|
||||
target->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
|
||||
target->CastSpell(target, spellId, true);
|
||||
uint32 spellId = SPELL_MAGIC_ROOSTER_NORMAL;
|
||||
switch (target->getRace())
|
||||
{
|
||||
case RACE_DRAENEI:
|
||||
if (target->getGender() == GENDER_MALE)
|
||||
spellId = SPELL_MAGIC_ROOSTER_DRAENEI_MALE;
|
||||
break;
|
||||
case RACE_TAUREN:
|
||||
if (target->getGender() == GENDER_MALE)
|
||||
spellId = SPELL_MAGIC_ROOSTER_TAUREN_MALE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
target->CastSpell(target, spellId, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -1258,7 +1239,6 @@ public:
|
||||
{
|
||||
if (!GetCastItem())
|
||||
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
@@ -1335,12 +1315,14 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader
|
||||
{
|
||||
PrepareAuraScript(spell_gen_vehicle_scaling_AuraScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster || !caster->ToPlayer())
|
||||
return;
|
||||
|
||||
float factor;
|
||||
uint16 baseItemLevel;
|
||||
|
||||
@@ -1379,21 +1361,23 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader
|
||||
};
|
||||
|
||||
|
||||
class spell_gen_oracle_wolvar_reputation: public SpellScriptLoader
|
||||
class spell_gen_oracle_wolvar_reputation : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_oracle_wolvar_reputation() : SpellScriptLoader("spell_gen_oracle_wolvar_reputation") { }
|
||||
public:
|
||||
spell_gen_oracle_wolvar_reputation() : SpellScriptLoader("spell_gen_oracle_wolvar_reputation") { }
|
||||
|
||||
class spell_gen_oracle_wolvar_reputation_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript)
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
class spell_gen_oracle_wolvar_reputation_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript);
|
||||
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
Player* player = GetCaster()->ToPlayer();
|
||||
uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue();
|
||||
int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
|
||||
|
||||
@@ -1410,18 +1394,16 @@ public:
|
||||
// EFFECT_INDEX_2 most likely update at war state, we already handle this in SetReputation
|
||||
}
|
||||
|
||||
}
|
||||
void Register()
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_oracle_wolvar_reputation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
void Register()
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_oracle_wolvar_reputation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
return new spell_gen_oracle_wolvar_reputation_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_oracle_wolvar_reputation_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum DamageReductionAura
|
||||
@@ -1435,53 +1417,48 @@ enum DamageReductionAura
|
||||
|
||||
class spell_gen_damage_reduction_aura : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_damage_reduction_aura() : SpellScriptLoader("spell_gen_damage_reduction_aura") { }
|
||||
public:
|
||||
spell_gen_damage_reduction_aura() : SpellScriptLoader("spell_gen_damage_reduction_aura") { }
|
||||
|
||||
class spell_gen_damage_reduction_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_damage_reduction_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
class spell_gen_damage_reduction_AuraScript : public AuraScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DAMAGE_REDUCTION_AURA))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareAuraScript(spell_gen_damage_reduction_AuraScript);
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DAMAGE_REDUCTION_AURA))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (target->HasAura(SPELL_DAMAGE_REDUCTION_AURA) && !(target->HasAura(SPELL_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_RENEWED_HOPE) ||
|
||||
target->HasAura(SPELL_VIGILANCE)))
|
||||
target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_gen_damage_reduction_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_gen_damage_reduction_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true);
|
||||
return new spell_gen_damage_reduction_AuraScript();
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (!target->HasAura(SPELL_DAMAGE_REDUCTION_AURA))
|
||||
return;
|
||||
|
||||
if (target->HasAura(SPELL_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_RENEWED_HOPE) ||
|
||||
target->HasAura(SPELL_VIGILANCE))
|
||||
return;
|
||||
|
||||
target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_gen_damage_reduction_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_gen_damage_reduction_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_gen_damage_reduction_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_luck_of_the_draw : public SpellScriptLoader
|
||||
@@ -1493,6 +1470,11 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader
|
||||
{
|
||||
PrepareAuraScript(spell_gen_luck_of_the_draw_AuraScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
// cheap hax to make it have update calls
|
||||
void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude)
|
||||
{
|
||||
@@ -1502,30 +1484,30 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader
|
||||
|
||||
void Update(AuraEffect* /*effect*/)
|
||||
{
|
||||
if (GetUnitOwner()->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
const LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(GetUnitOwner()->GetGUID());
|
||||
LfgDungeonSet::const_iterator itr = dungeons.begin();
|
||||
|
||||
if (itr == dungeons.end())
|
||||
if (Player* owner = GetUnitOwner()->ToPlayer())
|
||||
{
|
||||
const LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(owner->GetGUID());
|
||||
LfgDungeonSet::const_iterator itr = dungeons.begin();
|
||||
|
||||
if (itr == dungeons.end())
|
||||
{
|
||||
Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*itr);
|
||||
if (Group* group = owner->GetGroup())
|
||||
if (Map const* map = owner->GetMap())
|
||||
if (group->isLFGGroup())
|
||||
if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
|
||||
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
|
||||
if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty())
|
||||
if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM)
|
||||
return; // in correct dungeon
|
||||
|
||||
Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*itr);
|
||||
Group* group = GetUnitOwner()->ToPlayer()->GetGroup();
|
||||
Map const* map = GetUnitOwner()->GetMap();
|
||||
if (group && group->isLFGGroup())
|
||||
if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
|
||||
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
|
||||
if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty())
|
||||
if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM)
|
||||
return; // in correct dungeon
|
||||
|
||||
Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -1541,6 +1523,178 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
enum DummyTrigger
|
||||
{
|
||||
SPELL_PERSISTANT_SHIELD_TRIGGERED = 26470,
|
||||
SPELL_PERSISTANT_SHIELD = 26467,
|
||||
};
|
||||
|
||||
class spell_gen_dummy_trigger : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_dummy_trigger() : SpellScriptLoader("spell_gen_dummy_trigger") { }
|
||||
|
||||
class spell_gen_dummy_trigger_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_dummy_trigger_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PERSISTANT_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_PERSISTANT_SHIELD))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (SpellInfo const* triggeredByAuraSpell = GetTriggeringSpell())
|
||||
if (triggeredByAuraSpell->Id == SPELL_PERSISTANT_SHIELD_TRIGGERED)
|
||||
caster->CastCustomSpell(target, SPELL_PERSISTANT_SHIELD_TRIGGERED, &damage, NULL, NULL, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_dummy_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_dummy_trigger_SpellScript();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class spell_gen_spirit_healer_res : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_spirit_healer_res(): SpellScriptLoader("spell_gen_spirit_healer_res") { }
|
||||
|
||||
class spell_gen_spirit_healer_res_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_spirit_healer_res_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
if (Player* originalCaster = GetOriginalCaster()->ToPlayer())
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8);
|
||||
data << uint64(target->GetGUID());
|
||||
originalCaster->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_spirit_healer_res_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_spirit_healer_res_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum TransporterBackfires
|
||||
{
|
||||
SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH = 23444,
|
||||
SPELL_TRANSPORTER_EVIL_TWIN = 23445,
|
||||
SPELL_TRANSPORTER_MALFUNCTION_MISS = 36902,
|
||||
};
|
||||
|
||||
class spell_gen_gadgetzan_transporter_backfire : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_gadgetzan_transporter_backfire() : SpellScriptLoader("spell_gen_gadgetzan_transporter_backfire") { }
|
||||
|
||||
class spell_gen_gadgetzan_transporter_backfire_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_gadgetzan_transporter_backfire_SpellScript)
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH) || !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_EVIL_TWIN)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_MISS))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
int32 r = irand(0, 119);
|
||||
if (r < 20) // Transporter Malfunction - 1/6 polymorph
|
||||
caster->CastSpell(caster, SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH, true);
|
||||
else if (r < 100) // Evil Twin - 4/6 evil twin
|
||||
caster->CastSpell(caster, SPELL_TRANSPORTER_EVIL_TWIN, true);
|
||||
else // Transporter Malfunction - 1/6 miss the target
|
||||
caster->CastSpell(caster, SPELL_TRANSPORTER_MALFUNCTION_MISS, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_gadgetzan_transporter_backfire_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_gadgetzan_transporter_backfire_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum GnomishTransporter
|
||||
{
|
||||
SPELL_TRANSPORTER_SUCCESS = 23441,
|
||||
SPELL_TRANSPORTER_FAILURE = 23446,
|
||||
};
|
||||
|
||||
class spell_gen_gnomish_transporter : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_gnomish_transporter() : SpellScriptLoader("spell_gen_gnomish_transporter") { }
|
||||
|
||||
class spell_gen_gnomish_transporter_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_gnomish_transporter_SpellScript)
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_SUCCESS) || !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_FAILURE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastSpell(caster, roll_chance_i(50) ? SPELL_TRANSPORTER_SUCCESS : SPELL_TRANSPORTER_FAILURE , true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_gnomish_transporter_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_gnomish_transporter_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum DalaranDisguiseSpells
|
||||
{
|
||||
SPELL_SUNREAVER_DISGUISE_TRIGGER = 69672,
|
||||
@@ -1565,15 +1719,11 @@ class spell_gen_dalaran_disguise : public SpellScriptLoader
|
||||
switch (spellEntry->Id)
|
||||
{
|
||||
case SPELL_SUNREAVER_DISGUISE_TRIGGER:
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE))
|
||||
return false;
|
||||
break;
|
||||
case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER:
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -1599,7 +1749,6 @@ class spell_gen_dalaran_disguise : public SpellScriptLoader
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GetCaster()->CastSpell(player, spellId, true);
|
||||
}
|
||||
}
|
||||
@@ -2354,6 +2503,47 @@ class spell_gen_tournament_pennant : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
enum ChaosBlast
|
||||
{
|
||||
SPELL_CHAOS_BLAST = 37675,
|
||||
};
|
||||
|
||||
class spell_gen_chaos_blast : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_chaos_blast() : SpellScriptLoader("spell_gen_chaos_blast") { }
|
||||
|
||||
class spell_gen_chaos_blast_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_chaos_blast_SpellScript)
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_CHAOS_BLAST))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 basepoints0 = 100;
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
caster->CastCustomSpell(target, SPELL_CHAOS_BLAST, &basepoints0, NULL, NULL, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_chaos_blast_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_chaos_blast_SpellScript();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
new spell_gen_absorb0_hitlimit1();
|
||||
@@ -2387,6 +2577,10 @@ void AddSC_generic_spell_scripts()
|
||||
new spell_gen_oracle_wolvar_reputation();
|
||||
new spell_gen_damage_reduction_aura();
|
||||
new spell_gen_luck_of_the_draw();
|
||||
new spell_gen_dummy_trigger();
|
||||
new spell_gen_spirit_healer_res();
|
||||
new spell_gen_gadgetzan_transporter_backfire();
|
||||
new spell_gen_gnomish_transporter();
|
||||
new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise");
|
||||
new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise");
|
||||
new spell_gen_elune_candle();
|
||||
@@ -2398,4 +2592,5 @@ void AddSC_generic_spell_scripts()
|
||||
new spell_gen_summon_tournament_mount();
|
||||
new spell_gen_on_tournament_mount();
|
||||
new spell_gen_tournament_pennant();
|
||||
new spell_gen_chaos_blast();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_hun_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "GridNotifiers.h"
|
||||
|
||||
@@ -45,219 +44,215 @@ enum HunterSpells
|
||||
// 13161 Aspect of the Beast
|
||||
class spell_hun_aspect_of_the_beast : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_hun_aspect_of_the_beast() : SpellScriptLoader("spell_hun_aspect_of_the_beast") { }
|
||||
public:
|
||||
spell_hun_aspect_of_the_beast() : SpellScriptLoader("spell_hun_aspect_of_the_beast") { }
|
||||
|
||||
class spell_hun_aspect_of_the_beast_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_hun_aspect_of_the_beast_AuraScript)
|
||||
bool Validate(SpellInfo const* /*entry*/)
|
||||
class spell_hun_aspect_of_the_beast_AuraScript : public AuraScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareAuraScript(spell_hun_aspect_of_the_beast_AuraScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*entry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Player* caster = GetCaster()->ToPlayer())
|
||||
if (Pet* pet = caster->GetPet())
|
||||
pet->RemoveAurasDueToSpell(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Player* caster = GetCaster()->ToPlayer())
|
||||
if (caster->GetPet())
|
||||
caster->CastSpell(caster, HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_aspect_of_the_beast_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
if (!GetCaster())
|
||||
return;
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->ToPlayer())
|
||||
if (Pet* pet = caster->ToPlayer()->GetPet())
|
||||
pet->RemoveAurasDueToSpell(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET);
|
||||
return new spell_hun_aspect_of_the_beast_AuraScript();
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (!GetCaster())
|
||||
return;
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->ToPlayer())
|
||||
if (caster->ToPlayer()->GetPet())
|
||||
caster->CastSpell(caster, HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_aspect_of_the_beast_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_hun_aspect_of_the_beast_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 53209 Chimera Shot
|
||||
class spell_hun_chimera_shot : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_hun_chimera_shot() : SpellScriptLoader("spell_hun_chimera_shot") { }
|
||||
public:
|
||||
spell_hun_chimera_shot() : SpellScriptLoader("spell_hun_chimera_shot") { }
|
||||
|
||||
class spell_hun_chimera_shot_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_hun_chimera_shot_SpellScript)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
class spell_hun_chimera_shot_SpellScript : public SpellScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SERPENT))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_VIPER))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SCORPID))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareSpellScript(spell_hun_chimera_shot_SpellScript);
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* unitTarget = GetHitUnit();
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
uint32 spellId = 0;
|
||||
int32 basePoint = 0;
|
||||
Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
|
||||
for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
Aura* aura = i->second->GetBase();
|
||||
if (aura->GetCasterGUID() != caster->GetGUID())
|
||||
continue;
|
||||
|
||||
// Search only Serpent Sting, Viper Sting, Scorpid Sting auras
|
||||
flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags;
|
||||
if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
|
||||
continue;
|
||||
if (AuraEffect const* aurEff = aura->GetEffect(0))
|
||||
{
|
||||
// Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
|
||||
if (familyFlag[0] & 0x4000)
|
||||
{
|
||||
int32 TickCount = aurEff->GetTotalTicks();
|
||||
spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT;
|
||||
basePoint = caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
|
||||
ApplyPctN(basePoint, TickCount * 40);
|
||||
}
|
||||
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
|
||||
else if (familyFlag[1] & 0x00000080)
|
||||
{
|
||||
int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
|
||||
spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER;
|
||||
|
||||
// Amount of one aura tick
|
||||
basePoint = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
|
||||
int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; // TODO: WTF? caster uses unitTarget?
|
||||
if (basePoint > casterBasePoint)
|
||||
basePoint = casterBasePoint;
|
||||
ApplyPctN(basePoint, TickCount * 60);
|
||||
}
|
||||
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
|
||||
else if (familyFlag[0] & 0x00008000)
|
||||
spellId = HUNTER_SPELL_CHIMERA_SHOT_SCORPID;
|
||||
// ?? nothing say in spell desc (possibly need addition check)
|
||||
//if (familyFlag & 0x0000010000000000LL || // dot
|
||||
// familyFlag & 0x0000100000000000LL) // stun
|
||||
//{
|
||||
// spellId = 53366; // 53366 Chimera Shot - Wyvern
|
||||
//}
|
||||
|
||||
// Refresh aura duration
|
||||
aura->RefreshDuration();
|
||||
}
|
||||
break;
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SERPENT) || !sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_VIPER) || !sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SCORPID))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if (spellId)
|
||||
caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true);
|
||||
if (spellId == HUNTER_SPELL_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
|
||||
caster->ToPlayer()->AddSpellCooldown(spellId, 0, uint32(time(NULL) + 60));
|
||||
}
|
||||
|
||||
void Register()
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
uint32 spellId = 0;
|
||||
int32 basePoint = 0;
|
||||
Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
|
||||
for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
|
||||
{
|
||||
Aura* aura = i->second->GetBase();
|
||||
if (aura->GetCasterGUID() != caster->GetGUID())
|
||||
continue;
|
||||
|
||||
// Search only Serpent Sting, Viper Sting, Scorpid Sting auras
|
||||
flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags;
|
||||
if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
|
||||
continue;
|
||||
if (AuraEffect const* aurEff = aura->GetEffect(0))
|
||||
{
|
||||
// Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
|
||||
if (familyFlag[0] & 0x4000)
|
||||
{
|
||||
int32 TickCount = aurEff->GetTotalTicks();
|
||||
spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT;
|
||||
basePoint = caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
|
||||
ApplyPctN(basePoint, TickCount * 40);
|
||||
}
|
||||
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
|
||||
else if (familyFlag[1] & 0x00000080)
|
||||
{
|
||||
int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
|
||||
spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER;
|
||||
|
||||
// Amount of one aura tick
|
||||
basePoint = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
|
||||
int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; // TODO: WTF? caster uses unitTarget?
|
||||
if (basePoint > casterBasePoint)
|
||||
basePoint = casterBasePoint;
|
||||
ApplyPctN(basePoint, TickCount * 60);
|
||||
}
|
||||
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
|
||||
else if (familyFlag[0] & 0x00008000)
|
||||
spellId = HUNTER_SPELL_CHIMERA_SHOT_SCORPID;
|
||||
// ?? nothing say in spell desc (possibly need addition check)
|
||||
//if (familyFlag & 0x0000010000000000LL || // dot
|
||||
// familyFlag & 0x0000100000000000LL) // stun
|
||||
//{
|
||||
// spellId = 53366; // 53366 Chimera Shot - Wyvern
|
||||
//}
|
||||
|
||||
// Refresh aura duration
|
||||
aura->RefreshDuration();
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (spellId)
|
||||
caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true);
|
||||
if (spellId == HUNTER_SPELL_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
|
||||
caster->ToPlayer()->AddSpellCooldown(spellId, 0, uint32(time(NULL) + 60));
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_chimera_shot_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_chimera_shot_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
return new spell_hun_chimera_shot_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_hun_chimera_shot_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 53412 Invigoration
|
||||
class spell_hun_invigoration : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_hun_invigoration() : SpellScriptLoader("spell_hun_invigoration") { }
|
||||
public:
|
||||
spell_hun_invigoration() : SpellScriptLoader("spell_hun_invigoration") { }
|
||||
|
||||
class spell_hun_invigoration_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_hun_invigoration_SpellScript)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
class spell_hun_invigoration_SpellScript : public SpellScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_INVIGORATION_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareSpellScript(spell_hun_invigoration_SpellScript);
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_INVIGORATION_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
if (AuraEffect* aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 3487, 0))
|
||||
if (roll_chance_i(aurEff->GetAmount()))
|
||||
unitTarget->CastSpell(unitTarget, HUNTER_SPELL_INVIGORATION_TRIGGERED, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_invigoration_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
if (AuraEffect* aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 3487, 0))
|
||||
if (roll_chance_i(aurEff->GetAmount()))
|
||||
unitTarget->CastSpell(unitTarget, HUNTER_SPELL_INVIGORATION_TRIGGERED, true);
|
||||
return new spell_hun_invigoration_SpellScript();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_invigoration_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_hun_invigoration_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_hun_last_stand_pet : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_hun_last_stand_pet() : SpellScriptLoader("spell_hun_last_stand_pet") { }
|
||||
public:
|
||||
spell_hun_last_stand_pet() : SpellScriptLoader("spell_hun_last_stand_pet") { }
|
||||
|
||||
class spell_hun_last_stand_pet_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_hun_last_stand_pet_SpellScript)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
class spell_hun_last_stand_pet_SpellScript : public SpellScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareSpellScript(spell_hun_last_stand_pet_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30));
|
||||
caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to pet's Last Stand
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30));
|
||||
caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
|
||||
return new spell_hun_last_stand_pet_SpellScript();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to pet's Last Stand
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_hun_last_stand_pet_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_hun_masters_call : public SpellScriptLoader
|
||||
@@ -267,14 +262,11 @@ class spell_hun_masters_call : public SpellScriptLoader
|
||||
|
||||
class spell_hun_masters_call_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_hun_masters_call_SpellScript)
|
||||
PrepareSpellScript(spell_hun_masters_call_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* spellEntry)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_MASTERS_CALL_TRIGGERED))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_0].CalcValue()))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_1].CalcValue()))
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_MASTERS_CALL_TRIGGERED) || !sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_0].CalcValue()) || !sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_1].CalcValue()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -312,80 +304,86 @@ class spell_hun_masters_call : public SpellScriptLoader
|
||||
|
||||
class spell_hun_readiness : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_hun_readiness() : SpellScriptLoader("spell_hun_readiness") { }
|
||||
public:
|
||||
spell_hun_readiness() : SpellScriptLoader("spell_hun_readiness") { }
|
||||
|
||||
class spell_hun_readiness_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_hun_readiness_SpellScript)
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
class spell_hun_readiness_SpellScript : public SpellScript
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
PrepareSpellScript(spell_hun_readiness_SpellScript);
|
||||
|
||||
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
|
||||
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
|
||||
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
|
||||
bool Load()
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
|
||||
///! If spellId in cooldown map isn't valid, the above will return a null pointer.
|
||||
if (spellInfo &&
|
||||
spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
|
||||
spellInfo->Id != HUNTER_SPELL_READINESS &&
|
||||
spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH &&
|
||||
spellInfo->GetRecoveryTime() > 0)
|
||||
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
|
||||
else
|
||||
++itr;
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
|
||||
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
|
||||
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
|
||||
///! If spellId in cooldown map isn't valid, the above will return a null pointer.
|
||||
if (spellInfo &&
|
||||
spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
|
||||
spellInfo->Id != HUNTER_SPELL_READINESS &&
|
||||
spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH &&
|
||||
spellInfo->GetRecoveryTime() > 0)
|
||||
caster->RemoveSpellCooldown((itr++)->first, true);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to Readiness
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
// add dummy effect spell handler to Readiness
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
return new spell_hun_readiness_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_hun_readiness_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 37506 Scatter Shot
|
||||
class spell_hun_scatter_shot : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_hun_scatter_shot() : SpellScriptLoader("spell_hun_scatter_shot") { }
|
||||
public:
|
||||
spell_hun_scatter_shot() : SpellScriptLoader("spell_hun_scatter_shot") { }
|
||||
|
||||
class spell_hun_scatter_shot_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_hun_scatter_shot_SpellScript)
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
class spell_hun_scatter_shot_SpellScript : public SpellScript
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
PrepareSpellScript(spell_hun_scatter_shot_SpellScript);
|
||||
|
||||
// break Auto Shot and autohit
|
||||
caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
|
||||
caster->AttackStop();
|
||||
caster->ToPlayer()->SendAttackSwingCancelAttack();
|
||||
}
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void Register()
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
// break Auto Shot and autohit
|
||||
caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
|
||||
caster->AttackStop();
|
||||
caster->SendAttackSwingCancelAttack();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_scatter_shot_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_scatter_shot_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
return new spell_hun_scatter_shot_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_hun_scatter_shot_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 53302, 53303, 53304 Sniper Training
|
||||
@@ -397,169 +395,164 @@ enum eSniperTrainingSpells
|
||||
|
||||
class spell_hun_sniper_training : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_hun_sniper_training() : SpellScriptLoader("spell_hun_sniper_training") { }
|
||||
public:
|
||||
spell_hun_sniper_training() : SpellScriptLoader("spell_hun_sniper_training") { }
|
||||
|
||||
class spell_hun_sniper_training_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_hun_sniper_training_AuraScript)
|
||||
bool Validate(SpellInfo const* /*entry*/)
|
||||
class spell_hun_sniper_training_AuraScript : public AuraScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_R1))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_BUFF_R1))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareAuraScript(spell_hun_sniper_training_AuraScript);
|
||||
|
||||
void HandlePeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (aurEff->GetAmount() > 0)
|
||||
return;
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
uint32 spellId = SPELL_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_SNIPER_TRAINING_R1;
|
||||
Unit* target = GetTarget();
|
||||
if (!target->HasAura(spellId))
|
||||
bool Validate(SpellInfo const* /*entry*/)
|
||||
{
|
||||
SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target;
|
||||
triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff);
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_R1) || !sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_BUFF_R1))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleUpdatePeriodic(AuraEffect* aurEff)
|
||||
{
|
||||
Unit* target = GetUnitOwner();
|
||||
if (Player* playerTarget = target->ToPlayer())
|
||||
void HandlePeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
int32 baseAmount = aurEff->GetBaseAmount();
|
||||
int32 amount = playerTarget->isMoving() ?
|
||||
target->CalculateSpellDamage(target, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) :
|
||||
aurEff->GetAmount() - 1;
|
||||
aurEff->SetAmount(amount);
|
||||
PreventDefaultAction();
|
||||
if (aurEff->GetAmount() <= 0)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
uint32 spellId = SPELL_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_SNIPER_TRAINING_R1;
|
||||
if (Unit* target = GetTarget())
|
||||
if (!target->HasAura(spellId))
|
||||
{
|
||||
SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target;
|
||||
triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
void HandleUpdatePeriodic(AuraEffect* aurEff)
|
||||
{
|
||||
if (Player* playerTarget = GetUnitOwner()->ToPlayer())
|
||||
{
|
||||
int32 baseAmount = aurEff->GetBaseAmount();
|
||||
int32 amount = playerTarget->isMoving() ?
|
||||
playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) :
|
||||
aurEff->GetAmount() - 1;
|
||||
aurEff->SetAmount(amount);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hun_sniper_training_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hun_sniper_training_AuraScript::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hun_sniper_training_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hun_sniper_training_AuraScript::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||
return new spell_hun_sniper_training_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_hun_sniper_training_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_hun_pet_heart_of_the_phoenix() : SpellScriptLoader("spell_hun_pet_heart_of_the_phoenix") { }
|
||||
public:
|
||||
spell_hun_pet_heart_of_the_phoenix() : SpellScriptLoader("spell_hun_pet_heart_of_the_phoenix") { }
|
||||
|
||||
class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_hun_pet_heart_of_the_phoenix_SpellScript)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareSpellScript(spell_hun_pet_heart_of_the_phoenix_SpellScript);
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
bool Load()
|
||||
{
|
||||
if (!GetCaster()->isPet())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED) || !sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* owner = caster->GetOwner())
|
||||
if (!caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
|
||||
{
|
||||
owner->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true);
|
||||
caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to pet's Last Stand
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* owner = caster->GetOwner();
|
||||
if (!owner || caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
|
||||
return;
|
||||
owner->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true);
|
||||
caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true);
|
||||
return new spell_hun_pet_heart_of_the_phoenix_SpellScript();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to pet's Last Stand
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
if (!GetCaster()->isPet())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_hun_pet_heart_of_the_phoenix_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_hun_pet_carrion_feeder : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_hun_pet_carrion_feeder() : SpellScriptLoader("spell_hun_pet_carrion_feeder") { }
|
||||
public:
|
||||
spell_hun_pet_carrion_feeder() : SpellScriptLoader("spell_hun_pet_carrion_feeder") { }
|
||||
|
||||
class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
if (!GetCaster()->isPet())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
SpellCastResult CheckIfCorpseNear()
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
SpellCastResult CheckIfCorpseNear()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
float max_range = GetSpellInfo()->GetMaxRange(false);
|
||||
WorldObject* result = NULL;
|
||||
// search for nearby enemy corpse in range
|
||||
Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_SELECT_CHECK_ENEMY);
|
||||
Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check);
|
||||
caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher);
|
||||
if (!result)
|
||||
return SPELL_FAILED_NO_EDIBLE_CORPSES;
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to pet's Last Stand
|
||||
OnEffectHit += SpellEffectFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnCheckCast += SpellCheckCastFn(spell_hun_pet_carrion_feeder_SpellScript::CheckIfCorpseNear);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
float max_range = GetSpellInfo()->GetMaxRange(false);
|
||||
WorldObject* result = NULL;
|
||||
// search for nearby enemy corpse in range
|
||||
Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_SELECT_CHECK_ENEMY);
|
||||
Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check);
|
||||
caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher);
|
||||
if (!result)
|
||||
return SPELL_FAILED_NO_EDIBLE_CORPSES;
|
||||
return SPELL_CAST_OK;
|
||||
return new spell_hun_pet_carrion_feeder_SpellScript();
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to pet's Last Stand
|
||||
OnEffectHit += SpellEffectFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnCheckCast += SpellCheckCastFn(spell_hun_pet_carrion_feeder_SpellScript::CheckIfCorpseNear);
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
if (!GetCaster()->isPet())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_hun_pet_carrion_feeder_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_hunter_spell_scripts()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_mage_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
|
||||
enum MageSpells
|
||||
{
|
||||
@@ -45,7 +44,8 @@ class spell_mage_blast_wave : public SpellScriptLoader
|
||||
|
||||
class spell_mage_blast_wave_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_mage_blast_wave_SpellScript)
|
||||
PrepareSpellScript(spell_mage_blast_wave_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_GLYPH_OF_BLAST_WAVE))
|
||||
@@ -78,16 +78,19 @@ class spell_mage_cold_snap : public SpellScriptLoader
|
||||
|
||||
class spell_mage_cold_snap_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_mage_cold_snap_SpellScript)
|
||||
PrepareSpellScript(spell_mage_cold_snap_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
// immediately finishes the cooldown on Frost spells
|
||||
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
|
||||
const SpellCooldowns& cm = caster->GetSpellCooldownMap();
|
||||
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
@@ -96,7 +99,7 @@ class spell_mage_cold_snap : public SpellScriptLoader
|
||||
(spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) &&
|
||||
spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0)
|
||||
{
|
||||
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
|
||||
caster->RemoveSpellCooldown((itr++)->first, true);
|
||||
}
|
||||
else
|
||||
++itr;
|
||||
@@ -123,7 +126,8 @@ class spell_mage_polymorph_cast_visual : public SpellScriptLoader
|
||||
|
||||
class spell_mage_polymorph_cast_visual_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_mage_polymorph_cast_visual_SpellScript)
|
||||
PrepareSpellScript(spell_mage_polymorph_cast_visual_SpellScript);
|
||||
|
||||
static const uint32 spell_list[6];
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
@@ -172,14 +176,11 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
|
||||
|
||||
class spell_mage_summon_water_elemental_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_mage_summon_water_elemental_SpellScript)
|
||||
PrepareSpellScript(spell_mage_summon_water_elemental_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER) || !sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY) || !sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -210,78 +211,79 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
|
||||
// Frost Warding
|
||||
class spell_mage_frost_warding_trigger : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_mage_frost_warding_trigger() : SpellScriptLoader("spell_mage_frost_warding_trigger") { }
|
||||
public:
|
||||
spell_mage_frost_warding_trigger() : SpellScriptLoader("spell_mage_frost_warding_trigger") { }
|
||||
|
||||
class spell_mage_frost_warding_trigger_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_mage_frost_warding_trigger_AuraScript);
|
||||
|
||||
enum Spells
|
||||
class spell_mage_frost_warding_trigger_AuraScript : public AuraScript
|
||||
{
|
||||
SPELL_MAGE_FROST_WARDING_TRIGGERED = 57776,
|
||||
SPELL_MAGE_FROST_WARDING_R1 = 28332,
|
||||
};
|
||||
PrepareAuraScript(spell_mage_frost_warding_trigger_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
return sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_TRIGGERED)
|
||||
&& sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_R1);
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0))
|
||||
enum Spells
|
||||
{
|
||||
int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
|
||||
SPELL_MAGE_FROST_WARDING_TRIGGERED = 57776,
|
||||
SPELL_MAGE_FROST_WARDING_R1 = 28332,
|
||||
};
|
||||
|
||||
if (roll_chance_i(chance))
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_R1))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0))
|
||||
{
|
||||
absorbAmount = dmgInfo.GetDamage();
|
||||
int32 bp = absorbAmount;
|
||||
target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
|
||||
|
||||
if (roll_chance_i(chance))
|
||||
{
|
||||
absorbAmount = dmgInfo.GetDamage();
|
||||
int32 bp = absorbAmount;
|
||||
target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
void Register()
|
||||
{
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_mage_frost_warding_trigger_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_mage_frost_warding_trigger_AuraScript::Absorb, EFFECT_0);
|
||||
return new spell_mage_frost_warding_trigger_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_mage_frost_warding_trigger_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript
|
||||
{
|
||||
public:
|
||||
enum Spells
|
||||
{
|
||||
SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED = 44413,
|
||||
SPELL_MAGE_INCANTERS_ABSORBTION_R1 = 44394,
|
||||
};
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
return sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED)
|
||||
&& sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_R1);
|
||||
}
|
||||
|
||||
void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
|
||||
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
|
||||
public:
|
||||
enum Spells
|
||||
{
|
||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
||||
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED = 44413,
|
||||
SPELL_MAGE_INCANTERS_ABSORBTION_R1 = 44394,
|
||||
};
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
return sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED)
|
||||
&& sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_R1);
|
||||
}
|
||||
|
||||
void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
|
||||
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
|
||||
{
|
||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
||||
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Incanter's Absorption
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_pal_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "Unit.h"
|
||||
|
||||
|
||||
enum PaladinSpells
|
||||
{
|
||||
@@ -46,323 +47,369 @@ enum PaladinSpells
|
||||
// 31850 - Ardent Defender
|
||||
class spell_pal_ardent_defender : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { }
|
||||
public:
|
||||
spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { }
|
||||
|
||||
class spell_pal_ardent_defender_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pal_ardent_defender_AuraScript);
|
||||
|
||||
uint32 absorbPct, healPct;
|
||||
|
||||
enum Spell
|
||||
class spell_pal_ardent_defender_AuraScript : public AuraScript
|
||||
{
|
||||
PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235,
|
||||
PrepareAuraScript(spell_pal_ardent_defender_AuraScript);
|
||||
|
||||
uint32 absorbPct, healPct;
|
||||
|
||||
enum Spell
|
||||
{
|
||||
PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235,
|
||||
};
|
||||
|
||||
bool Load()
|
||||
{
|
||||
healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
|
||||
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
|
||||
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
{
|
||||
// Set absorbtion amount to unlimited
|
||||
amount = -1;
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Unit* victim = GetTarget();
|
||||
int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage();
|
||||
uint32 allowedHealth = victim->CountPctFromMaxHealth(35);
|
||||
// If damage kills us
|
||||
if (remainingHealth <= 0 && !victim->ToPlayer()->HasSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL))
|
||||
{
|
||||
// Cast healing spell, completely avoid damage
|
||||
absorbAmount = dmgInfo.GetDamage();
|
||||
|
||||
uint32 defenseSkillValue = victim->GetDefenseSkillValue();
|
||||
// Max heal when defense skill denies critical hits from raid bosses
|
||||
// Formula: max defense at level + 140 (raiting from gear)
|
||||
uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140;
|
||||
float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
|
||||
? 1.0f
|
||||
: float(defenseSkillValue) / float(reqDefForMaxHeal);
|
||||
|
||||
int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense)));
|
||||
victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff);
|
||||
victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, time(NULL) + 120);
|
||||
}
|
||||
else if (remainingHealth < int32(allowedHealth))
|
||||
{
|
||||
// Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x%
|
||||
uint32 damageToReduce = (victim->GetHealth() < allowedHealth)
|
||||
? dmgInfo.GetDamage()
|
||||
: allowedHealth - remainingHealth;
|
||||
absorbAmount = CalculatePctN(damageToReduce, absorbPct);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_ardent_defender_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_pal_ardent_defender_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
bool Load()
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
|
||||
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
|
||||
return GetUnitOwner()->ToPlayer();
|
||||
return new spell_pal_ardent_defender_AuraScript();
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
{
|
||||
// Set absorbtion amount to unlimited
|
||||
amount = -1;
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Unit* victim = GetTarget();
|
||||
int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage();
|
||||
uint32 allowedHealth = victim->CountPctFromMaxHealth(35);
|
||||
// If damage kills us
|
||||
if (remainingHealth <= 0 && !victim->ToPlayer()->HasSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL))
|
||||
{
|
||||
// Cast healing spell, completely avoid damage
|
||||
absorbAmount = dmgInfo.GetDamage();
|
||||
|
||||
uint32 defenseSkillValue = victim->GetDefenseSkillValue();
|
||||
// Max heal when defense skill denies critical hits from raid bosses
|
||||
// Formula: max defense at level + 140 (raiting from gear)
|
||||
uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140;
|
||||
float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
|
||||
? 1.0f
|
||||
: float(defenseSkillValue) / float(reqDefForMaxHeal);
|
||||
|
||||
int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense)));
|
||||
victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff);
|
||||
victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, time(NULL) + 120);
|
||||
}
|
||||
else if (remainingHealth < int32(allowedHealth))
|
||||
{
|
||||
// Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x%
|
||||
uint32 damageToReduce = (victim->GetHealth() < allowedHealth)
|
||||
? dmgInfo.GetDamage()
|
||||
: allowedHealth - remainingHealth;
|
||||
absorbAmount = CalculatePctN(damageToReduce, absorbPct);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_ardent_defender_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_pal_ardent_defender_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_pal_ardent_defender_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_pal_blessing_of_faith : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pal_blessing_of_faith() : SpellScriptLoader("spell_pal_blessing_of_faith") { }
|
||||
public:
|
||||
spell_pal_blessing_of_faith() : SpellScriptLoader("spell_pal_blessing_of_faith") { }
|
||||
|
||||
class spell_pal_blessing_of_faith_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pal_blessing_of_faith_SpellScript)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
class spell_pal_blessing_of_faith_SpellScript : public SpellScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_DRUID))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PALADIN))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PRIEST))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareSpellScript(spell_pal_blessing_of_faith_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
uint32 spell_id = 0;
|
||||
switch (unitTarget->getClass())
|
||||
{
|
||||
case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break;
|
||||
case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break;
|
||||
case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break;
|
||||
case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break;
|
||||
default: return; // ignore for non-healing classes
|
||||
}
|
||||
|
||||
GetCaster()->CastSpell(GetCaster(), spell_id, true);
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_DRUID) || !sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PALADIN) || !sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PRIEST) || !sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
uint32 spell_id = 0;
|
||||
switch (unitTarget->getClass())
|
||||
{
|
||||
case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break;
|
||||
case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break;
|
||||
case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break;
|
||||
case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break;
|
||||
default: return; // ignore for non-healing classes
|
||||
}
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastSpell(caster, spell_id, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to Blessing of Faith
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
// add dummy effect spell handler to Blessing of Faith
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
return new spell_pal_blessing_of_faith_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pal_blessing_of_faith_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 20911 Blessing of Sanctuary
|
||||
// 25899 Greater Blessing of Sanctuary
|
||||
class spell_pal_blessing_of_sanctuary : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pal_blessing_of_sanctuary() : SpellScriptLoader("spell_pal_blessing_of_sanctuary") { }
|
||||
public:
|
||||
spell_pal_blessing_of_sanctuary() : SpellScriptLoader("spell_pal_blessing_of_sanctuary") { }
|
||||
|
||||
class spell_pal_blessing_of_sanctuary_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pal_blessing_of_sanctuary_AuraScript)
|
||||
bool Validate(SpellInfo const* /*entry*/)
|
||||
class spell_pal_blessing_of_sanctuary_AuraScript : public AuraScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareAuraScript(spell_pal_blessing_of_sanctuary_AuraScript);
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
bool Validate(SpellInfo const* /*entry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell(target, PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, true);
|
||||
}
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->RemoveAura(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, GetCasterGUID());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (Unit* pCaster = GetCaster())
|
||||
pCaster->CastSpell(target, PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, true);
|
||||
return new spell_pal_blessing_of_sanctuary_AuraScript();
|
||||
}
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->RemoveAura(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, GetCasterGUID());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_pal_blessing_of_sanctuary_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 63521 Guarded by The Light
|
||||
class spell_pal_guarded_by_the_light : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pal_guarded_by_the_light() : SpellScriptLoader("spell_pal_guarded_by_the_light") { }
|
||||
public:
|
||||
spell_pal_guarded_by_the_light() : SpellScriptLoader("spell_pal_guarded_by_the_light") { }
|
||||
|
||||
class spell_pal_guarded_by_the_light_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pal_guarded_by_the_light_SpellScript)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
class spell_pal_guarded_by_the_light_SpellScript : public SpellScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_DIVINE_PLEA))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareSpellScript(spell_pal_guarded_by_the_light_SpellScript);
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_DIVINE_PLEA))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
// Divine Plea
|
||||
if (Aura* aura = GetCaster()->GetAura(PALADIN_SPELL_DIVINE_PLEA))
|
||||
aura->RefreshDuration();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
// Divine Plea
|
||||
if (Aura* aura = GetCaster()->GetAura(PALADIN_SPELL_DIVINE_PLEA))
|
||||
aura->RefreshDuration();
|
||||
return new spell_pal_guarded_by_the_light_SpellScript();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pal_guarded_by_the_light_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_pal_holy_shock : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pal_holy_shock() : SpellScriptLoader("spell_pal_holy_shock") { }
|
||||
public:
|
||||
spell_pal_holy_shock() : SpellScriptLoader("spell_pal_holy_shock") { }
|
||||
|
||||
class spell_pal_holy_shock_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pal_holy_shock_SpellScript)
|
||||
bool Validate(SpellInfo const* spellEntry)
|
||||
class spell_pal_holy_shock_SpellScript : public SpellScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1))
|
||||
return false;
|
||||
PrepareSpellScript(spell_pal_holy_shock_SpellScript)
|
||||
bool Validate(SpellInfo const* spellEntry)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1))
|
||||
return false;
|
||||
|
||||
// can't use other spell than holy shock due to spell_ranks dependency
|
||||
if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
|
||||
return false;
|
||||
// can't use other spell than holy shock due to spell_ranks dependency
|
||||
if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
|
||||
return false;
|
||||
|
||||
uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id);
|
||||
if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true))
|
||||
return false;
|
||||
uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id);
|
||||
if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
|
||||
if (caster->IsFriendlyTo(unitTarget))
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0);
|
||||
else
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0);
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
if (caster->IsFriendlyTo(unitTarget))
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0);
|
||||
else
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to Holy Shock
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
// add dummy effect spell handler to Holy Shock
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
return new spell_pal_holy_shock_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pal_holy_shock_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_pal_judgement_of_command : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pal_judgement_of_command() : SpellScriptLoader("spell_pal_judgement_of_command") { }
|
||||
public:
|
||||
spell_pal_judgement_of_command() : SpellScriptLoader("spell_pal_judgement_of_command") { }
|
||||
|
||||
class spell_pal_judgement_of_command_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pal_judgement_of_command_SpellScript)
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
class spell_pal_judgement_of_command_SpellScript : public SpellScript
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
if (SpellInfo const* spell_proto = sSpellMgr->GetSpellInfo(GetEffectValue()))
|
||||
GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
|
||||
}
|
||||
PrepareSpellScript(spell_pal_judgement_of_command_SpellScript)
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
if (SpellInfo const* spell_proto = sSpellMgr->GetSpellInfo(GetEffectValue()))
|
||||
GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
|
||||
}
|
||||
|
||||
void Register()
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to Judgement of Command
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
// add dummy effect spell handler to Judgement of Command
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
return new spell_pal_judgement_of_command_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pal_judgement_of_command_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_pal_divine_storm : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pal_divine_storm() : SpellScriptLoader("spell_pal_divine_storm") { }
|
||||
public:
|
||||
spell_pal_divine_storm() : SpellScriptLoader("spell_pal_divine_storm") { }
|
||||
|
||||
class spell_pal_divine_storm_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pal_divine_storm_SpellScript);
|
||||
|
||||
uint32 healPct;
|
||||
|
||||
bool Load()
|
||||
class spell_pal_divine_storm_SpellScript : public SpellScript
|
||||
{
|
||||
healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster());
|
||||
return true;
|
||||
}
|
||||
PrepareSpellScript(spell_pal_divine_storm_SpellScript);
|
||||
|
||||
void TriggerHeal()
|
||||
uint32 healPct;
|
||||
|
||||
bool Validate(SpellInfo const* /* spell */)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM_DUMMY))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster());
|
||||
return true;
|
||||
}
|
||||
|
||||
void TriggerHeal()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastCustomSpell(SPELL_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, caster, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterHit += SpellHitFn(spell_pal_divine_storm_SpellScript::TriggerHeal);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
GetCaster()->CastCustomSpell(SPELL_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, GetCaster(), true);
|
||||
return new spell_pal_divine_storm_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void Register()
|
||||
class spell_pal_divine_storm_dummy : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pal_divine_storm_dummy() : SpellScriptLoader("spell_pal_divine_storm_dummy") { }
|
||||
|
||||
class spell_pal_divine_storm_dummy_SpellScript : public SpellScript
|
||||
{
|
||||
AfterHit += SpellHitFn(spell_pal_divine_storm_SpellScript::TriggerHeal);
|
||||
}
|
||||
};
|
||||
PrepareSpellScript(spell_pal_divine_storm_dummy_SpellScript);
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pal_divine_storm_SpellScript();
|
||||
}
|
||||
bool Validate(SpellInfo const* /* spell */)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CountTargets(std::list<Unit*>& targetList)
|
||||
{
|
||||
_targetCount = targetList.size();
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
if (!_targetCount || ! GetHitUnit())
|
||||
return;
|
||||
|
||||
int32 heal = GetEffectValue() / _targetCount;
|
||||
GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_DIVINE_STORM_HEAL, &heal, NULL, NULL, true);
|
||||
}
|
||||
private:
|
||||
uint32 _targetCount;
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_divine_storm_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pal_divine_storm_dummy_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_paladin_spell_scripts()
|
||||
@@ -374,4 +421,5 @@ void AddSC_paladin_spell_scripts()
|
||||
new spell_pal_holy_shock();
|
||||
new spell_pal_judgement_of_command();
|
||||
new spell_pal_divine_storm();
|
||||
new spell_pal_divine_storm_dummy();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_pri_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "GridNotifiers.h"
|
||||
|
||||
@@ -49,7 +48,9 @@ class spell_pri_guardian_spirit : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
return sSpellMgr->GetSpellInfo(PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL) != NULL;
|
||||
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load()
|
||||
@@ -101,11 +102,8 @@ class spell_pri_mana_burn : public SpellScriptLoader
|
||||
|
||||
void HandleAfterHit()
|
||||
{
|
||||
Unit* unitTarget = GetHitUnit();
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
unitTarget->RemoveAurasWithMechanic((1 << MECHANIC_FEAR) | (1 << MECHANIC_POLYMORPH));
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
unitTarget->RemoveAurasWithMechanic((1 << MECHANIC_FEAR) | (1 << MECHANIC_POLYMORPH));
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -204,18 +202,19 @@ class spell_pri_penance : public SpellScriptLoader
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* unitTarget = GetHitUnit();
|
||||
if (!unitTarget || !unitTarget->isAlive())
|
||||
return;
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
if(!unitTarget->isAlive())
|
||||
return;
|
||||
|
||||
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
|
||||
if (caster->IsFriendlyTo(unitTarget))
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0);
|
||||
else
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0);
|
||||
if (caster->IsFriendlyTo(unitTarget))
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0);
|
||||
else
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -243,7 +242,9 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
return sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) && sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_R1);
|
||||
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_R1))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Trigger(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
@@ -251,14 +252,13 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
|
||||
Unit* target = GetTarget();
|
||||
if (dmgInfo.GetAttacker() == target)
|
||||
return;
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0))
|
||||
{
|
||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
||||
target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
}
|
||||
|
||||
if (Unit* caster = GetCaster())
|
||||
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0))
|
||||
{
|
||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
||||
target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_rog_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
enum RogueSpells
|
||||
@@ -29,120 +28,114 @@ enum RogueSpells
|
||||
ROGUE_SPELL_SHIV_TRIGGERED = 5940,
|
||||
ROGUE_SPELL_GLYPH_OF_PREPARATION = 56819,
|
||||
ROGUE_SPELL_PREY_ON_THE_WEAK = 58670,
|
||||
ROGUE_SPELL_CHEAT_DEATH_COOLDOWN = 31231,
|
||||
};
|
||||
|
||||
// Cheat Death
|
||||
class spell_rog_cheat_death : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_cheat_death() : SpellScriptLoader("spell_rog_cheat_death") { }
|
||||
public:
|
||||
spell_rog_cheat_death() : SpellScriptLoader("spell_rog_cheat_death") { }
|
||||
|
||||
class spell_rog_cheat_death_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_cheat_death_AuraScript);
|
||||
|
||||
uint32 absorbChance;
|
||||
|
||||
enum Spell
|
||||
class spell_rog_cheat_death_AuraScript : public AuraScript
|
||||
{
|
||||
ROG_SPELL_CHEAT_DEATH_COOLDOWN = 31231,
|
||||
PrepareAuraScript(spell_rog_cheat_death_AuraScript);
|
||||
|
||||
uint32 absorbChance;
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
absorbChance = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
|
||||
return GetUnitOwner()->ToPlayer();
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
{
|
||||
// Set absorbtion amount to unlimited
|
||||
amount = -1;
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Player* target = GetTarget()->ToPlayer();
|
||||
if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance))
|
||||
return;
|
||||
|
||||
target->CastSpell(target, ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, true);
|
||||
target->AddSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60);
|
||||
|
||||
uint32 health10 = target->CountPctFromMaxHealth(10);
|
||||
|
||||
// hp > 10% - absorb hp till 10%
|
||||
if (target->GetHealth() > health10)
|
||||
absorbAmount = dmgInfo.GetDamage() - target->GetHealth() + health10;
|
||||
// hp lower than 10% - absorb everything
|
||||
else
|
||||
absorbAmount = dmgInfo.GetDamage();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_cheat_death_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_cheat_death_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return sSpellMgr->GetSpellInfo(ROG_SPELL_CHEAT_DEATH_COOLDOWN);
|
||||
return new spell_rog_cheat_death_AuraScript();
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
absorbChance = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
|
||||
return GetUnitOwner()->ToPlayer();
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
{
|
||||
// Set absorbtion amount to unlimited
|
||||
amount = -1;
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (dmgInfo.GetDamage() < target->GetHealth())
|
||||
return;
|
||||
if (target->ToPlayer()->HasSpellCooldown(ROG_SPELL_CHEAT_DEATH_COOLDOWN))
|
||||
return;
|
||||
if (!roll_chance_i(absorbChance))
|
||||
return;
|
||||
|
||||
target->CastSpell(target, ROG_SPELL_CHEAT_DEATH_COOLDOWN, true);
|
||||
target->ToPlayer()->AddSpellCooldown(ROG_SPELL_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60);
|
||||
|
||||
uint32 health10 = target->CountPctFromMaxHealth(10);
|
||||
|
||||
// hp > 10% - absorb hp till 10%
|
||||
if (target->GetHealth() > health10)
|
||||
absorbAmount = dmgInfo.GetDamage() - target->GetHealth() + health10;
|
||||
// hp lower than 10% - absorb everything
|
||||
else
|
||||
absorbAmount = dmgInfo.GetDamage();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_cheat_death_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_cheat_death_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_cheat_death_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 31130 - Nerves of Steel
|
||||
class spell_rog_nerves_of_steel : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { }
|
||||
public:
|
||||
spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { }
|
||||
|
||||
class spell_rog_nerves_of_steel_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript);
|
||||
|
||||
uint32 absorbPct;
|
||||
|
||||
bool Load()
|
||||
class spell_rog_nerves_of_steel_AuraScript : public AuraScript
|
||||
{
|
||||
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
|
||||
return true;
|
||||
}
|
||||
PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript);
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
uint32 absorbPct;
|
||||
|
||||
bool Load()
|
||||
{
|
||||
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
|
||||
return true;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
|
||||
{
|
||||
// Set absorbtion amount to unlimited
|
||||
amount = -1;
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
// reduces all damage taken while stun or fear
|
||||
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
|
||||
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_nerves_of_steel_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_nerves_of_steel_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
// Set absorbtion amount to unlimited
|
||||
amount = -1;
|
||||
return new spell_rog_nerves_of_steel_AuraScript();
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
// reduces all damage taken while stun or fear
|
||||
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
|
||||
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_nerves_of_steel_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_nerves_of_steel_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_rog_nerves_of_steel_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_rog_preparation : public SpellScriptLoader
|
||||
@@ -152,7 +145,13 @@ class spell_rog_preparation : public SpellScriptLoader
|
||||
|
||||
class spell_rog_preparation_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_rog_preparation_SpellScript)
|
||||
PrepareSpellScript(spell_rog_preparation_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_GLYPH_OF_PREPARATION))
|
||||
@@ -162,12 +161,10 @@ class spell_rog_preparation : public SpellScriptLoader
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
|
||||
//immediately finishes the cooldown on certain Rogue abilities
|
||||
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
|
||||
const SpellCooldowns& cm = caster->GetSpellCooldownMap();
|
||||
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
@@ -176,14 +173,14 @@ class spell_rog_preparation : public SpellScriptLoader
|
||||
{
|
||||
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep
|
||||
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint
|
||||
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
|
||||
caster->RemoveSpellCooldown((itr++)->first, true);
|
||||
else if (caster->HasAura(ROGUE_SPELL_GLYPH_OF_PREPARATION))
|
||||
{
|
||||
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle
|
||||
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
|
||||
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry
|
||||
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY))
|
||||
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
|
||||
caster->RemoveSpellCooldown((itr++)->first, true);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
@@ -216,7 +213,8 @@ public:
|
||||
|
||||
class spell_rog_prey_on_the_weak_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript)
|
||||
PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_PREY_ON_THE_WEAK))
|
||||
@@ -259,7 +257,13 @@ class spell_rog_shiv : public SpellScriptLoader
|
||||
|
||||
class spell_rog_shiv_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_rog_shiv_SpellScript)
|
||||
PrepareSpellScript(spell_rog_shiv_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_SHIV_TRIGGERED))
|
||||
@@ -270,9 +274,6 @@ class spell_rog_shiv : public SpellScriptLoader
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
caster->CastSpell(unitTarget, ROGUE_SPELL_SHIV_TRIGGERED, true);
|
||||
}
|
||||
@@ -297,8 +298,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader
|
||||
|
||||
class spell_rog_deadly_poison_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_rog_deadly_poison_SpellScript)
|
||||
|
||||
PrepareSpellScript(spell_rog_deadly_poison_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
@@ -309,13 +309,10 @@ class spell_rog_deadly_poison : public SpellScriptLoader
|
||||
|
||||
void HandleBeforeHit()
|
||||
{
|
||||
Unit* target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
// Deadly Poison
|
||||
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID()))
|
||||
_stackAmount = aurEff->GetBase()->GetStackAmount();
|
||||
if (Unit* target = GetHitUnit())
|
||||
// Deadly Poison
|
||||
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID()))
|
||||
_stackAmount = aurEff->GetBase()->GetStackAmount();
|
||||
}
|
||||
|
||||
void HandleAfterHit()
|
||||
@@ -324,49 +321,50 @@ class spell_rog_deadly_poison : public SpellScriptLoader
|
||||
return;
|
||||
|
||||
Player* player = GetCaster()->ToPlayer();
|
||||
Unit* target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
|
||||
if (item == GetCastItem())
|
||||
item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
// item combat enchantments
|
||||
for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
|
||||
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(EnchantmentSlot(slot)));
|
||||
if (!enchant)
|
||||
continue;
|
||||
|
||||
for (uint8 s = 0; s < 3; ++s)
|
||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
|
||||
if (item == GetCastItem())
|
||||
item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
// item combat enchantments
|
||||
for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
|
||||
{
|
||||
if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
|
||||
SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(EnchantmentSlot(slot)));
|
||||
if (!enchant)
|
||||
continue;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
|
||||
if (!spellInfo)
|
||||
for (uint8 s = 0; s < 3; ++s)
|
||||
{
|
||||
sLog->outError("Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName(), player->GetGUIDLow(), enchant->spellid[s]);
|
||||
continue;
|
||||
if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
|
||||
continue;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog->outError("Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName(), player->GetGUIDLow(), enchant->spellid[s]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Proc only rogue poisons
|
||||
if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
|
||||
continue;
|
||||
|
||||
// Do not reproc deadly
|
||||
if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0))
|
||||
continue;
|
||||
|
||||
if (spellInfo->IsPositive())
|
||||
player->CastSpell(player, enchant->spellid[s], true, item);
|
||||
else
|
||||
player->CastSpell(target, enchant->spellid[s], true, item);
|
||||
}
|
||||
|
||||
// Proc only rogue poisons
|
||||
if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
|
||||
continue;
|
||||
|
||||
// Do not reproc deadly
|
||||
if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0))
|
||||
continue;
|
||||
|
||||
if (spellInfo->IsPositive())
|
||||
player->CastSpell(player, enchant->spellid[s], true, item);
|
||||
else
|
||||
player->CastSpell(target, enchant->spellid[s], true, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_sha_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
enum ShamanSpells
|
||||
@@ -94,9 +93,7 @@ class spell_sha_fire_nova : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* spellEntry)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_FIRE_NOVA_R1))
|
||||
return false;
|
||||
if (sSpellMgr->GetFirstSpellInChain(SHAMAN_SPELL_FIRE_NOVA_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
|
||||
if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_FIRE_NOVA_R1) || sSpellMgr->GetFirstSpellInChain(SHAMAN_SPELL_FIRE_NOVA_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
|
||||
return false;
|
||||
|
||||
uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id);
|
||||
@@ -119,13 +116,15 @@ class spell_sha_fire_nova : public SpellScriptLoader
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
if (uint32 spellId = sSpellMgr->GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank))
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]);
|
||||
if (totem && totem->isTotem())
|
||||
caster->CastSpell(totem, spellId, true);
|
||||
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
if (uint32 spellId = sSpellMgr->GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank))
|
||||
{
|
||||
Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]);
|
||||
if (totem && totem->isTotem())
|
||||
caster->CastSpell(totem, spellId, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,30 +153,28 @@ class spell_sha_mana_tide_totem : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_MANA_TIDE_TOTEM))
|
||||
if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE) || !sSpellMgr->GetSpellInfo(SHAMAN_SPELL_MANA_TIDE_TOTEM))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
if (unitTarget->getPowerType() == POWER_MANA)
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
int32 effValue = GetEffectValue();
|
||||
// Glyph of Mana Tide
|
||||
if (Unit* owner = caster->GetOwner())
|
||||
if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0))
|
||||
effValue += dummy->GetAmount();
|
||||
// Regenerate 6% of Total Mana Every 3 secs
|
||||
int32 effBasePoints0 = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), effValue));
|
||||
caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
|
||||
if (unitTarget->getPowerType() == POWER_MANA)
|
||||
{
|
||||
int32 effValue = GetEffectValue();
|
||||
// Glyph of Mana Tide
|
||||
if (Unit* owner = caster->GetOwner())
|
||||
if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0))
|
||||
effValue += dummy->GetAmount();
|
||||
// Regenerate 6% of Total Mana Every 3 secs
|
||||
int32 effBasePoints0 = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), effValue));
|
||||
caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -204,22 +201,20 @@ class spell_sha_earthbind_totem : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHEN_POWER))
|
||||
if (!sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM) || !sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHEN_POWER))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (Unit* caster = aurEff->GetBase()->GetCaster())
|
||||
if (TempSummon* summon = caster->ToTempSummon())
|
||||
if (Unit* owner = summon->GetOwner())
|
||||
if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0))
|
||||
if (roll_chance_i(aur->GetBaseAmount()) && target->HasAuraWithMechanic(1 << MECHANIC_SNARE))
|
||||
caster->CastSpell(caster, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff);
|
||||
if (Unit* target = GetTarget())
|
||||
if (Unit* caster = aurEff->GetBase()->GetCaster())
|
||||
if (TempSummon* summon = caster->ToTempSummon())
|
||||
if (Unit* owner = summon->GetOwner())
|
||||
if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0))
|
||||
if (roll_chance_i(aur->GetBaseAmount()) && target->HasAuraWithMechanic(1 << MECHANIC_SNARE))
|
||||
caster->CastSpell(caster, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -257,7 +252,8 @@ class spell_sha_bloodlust : public SpellScriptLoader
|
||||
|
||||
void ApplyDebuff()
|
||||
{
|
||||
GetHitUnit()->CastSpell(GetHitUnit(), SHAMAN_SPELL_SATED, true);
|
||||
if (Unit* target = GetHitUnit())
|
||||
target->CastSpell(target, SHAMAN_SPELL_SATED, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -298,7 +294,8 @@ class spell_sha_heroism : public SpellScriptLoader
|
||||
|
||||
void ApplyDebuff()
|
||||
{
|
||||
GetHitUnit()->CastSpell(GetHitUnit(), SHAMAN_SPELL_EXHAUSTION, true);
|
||||
if (Unit* target = GetHitUnit())
|
||||
target->CastSpell(target, SHAMAN_SPELL_EXHAUSTION, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -316,6 +313,232 @@ class spell_sha_heroism : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
enum AncestralAwakeningProc
|
||||
{
|
||||
SPELL_ANCESTRAL_AWAKENING_PROC = 52752,
|
||||
};
|
||||
|
||||
class spell_sha_ancestral_awakening_proc : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_sha_ancestral_awakening_proc() : SpellScriptLoader("spell_sha_ancestral_awakening_proc") { }
|
||||
|
||||
class spell_sha_ancestral_awakening_proc_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_sha_ancestral_awakening_proc_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_ANCESTRAL_AWAKENING_PROC))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
if (GetCaster() && GetHitUnit())
|
||||
GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_ANCESTRAL_AWAKENING_PROC, &damage, NULL, NULL, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_sha_ancestral_awakening_proc_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_sha_ancestral_awakening_proc_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum CleansingTotemPulse
|
||||
{
|
||||
SPELL_CLEANSING_TOTEM_EFFECT = 52025,
|
||||
};
|
||||
|
||||
class spell_sha_cleansing_totem_pulse : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_sha_cleansing_totem_pulse() : SpellScriptLoader("spell_sha_cleansing_totem_pulse") { }
|
||||
|
||||
class spell_sha_cleansing_totem_pulse_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_sha_cleansing_totem_pulse_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_CLEANSING_TOTEM_EFFECT))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 bp = 1;
|
||||
if (GetCaster() && GetHitUnit() && GetOriginalCaster())
|
||||
GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_CLEANSING_TOTEM_EFFECT, NULL, &bp, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_sha_cleansing_totem_pulse_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_sha_cleansing_totem_pulse_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum HealingStreamTotem
|
||||
{
|
||||
SPELL_GLYPH_OF_HEALING_STREAM_TOTEM = 55456,
|
||||
ICON_ID_RESTORATIVE_TOTEMS = 338,
|
||||
SPELL_HEALING_STREAM_TOTEM_HEAL = 52042,
|
||||
};
|
||||
|
||||
class spell_sha_healing_stream_totem : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_sha_healing_stream_totem() : SpellScriptLoader("spell_sha_healing_stream_totem") { }
|
||||
|
||||
class spell_sha_healing_stream_totem_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_sha_healing_stream_totem_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM) || !sSpellMgr->GetSpellInfo(SPELL_HEALING_STREAM_TOTEM_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
SpellInfo const* triggeringSpell = GetTriggeringSpell();
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
if (Unit* owner = caster->GetOwner())
|
||||
{
|
||||
if (triggeringSpell)
|
||||
damage = int32(owner->SpellHealingBonus(target, triggeringSpell, damage, HEAL));
|
||||
|
||||
// Restorative Totems
|
||||
if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1))
|
||||
AddPctN(damage, dummy->GetAmount());
|
||||
|
||||
// Glyph of Healing Stream Totem
|
||||
if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0))
|
||||
AddPctN(damage, aurEff->GetAmount());
|
||||
}
|
||||
caster->CastCustomSpell(target, SPELL_HEALING_STREAM_TOTEM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_sha_healing_stream_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_sha_healing_stream_totem_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum ManaSpringTotem
|
||||
{
|
||||
SPELL_MANA_SPRING_TOTEM_ENERGIZE = 52032,
|
||||
};
|
||||
|
||||
class spell_sha_mana_spring_totem : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_sha_mana_spring_totem() : SpellScriptLoader("spell_sha_mana_spring_totem") { }
|
||||
|
||||
class spell_sha_mana_spring_totem_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_sha_mana_spring_totem_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_MANA_SPRING_TOTEM_ENERGIZE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (Unit* caster = GetCaster())
|
||||
if (target->getPowerType() == POWER_MANA)
|
||||
caster->CastCustomSpell(target, SPELL_MANA_SPRING_TOTEM_ENERGIZE, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_sha_mana_spring_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_sha_mana_spring_totem_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_sha_lava_lash : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_sha_lava_lash() : SpellScriptLoader("spell_sha_lava_lash") { }
|
||||
|
||||
class spell_sha_lava_lash_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_sha_lava_lash_SpellScript)
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
if (Player* caster = GetCaster()->ToPlayer())
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
int32 hitDamage = GetHitDamage();
|
||||
if (caster->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
||||
{
|
||||
// Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue.
|
||||
if (caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0))
|
||||
AddPctN(hitDamage, damage);
|
||||
SetHitDamage(hitDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_sha_lava_lash_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_sha_lava_lash_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void AddSC_shaman_spell_scripts()
|
||||
{
|
||||
new spell_sha_astral_shift();
|
||||
@@ -324,4 +547,9 @@ void AddSC_shaman_spell_scripts()
|
||||
new spell_sha_earthbind_totem();
|
||||
new spell_sha_bloodlust();
|
||||
new spell_sha_heroism();
|
||||
new spell_sha_ancestral_awakening_proc();
|
||||
new spell_sha_cleansing_totem_pulse();
|
||||
new spell_sha_healing_stream_totem();
|
||||
new spell_sha_mana_spring_totem();
|
||||
new spell_sha_lava_lash();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_warl_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
@@ -99,15 +98,7 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_IMP))
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_IMP))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -172,9 +163,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R1))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R2))
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R1) || !sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R2))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -267,7 +256,8 @@ public:
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetCaster()->CastSpell(GetCaster(), GetEffectValue(), true);
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastSpell(caster, GetEffectValue(), true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -293,7 +283,8 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
{
|
||||
unitList.remove(GetTargetUnit());
|
||||
if (GetTargetUnit())
|
||||
unitList.remove(GetTargetUnit());
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -308,6 +299,147 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
enum Soulshatter
|
||||
{
|
||||
SPELL_SOULSHATTER = 32835,
|
||||
};
|
||||
|
||||
class spell_warl_soulshatter : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warl_soulshatter() : SpellScriptLoader("spell_warl_soulshatter") { }
|
||||
|
||||
class spell_warl_soulshatter_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warl_soulshatter_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SOULSHATTER))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (target->CanHaveThreatList() && target->getThreatManager().getThreat(caster) > 0.0f)
|
||||
{
|
||||
sLog->outString("THREATREDUCTION");
|
||||
caster->CastSpell(target, SPELL_SOULSHATTER, true);
|
||||
} else
|
||||
sLog->outString("can have threat? %b . threat number? %f ",target->CanHaveThreatList(),target->getThreatManager().getThreat(caster));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warl_soulshatter_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warl_soulshatter_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum LifeTap
|
||||
{
|
||||
SPELL_LIFE_TAP_RANK_6 = 11689,
|
||||
SPELL_LIFE_TAP_RANK_7 = 27222,
|
||||
SPELL_LIFE_TAP_RANK_8 = 57946,
|
||||
SPELL_LIFE_TAP_ENERGIZE = 31818,
|
||||
SPELL_LIFE_TAP_ENERGIZE_2 = 32553,
|
||||
ICON_ID_IMPROVED_LIFE_TAP = 208,
|
||||
ICON_ID_MANA_FEED = 1982,
|
||||
};
|
||||
|
||||
class spell_warl_life_tap : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warl_life_tap() : SpellScriptLoader("spell_warl_life_tap") { }
|
||||
|
||||
class spell_warl_life_tap_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warl_life_tap_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_6) || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_7)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_8) || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE_2))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
SpellInfo const* spellInfo = GetSpellInfo();
|
||||
float spFactor = 0.0f;
|
||||
int32 damage = int32(GetEffectValue() + (6.3875 * spellInfo->BaseLevel));
|
||||
switch (spellInfo->Id)
|
||||
{
|
||||
case SPELL_LIFE_TAP_RANK_6: spFactor = 0.2f; break;
|
||||
case SPELL_LIFE_TAP_RANK_7:
|
||||
case SPELL_LIFE_TAP_RANK_8: spFactor = 0.5f; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
int32 mana = int32(damage + (caster->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor));
|
||||
|
||||
// Shouldn't Appear in Combat Log
|
||||
target->ModifyHealth(-damage);
|
||||
|
||||
// Improved Life Tap mod
|
||||
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, ICON_ID_IMPROVED_LIFE_TAP, 0))
|
||||
AddPctN(mana, aurEff->GetAmount());
|
||||
|
||||
caster->CastCustomSpell(target, SPELL_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false);
|
||||
|
||||
// Mana Feed
|
||||
int32 manaFeedVal = 0;
|
||||
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, ICON_ID_MANA_FEED, 0))
|
||||
manaFeedVal = aurEff->GetAmount();
|
||||
|
||||
if (manaFeedVal > 0)
|
||||
{
|
||||
ApplyPctN(manaFeedVal, mana);
|
||||
caster->CastCustomSpell(caster, SPELL_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
if ((int32(GetCaster()->GetHealth()) > int32(GetSpellInfo()->Effects[EFFECT_0].CalcValue() + (6.3875 * GetSpellInfo()->BaseLevel))))
|
||||
{
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
return SPELL_FAILED_FIZZLE;
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warl_life_tap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnCheckCast += SpellCheckCastFn(spell_warl_life_tap_SpellScript::CheckCast);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warl_life_tap_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_warlock_spell_scripts()
|
||||
{
|
||||
new spell_warl_banish();
|
||||
@@ -316,4 +448,6 @@ void AddSC_warlock_spell_scripts()
|
||||
new spell_warl_everlasting_affliction();
|
||||
new spell_warl_ritual_of_doom_effect();
|
||||
new spell_warl_seed_of_corruption();
|
||||
new spell_warl_soulshatter();
|
||||
new spell_warl_life_tap();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_warr_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
|
||||
enum WarriorSpells
|
||||
{
|
||||
@@ -46,8 +45,11 @@ class spell_warr_last_stand : public SpellScriptLoader
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
int32 healthModSpellBasePoints0 = int32(GetCaster()->CountPctFromMaxHealth(30));
|
||||
GetCaster()->CastCustomSpell(GetCaster(), WARRIOR_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30));
|
||||
caster->CastCustomSpell(caster, WARRIOR_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -74,7 +76,8 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
{
|
||||
unitList.remove(GetCaster());
|
||||
if (GetCaster())
|
||||
unitList.remove(GetCaster());
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -115,23 +118,19 @@ public:
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true);
|
||||
if (Unit* target = GetTarget())
|
||||
target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
|
||||
if (!target->HasAura(SPELL_DAMAGE_REDUCTION_AURA))
|
||||
return;
|
||||
|
||||
if (target->HasAura(SPELL_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_RENEWED_HOPE))
|
||||
return;
|
||||
|
||||
target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA);
|
||||
if (Unit* target = GetTarget())
|
||||
{
|
||||
if (target->HasAura(SPELL_DAMAGE_REDUCTION_AURA) && !(target->HasAura(SPELL_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_RENEWED_HOPE)))
|
||||
target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -148,9 +147,278 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
enum DeepWounds
|
||||
{
|
||||
SPELL_DEEP_WOUNDS_RANK_1 = 12162,
|
||||
SPELL_DEEP_WOUNDS_RANK_2 = 12850,
|
||||
SPELL_DEEP_WOUNDS_RANK_3 = 12868,
|
||||
SPELL_DEEP_WOUNDS_RANK_PERIODIC = 12721,
|
||||
};
|
||||
|
||||
class spell_warr_deep_wounds : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_deep_wounds() : SpellScriptLoader("spell_warr_deep_wounds") { }
|
||||
|
||||
class spell_warr_deep_wounds_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_deep_wounds_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_1) || !sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_2) || !sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_3))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
// apply percent damage mods
|
||||
damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
|
||||
|
||||
ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id));
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC);
|
||||
uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude;
|
||||
|
||||
// Add remaining ticks to damage done
|
||||
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID()))
|
||||
damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber());
|
||||
|
||||
damage = damage / ticks;
|
||||
caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_deep_wounds_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_deep_wounds_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum Charge
|
||||
{
|
||||
SPELL_JUGGERNAUT_CRIT_BONUS_TALENT = 64976,
|
||||
SPELL_JUGGERNAUT_CRIT_BONUS_BUFF = 65156,
|
||||
SPELL_CHARGE = 34846,
|
||||
};
|
||||
|
||||
class spell_warr_charge : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_charge() : SpellScriptLoader("spell_warr_charge") { }
|
||||
|
||||
class spell_warr_charge_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_charge_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_JUGGERNAUT_CRIT_BONUS_TALENT) || !sSpellMgr->GetSpellInfo(SPELL_JUGGERNAUT_CRIT_BONUS_BUFF) || !sSpellMgr->GetSpellInfo(SPELL_CHARGE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 chargeBasePoints0 = GetEffectValue();
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastCustomSpell(caster, SPELL_CHARGE, &chargeBasePoints0, NULL, NULL, true);
|
||||
|
||||
//Juggernaut crit bonus
|
||||
if (caster->HasAura(SPELL_JUGGERNAUT_CRIT_BONUS_TALENT))
|
||||
caster->CastSpell(caster, SPELL_JUGGERNAUT_CRIT_BONUS_BUFF, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_charge_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_charge_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum Slam
|
||||
{
|
||||
SPELL_SLAM = 50783,
|
||||
};
|
||||
|
||||
class spell_warr_slam : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_slam() : SpellScriptLoader("spell_warr_slam") { }
|
||||
|
||||
class spell_warr_slam_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_slam_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SLAM))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 bp0 = GetEffectValue();
|
||||
if (GetHitUnit())
|
||||
GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SLAM, &bp0, NULL, NULL, true, 0);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_slam_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_slam_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum Execute
|
||||
{
|
||||
SPELL_EXECUTE = 20647,
|
||||
SPELL_GLYPH_OF_EXECUTION = 58367,
|
||||
ICON_ID_SUDDEN_DEATH = 1989,
|
||||
};
|
||||
|
||||
class spell_warr_execute : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_execute() : SpellScriptLoader("spell_warr_execute") { }
|
||||
|
||||
class spell_warr_execute_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_execute_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_EXECUTE) || !sSpellMgr->GetSpellInfo(SPELL_GLYPH_OF_EXECUTION))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
SpellInfo const* spellInfo = GetSpellInfo();
|
||||
int32 rageUsed = std::min<int32>(300 - spellInfo->CalcPowerCost(caster, SpellSchoolMask(spellInfo->SchoolMask)), caster->GetPower(POWER_RAGE));
|
||||
int32 newRage = std::max<int32>(0, caster->GetPower(POWER_RAGE) - rageUsed);
|
||||
|
||||
// Sudden Death rage save
|
||||
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, ICON_ID_SUDDEN_DEATH, EFFECT_0))
|
||||
{
|
||||
int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10;
|
||||
newRage = std::max(newRage, ragesave);
|
||||
}
|
||||
|
||||
caster->SetPower(POWER_RAGE, uint32(newRage));
|
||||
// Glyph of Execution bonus
|
||||
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_GLYPH_OF_EXECUTION, EFFECT_0))
|
||||
rageUsed += aurEff->GetAmount() * 10;
|
||||
|
||||
|
||||
int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
|
||||
caster->CastCustomSpell(target,SPELL_EXECUTE,&bp,0,0,true,0,0,GetOriginalCaster()->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_execute_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_execute_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_warr_concussion_blow : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_concussion_blow() : SpellScriptLoader("spell_warr_concussion_blow") { }
|
||||
|
||||
class spell_warr_concussion_blow_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_concussion_blow_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
SetHitDamage(GetHitDamage() + CalculatePctF(GetHitDamage(),GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK)));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_concussion_blow_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_concussion_blow_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum Bloodthirst
|
||||
{
|
||||
SPELL_BLOODTHIRST = 23885,
|
||||
};
|
||||
|
||||
class spell_warr_bloodthirst : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_bloodthirst() : SpellScriptLoader("spell_warr_bloodthirst") { }
|
||||
|
||||
class spell_warr_bloodthirst_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warr_bloodthirst_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
if (GetHitUnit())
|
||||
GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warr_bloodthirst_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_warrior_spell_scripts()
|
||||
{
|
||||
new spell_warr_last_stand();
|
||||
new spell_warr_improved_spell_reflection();
|
||||
new spell_warr_vigilance();
|
||||
new spell_warr_deep_wounds();
|
||||
new spell_warr_charge();
|
||||
new spell_warr_slam();
|
||||
new spell_warr_execute();
|
||||
new spell_warr_concussion_blow();
|
||||
new spell_warr_bloodthirst();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user