Scripts/Spells: Convert code from Spell::EffectDummy to spell scripts.

This commit is contained in:
Kandera
2012-02-18 12:12:49 +01:00
committed by QAston
parent d55c8c7cc4
commit c517806a23
24 changed files with 4446 additions and 2965 deletions
@@ -0,0 +1,69 @@
DELETE FROM `spell_script_names` WHERE `spell_id` in (-100,-12162,13567,17251,23019,23448,23453,25860,28089,29200,29858,30458,30507,31225,35745,37674,39090,39093,39096,42784,43723,44875,47170,49357,50243,51582,51961,52759,52845,53808,54171,54577,55004,64385,-1464,-5308,12809,23881,-1454,-50286,8171,52041,52046,52047,52048,52049,52050,52059,52060,52061,52031,52033,52034,52035,52036,58778,58779,58780,60103,-49998,-66188,-47541,52375,59134,-62900,49560,62324,31890);
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(-100,'spell_warr_charge'),
(-12162,'spell_warr_deep_wounds'),
(13567,'spell_gen_dummy_trigger'),
(17251,'spell_gen_spirit_healer_res'),
(23019,'spell_item_crystal_prison_dummy_dnd'),
(23448,'spell_gen_gadgetzan_transporter_backfire'),
(23453,'spell_gen_gnomish_transporter'),
(25860,'spell_item_reindeer_transformation'),
(28089,'spell_thaddius_polarity_shift'),
(29200,'spell_item_purify_helboar_meat'),
(29858,'spell_warl_soulshatter'),
(30458,'spell_item_nigh_invulnerability'),
(30507,'spell_item_poultryizer'),
(31225,'spell_item_shimmering_vessel'),
(35745,'spell_item_socrethars_stone'),
(37674,'spell_gen_chaos_blast'),
(39090,'spell_capacitus_polarity_charge'),
(39093,'spell_capacitus_polarity_charge'),
(39096,'spell_capacitus_polarity_shift'),
(42784,'spell_astromancer_wrath_of_the_astromancer'),
(43723,'spell_item_demon_broiled_surprise'),
(44875,'spell_item_complete_raptor_capture'),
(47170,'spell_item_impale_leviroth'),
(49357,'spell_item_brewfest_mount_transformation'),
(50243,'spell_item_teach_language'),
(51582,'spell_item_rocket_boots'),
(51961,'spell_item_chicken_cover'),
(52759,'spell_sha_ancestral_awakening_proc'),
(52845,'spell_item_brewfest_mount_transformation'),
(53808,'spell_item_pygmy_oil'),
(54577,'spell_item_uded'),
(54171,'spell_pal_divine_storm_dummy'),
(55004,'spell_item_nitro_boots'),
(64385,'spell_item_unusual_compass'),
(-1464,'spell_warr_slam'),
(-5308,'spell_warr_execute'),
(12809,'spell_warr_concussion_blow'),
(23881,'spell_warr_bloodthirst'),
(-1454,'spell_warl_life_tap'),
(-50286,'spell_dru_starfall_dummy'),
(8171,'spell_sha_cleansing_totem_pulse'),
(52041,'spell_sha_healing_stream_totem'),
(52046,'spell_sha_healing_stream_totem'),
(52047,'spell_sha_healing_stream_totem'),
(52048,'spell_sha_healing_stream_totem'),
(52049,'spell_sha_healing_stream_totem'),
(52050,'spell_sha_healing_stream_totem'),
(52059,'spell_sha_healing_stream_totem'),
(52060,'spell_sha_healing_stream_totem'),
(52061,'spell_sha_healing_stream_totem'),
(52031,'spell_sha_mana_spring_totem'),
(52033,'spell_sha_mana_spring_totem'),
(52034,'spell_sha_mana_spring_totem'),
(52035,'spell_sha_mana_spring_totem'),
(52036,'spell_sha_mana_spring_totem'),
(58778,'spell_sha_mana_spring_totem'),
(58779,'spell_sha_mana_spring_totem'),
(58780,'spell_sha_mana_spring_totem'),
(60103,'spell_sha_lava_lash'),
(-49998,'spell_dk_death_strike'),
(-66188,'spell_dk_death_strike'),
(-47541,'spell_dk_death_coil'),
(52375,'spell_dk_death_coil'),
(59134,'spell_dk_death_coil'),
(-62900,'spell_dk_death_coil'),
(49560,'spell_dk_death_grip'),
(62324,'spell_vehicle_throw_passenger');
@@ -0,0 +1,3 @@
DELETE FROM `spell_dbc` WHERE `id`=31980;
INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`AttributesEx6`,`AttributesEx7`,`Stances`,`StancesNot`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) VALUES
(31980,0,0,328064,1024,4,268894208,0,0,0,0,0,0,0,1,0,0,101,0,0,14,14,0,13,0,-1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,0,0,15,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,4,0,0,0,0,1,0,0,0,1,"Righteous Defense Trigger Spell");
+1
View File
@@ -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,7 +530,7 @@ 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) ||
@@ -539,17 +539,15 @@ namespace Trinity
(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
-682
View File
@@ -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,97 +784,9 @@ 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;
+10
View File
@@ -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())
+4 -1
View File
@@ -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();
}
+161 -21
View File
@@ -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();
}
+50 -9
View File
@@ -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,13 +302,15 @@ 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))
if (Player* caster = GetCaster()->ToPlayer())
if (caster->Has310Flyer(false))
amount = 310;
}
@@ -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();
}
+326 -131
View File
@@ -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,14 +243,12 @@ 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,7 +757,7 @@ class spell_gen_divine_storm_cd_reset : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Player* caster = GetCaster()->ToPlayer())
Player* caster = GetCaster()->ToPlayer();
if (caster->HasSpellCooldown(SPELL_DIVINE_STORM))
caster->RemoveSpellCooldown(SPELL_DIVINE_STORM, true);
}
@@ -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,12 +824,8 @@ 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)
if (Player* target = GetTarget()->ToPlayer())
if (target->m_movementInfo.fallTime > 2000)
target->CastSpell(target, SPELL_PARACHUTE_IC, true);
}
@@ -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,10 +981,8 @@ class spell_generic_clone_weapon : public SpellScriptLoader
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!target)
return;
if (Unit* target = GetHitUnit())
{
uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
target->CastSpell(caster, spellId, true);
@@ -1052,6 +1032,7 @@ class spell_generic_clone_weapon : public SpellScriptLoader
break;
}
}
}
void Register()
{
@@ -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,10 +1190,8 @@ class spell_gen_magic_rooster : public SpellScriptLoader
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Player* target = GetHitPlayer();
if (!target)
return;
if (Player* target = GetHitPlayer())
{
// prevent client crashes from stacking mounts
target->RemoveAurasByType(SPELL_AURA_MOUNTED);
@@ -1232,6 +1212,7 @@ class spell_gen_magic_rooster : public SpellScriptLoader
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:
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)
PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Player* player = GetCaster()->ToPlayer())
{
Player* player = GetCaster()->ToPlayer();
uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue();
int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
@@ -1410,8 +1394,6 @@ 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);
@@ -1435,7 +1417,7 @@ enum DamageReductionAura
class spell_gen_damage_reduction_aura : public SpellScriptLoader
{
public:
public:
spell_gen_damage_reduction_aura() : SpellScriptLoader("spell_gen_damage_reduction_aura") { }
class spell_gen_damage_reduction_AuraScript : public AuraScript
@@ -1458,15 +1440,10 @@ public:
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) ||
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))
return;
target->HasAura(SPELL_VIGILANCE)))
target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA);
}
@@ -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,10 +1484,9 @@ 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());
if (Player* owner = GetUnitOwner()->ToPlayer())
{
const LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(owner->GetGUID());
LfgDungeonSet::const_iterator itr = dungeons.begin();
if (itr == dungeons.end())
@@ -1516,9 +1497,9 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader
LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*itr);
Group* group = GetUnitOwner()->ToPlayer()->GetGroup();
Map const* map = GetUnitOwner()->GetMap();
if (group && group->isLFGGroup())
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())
@@ -1527,6 +1508,7 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader
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();
}
+83 -90
View File
@@ -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,12 +44,18 @@ enum HunterSpells
// 13161 Aspect of the Beast
class spell_hun_aspect_of_the_beast : public SpellScriptLoader
{
public:
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)
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))
@@ -60,23 +65,15 @@ public:
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (!GetCaster())
return;
Unit* caster = GetCaster();
if (caster->ToPlayer())
if (Pet* pet = caster->ToPlayer()->GetPet())
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 (!GetCaster())
return;
Unit* caster = GetCaster();
if (caster->ToPlayer())
if (caster->ToPlayer()->GetPet())
if (Player* caster = GetCaster()->ToPlayer())
if (caster->GetPet())
caster->CastSpell(caster, HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET, true);
}
@@ -96,19 +93,16 @@ public:
// 53209 Chimera Shot
class spell_hun_chimera_shot : public SpellScriptLoader
{
public:
public:
spell_hun_chimera_shot() : SpellScriptLoader("spell_hun_chimera_shot") { }
class spell_hun_chimera_shot_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_chimera_shot_SpellScript)
PrepareSpellScript(spell_hun_chimera_shot_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
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))
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;
}
@@ -116,10 +110,8 @@ public:
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* unitTarget = GetHitUnit();
if (!unitTarget)
return;
if (Unit* unitTarget = GetHitUnit())
{
uint32 spellId = 0;
int32 basePoint = 0;
Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
@@ -176,6 +168,7 @@ public:
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()
{
@@ -192,12 +185,13 @@ public:
// 53412 Invigoration
class spell_hun_invigoration : public SpellScriptLoader
{
public:
public:
spell_hun_invigoration() : SpellScriptLoader("spell_hun_invigoration") { }
class spell_hun_invigoration_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_invigoration_SpellScript)
PrepareSpellScript(spell_hun_invigoration_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_INVIGORATION_TRIGGERED))
@@ -227,12 +221,13 @@ public:
class spell_hun_last_stand_pet : public SpellScriptLoader
{
public:
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)
PrepareSpellScript(spell_hun_last_stand_pet_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED))
@@ -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,18 +304,21 @@ class spell_hun_masters_call : public SpellScriptLoader
class spell_hun_readiness : public SpellScriptLoader
{
public:
public:
spell_hun_readiness() : SpellScriptLoader("spell_hun_readiness") { }
class spell_hun_readiness_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_readiness_SpellScript)
PrepareSpellScript(spell_hun_readiness_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 your other Hunter abilities except Bestial Wrath
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
@@ -336,7 +331,7 @@ public:
spellInfo->Id != HUNTER_SPELL_READINESS &&
spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH &&
spellInfo->GetRecoveryTime() > 0)
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
caster->RemoveSpellCooldown((itr++)->first, true);
else
++itr;
}
@@ -358,22 +353,25 @@ public:
// 37506 Scatter Shot
class spell_hun_scatter_shot : public SpellScriptLoader
{
public:
public:
spell_hun_scatter_shot() : SpellScriptLoader("spell_hun_scatter_shot") { }
class spell_hun_scatter_shot_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_scatter_shot_SpellScript)
PrepareSpellScript(spell_hun_scatter_shot_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();
// break Auto Shot and autohit
caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
caster->AttackStop();
caster->ToPlayer()->SendAttackSwingCancelAttack();
caster->SendAttackSwingCancelAttack();
}
void Register()
@@ -397,17 +395,16 @@ enum eSniperTrainingSpells
class spell_hun_sniper_training : public SpellScriptLoader
{
public:
public:
spell_hun_sniper_training() : SpellScriptLoader("spell_hun_sniper_training") { }
class spell_hun_sniper_training_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_sniper_training_AuraScript)
PrepareAuraScript(spell_hun_sniper_training_AuraScript);
bool Validate(SpellInfo const* /*entry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_R1))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_BUFF_R1))
if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_R1) || !sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_BUFF_R1))
return false;
return true;
}
@@ -415,16 +412,11 @@ public:
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetAmount() > 0)
return;
if (aurEff->GetAmount() <= 0)
{
Unit* caster = GetCaster();
if (!caster)
return;
uint32 spellId = SPELL_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_SNIPER_TRAINING_R1;
Unit* target = GetTarget();
if (Unit* target = GetTarget())
if (!target->HasAura(spellId))
{
SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId);
@@ -432,15 +424,15 @@ public:
triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff);
}
}
}
void HandleUpdatePeriodic(AuraEffect* aurEff)
{
Unit* target = GetUnitOwner();
if (Player* playerTarget = target->ToPlayer())
if (Player* playerTarget = GetUnitOwner()->ToPlayer())
{
int32 baseAmount = aurEff->GetBaseAmount();
int32 amount = playerTarget->isMoving() ?
target->CalculateSpellDamage(target, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) :
playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) :
aurEff->GetAmount() - 1;
aurEff->SetAmount(amount);
}
@@ -461,17 +453,23 @@ public:
class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader
{
public:
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)
PrepareSpellScript(spell_hun_pet_heart_of_the_phoenix_SpellScript);
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED))
return false;
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED) || !sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
return false;
return true;
}
@@ -479,25 +477,19 @@ public:
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* owner = caster->GetOwner();
if (!owner || caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
return;
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);
}
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
};
SpellScript* GetSpellScript() const
@@ -508,12 +500,20 @@ public:
class spell_hun_pet_carrion_feeder : public SpellScriptLoader
{
public:
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)
PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript);
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
@@ -547,13 +547,6 @@ public:
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
File diff suppressed because it is too large Load Diff
+22 -20
View File
@@ -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,7 +211,7 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
// Frost Warding
class spell_mage_frost_warding_trigger : public SpellScriptLoader
{
public:
public:
spell_mage_frost_warding_trigger() : SpellScriptLoader("spell_mage_frost_warding_trigger") { }
class spell_mage_frost_warding_trigger_AuraScript : public AuraScript
@@ -225,8 +226,9 @@ public:
bool Validate(SpellInfo const* /*spellEntry*/)
{
return sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_TRIGGERED)
&& sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_R1);
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)
@@ -259,7 +261,7 @@ public:
class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript
{
public:
public:
enum Spells
{
SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED = 44413,
+78 -30
View File
@@ -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,7 +47,7 @@ enum PaladinSpells
// 31850 - Ardent Defender
class spell_pal_ardent_defender : public SpellScriptLoader
{
public:
public:
spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { }
class spell_pal_ardent_defender_AuraScript : public AuraScript
@@ -64,7 +65,7 @@ public:
{
healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
return GetUnitOwner()->ToPlayer();
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
@@ -121,21 +122,16 @@ public:
class spell_pal_blessing_of_faith : public SpellScriptLoader
{
public:
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)
PrepareSpellScript(spell_pal_blessing_of_faith_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
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))
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;
}
@@ -153,8 +149,8 @@ public:
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);
Unit* caster = GetCaster();
caster->CastSpell(caster, spell_id, true);
}
}
@@ -175,12 +171,13 @@ public:
// 25899 Greater Blessing of Sanctuary
class spell_pal_blessing_of_sanctuary : public SpellScriptLoader
{
public:
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)
PrepareAuraScript(spell_pal_blessing_of_sanctuary_AuraScript);
bool Validate(SpellInfo const* /*entry*/)
{
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF))
@@ -191,8 +188,8 @@ public:
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (Unit* pCaster = GetCaster())
pCaster->CastSpell(target, PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, true);
if (Unit* caster = GetCaster())
caster->CastSpell(target, PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -217,12 +214,13 @@ public:
// 63521 Guarded by The Light
class spell_pal_guarded_by_the_light : public SpellScriptLoader
{
public:
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)
PrepareSpellScript(spell_pal_guarded_by_the_light_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_DIVINE_PLEA))
@@ -251,7 +249,7 @@ public:
class spell_pal_holy_shock : public SpellScriptLoader
{
public:
public:
spell_pal_holy_shock() : SpellScriptLoader("spell_pal_holy_shock") { }
class spell_pal_holy_shock_SpellScript : public SpellScript
@@ -267,9 +265,7 @@ public:
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))
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;
@@ -277,12 +273,10 @@ public:
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
{
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
@@ -305,7 +299,7 @@ public:
class spell_pal_judgement_of_command : public SpellScriptLoader
{
public:
public:
spell_pal_judgement_of_command() : SpellScriptLoader("spell_pal_judgement_of_command") { }
class spell_pal_judgement_of_command_SpellScript : public SpellScript
@@ -333,7 +327,7 @@ public:
class spell_pal_divine_storm : public SpellScriptLoader
{
public:
public:
spell_pal_divine_storm() : SpellScriptLoader("spell_pal_divine_storm") { }
class spell_pal_divine_storm_SpellScript : public SpellScript
@@ -342,6 +336,13 @@ public:
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());
@@ -350,7 +351,8 @@ public:
void TriggerHeal()
{
GetCaster()->CastCustomSpell(SPELL_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, GetCaster(), true);
Unit* caster = GetCaster();
caster->CastCustomSpell(SPELL_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, caster, true);
}
void Register()
@@ -365,6 +367,51 @@ public:
}
};
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
{
PrepareSpellScript(spell_pal_divine_storm_dummy_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()
{
new spell_pal_ardent_defender();
@@ -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();
}
+14 -14
View File
@@ -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,10 +102,7 @@ class spell_pri_mana_burn : public SpellScriptLoader
void HandleAfterHit()
{
Unit* unitTarget = GetHitUnit();
if (!unitTarget)
return;
if (Unit* unitTarget = GetHitUnit())
unitTarget->RemoveAurasWithMechanic((1 << MECHANIC_FEAR) | (1 << MECHANIC_POLYMORPH));
}
@@ -204,11 +202,11 @@ 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);
@@ -217,6 +215,7 @@ class spell_pri_penance : public SpellScriptLoader
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,9 +252,8 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
Unit* target = GetTarget();
if (dmgInfo.GetAttacker() == target)
return;
Unit* caster = GetCaster();
if (!caster)
return;
if (Unit* caster = GetCaster())
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0))
{
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
+139 -145
View File
@@ -21,13 +21,12 @@
* Scriptnames of files in this file should be prefixed with "spell_q#questID_".
*/
#include "ScriptPCH.h"
#include "Vehicle.h"
class spell_generic_quest_update_entry_SpellScript : public SpellScript
{
PrepareSpellScript(spell_generic_quest_update_entry_SpellScript)
private:
PrepareSpellScript(spell_generic_quest_update_entry_SpellScript);
private:
uint16 _spellEffect;
uint8 _effIndex;
uint32 _originalEntry;
@@ -35,7 +34,7 @@ private:
bool _shouldAttack;
uint32 _despawnTime;
public:
public:
spell_generic_quest_update_entry_SpellScript(uint16 spellEffect, uint8 effIndex, uint32 originalEntry, uint32 newEntry, bool shouldAttack, uint32 despawnTime = 0) :
SpellScript(), _spellEffect(spellEffect), _effIndex(effIndex), _originalEntry(originalEntry),
_newEntry(newEntry), _shouldAttack(shouldAttack), _despawnTime(despawnTime) { }
@@ -62,7 +61,7 @@ public:
// http://www.wowhead.com/quest=55 Morbent Fel
// 8913 Sacred Cleansing
enum eQuest55Data
enum Quest55Data
{
NPC_MORBENT = 1200,
NPC_WEAKENED_MORBENT = 24782,
@@ -70,7 +69,7 @@ enum eQuest55Data
class spell_q55_sacred_cleansing : public SpellScriptLoader
{
public:
public:
spell_q55_sacred_cleansing() : SpellScriptLoader("spell_q55_sacred_cleansing") { }
SpellScript* GetSpellScript() const
@@ -81,7 +80,7 @@ public:
// http://www.wowhead.com/quest=5206 Marauders of Darrowshire
// 17271 Test Fetid Skull
enum eQuest5206Data
enum Quest5206Data
{
SPELL_CREATE_RESONATING_SKULL = 17269,
SPELL_CREATE_BONE_DUST = 17270
@@ -89,29 +88,30 @@ enum eQuest5206Data
class spell_q5206_test_fetid_skull : public SpellScriptLoader
{
public:
public:
spell_q5206_test_fetid_skull() : SpellScriptLoader("spell_q5206_test_fetid_skull") { }
class spell_q5206_test_fetid_skull_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q5206_test_fetid_skull_SpellScript)
PrepareSpellScript(spell_q5206_test_fetid_skull_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_RESONATING_SKULL))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_BONE_DUST))
if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_RESONATING_SKULL) || !sSpellMgr->GetSpellInfo(SPELL_CREATE_BONE_DUST))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* pCaster = GetCaster();
if (pCaster->GetTypeId() == TYPEID_PLAYER)
{
Unit* caster = GetCaster();
uint32 spellId = roll_chance_i(50) ? SPELL_CREATE_RESONATING_SKULL : SPELL_CREATE_BONE_DUST;
pCaster->CastSpell(pCaster, spellId, true, NULL);
}
caster->CastSpell(caster, spellId, true, NULL);
}
void Register()
@@ -129,7 +129,7 @@ public:
// http://www.wowhead.com/quest=6124 Curing the Sick (A)
// http://www.wowhead.com/quest=6129 Curing the Sick (H)
// 19512 Apply Salve
enum eQuests6124_6129Data
enum Quests6124_6129Data
{
NPC_SICKLY_GAZELLE = 12296,
NPC_CURED_GAZELLE = 12297,
@@ -140,20 +140,26 @@ enum eQuests6124_6129Data
class spell_q6124_6129_apply_salve : public SpellScriptLoader
{
public:
public:
spell_q6124_6129_apply_salve() : SpellScriptLoader("spell_q6124_6129_apply_salve") { }
class spell_q6124_6129_apply_salve_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q6124_6129_apply_salve_SpellScript)
PrepareSpellScript(spell_q6124_6129_apply_salve_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
if (GetCastItem())
if (Player* pCaster = GetCaster()->ToPlayer())
if (Creature* creatureTarget = GetHitCreature())
{
uint32 uiNewEntry = 0;
switch (pCaster->GetTeam())
switch (caster->GetTeam())
{
case HORDE:
if (creatureTarget->GetEntry() == NPC_SICKLY_GAZELLE)
@@ -186,7 +192,7 @@ public:
// http://www.wowhead.com/quest=10255 Testing the Antidote
// 34665 Administer Antidote
enum eQuest10255Data
enum Quest10255Data
{
NPC_HELBOAR = 16880,
NPC_DREADTUSK = 16992,
@@ -194,7 +200,7 @@ enum eQuest10255Data
class spell_q10255_administer_antidote : public SpellScriptLoader
{
public:
public:
spell_q10255_administer_antidote() : SpellScriptLoader("spell_q10255_administer_antidote") { }
SpellScript* GetSpellScript() const
@@ -205,7 +211,7 @@ public:
// http://www.wowhead.com/quest=11396 Bring Down Those Shields (A)
// http://www.wowhead.com/quest=11399 Bring Down Those Shields (H)
enum eQuest11396_11399Data
enum Quest11396_11399Data
{
SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3 = 43874,
SPELL_SCOURGING_CRYSTAL_CONTROLLER = 43878
@@ -214,12 +220,13 @@ enum eQuest11396_11399Data
// 43874 Scourge Mur'gul Camp: Force Shield Arcane Purple x3
class spell_q11396_11399_force_shield_arcane_purple_x3 : public SpellScriptLoader
{
public:
public:
spell_q11396_11399_force_shield_arcane_purple_x3() : SpellScriptLoader("spell_q11396_11399_force_shield_arcane_purple_x3") { }
class spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript : public AuraScript
{
PrepareAuraScript(spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript)
PrepareAuraScript(spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript);
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
@@ -249,17 +256,16 @@ public:
// 50133 Scourging Crystal Controller
class spell_q11396_11399_scourging_crystal_controller : public SpellScriptLoader
{
public:
public:
spell_q11396_11399_scourging_crystal_controller() : SpellScriptLoader("spell_q11396_11399_scourging_crystal_controller") { }
class spell_q11396_11399_scourging_crystal_controller_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q11396_11399_scourging_crystal_controller_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_SCOURGING_CRYSTAL_CONTROLLER))
if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3) || !sSpellMgr->GetSpellInfo(SPELL_SCOURGING_CRYSTAL_CONTROLLER))
return false;
return true;
}
@@ -288,12 +294,13 @@ public:
// 43882 Scourging Crystal Controller Dummy
class spell_q11396_11399_scourging_crystal_controller_dummy : public SpellScriptLoader
{
public:
public:
spell_q11396_11399_scourging_crystal_controller_dummy() : SpellScriptLoader("spell_q11396_11399_scourging_crystal_controller_dummy") { }
class spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
@@ -303,7 +310,7 @@ public:
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetTargetUnit())
if (Unit* target = GetHitUnit())
if (target->GetTypeId() == TYPEID_UNIT)
target->RemoveAurasDueToSpell(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3);
}
@@ -322,7 +329,7 @@ public:
// http://www.wowhead.com/quest=11515 Blood for Blood
// 44936 Quest - Fel Siphon Dummy
enum eQuest11515Data
enum Quest11515Data
{
NPC_FELBLOOD_INITIATE = 24918,
NPC_EMACIATED_FELBLOOD = 24955
@@ -330,7 +337,7 @@ enum eQuest11515Data
class spell_q11515_fel_siphon_dummy : public SpellScriptLoader
{
public:
public:
spell_q11515_fel_siphon_dummy() : SpellScriptLoader("spell_q11515_fel_siphon_dummy") { }
SpellScript* GetSpellScript() const
@@ -341,7 +348,7 @@ public:
// http://www.wowhead.com/quest=11587 Prison Break
// 45449 Arcane Prisoner Rescue
enum eQuest11587Data
enum Quest11587Data
{
SPELL_SUMMON_ARCANE_PRISONER_MALE = 45446, // Summon Arcane Prisoner - Male
SPELL_SUMMON_ARCANE_PRISONER_FEMALE = 45448, // Summon Arcane Prisoner - Female
@@ -350,19 +357,16 @@ enum eQuest11587Data
class spell_q11587_arcane_prisoner_rescue : public SpellScriptLoader
{
public:
public:
spell_q11587_arcane_prisoner_rescue() : SpellScriptLoader("spell_q11587_arcane_prisoner_rescue") { }
class spell_q11587_arcane_prisoner_rescue_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q11587_arcane_prisoner_rescue_SpellScript)
PrepareSpellScript(spell_q11587_arcane_prisoner_rescue_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_MALE))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_FEMALE))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_ARCANE_PRISONER_KILL_CREDIT))
if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_MALE) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_ARCANE_PRISONER_KILL_CREDIT))
return false;
return true;
}
@@ -394,7 +398,7 @@ public:
// http://www.wowhead.com/quest=11730 Master and Servant
// 46023 The Ultrasonic Screwdriver
enum eQuest11730Data
enum Quest11730Data
{
SPELL_SUMMON_SCAVENGEBOT_004A8 = 46063,
SPELL_SUMMON_SENTRYBOT_57K = 46068,
@@ -411,25 +415,21 @@ enum eQuest11730Data
class spell_q11730_ultrasonic_screwdriver : public SpellScriptLoader
{
public:
public:
spell_q11730_ultrasonic_screwdriver() : SpellScriptLoader("spell_q11730_ultrasonic_screwdriver") { }
class spell_q11730_ultrasonic_screwdriver_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q11730_ultrasonic_screwdriver_SpellScript)
PrepareSpellScript(spell_q11730_ultrasonic_screwdriver_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_004A8))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SENTRYBOT_57K))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_DEFENDOTANK_66D))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_005B6))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_55D_COLLECTATRON))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_ROBOT_KILL_CREDIT))
if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_004A8) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SENTRYBOT_57K) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_DEFENDOTANK_66D) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_005B6) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_55D_COLLECTATRON) || !sSpellMgr->GetSpellInfo(SPELL_ROBOT_KILL_CREDIT))
return false;
return true;
}
@@ -437,17 +437,9 @@ public:
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Item* castItem = GetCastItem();
if (!castItem)
return;
Unit* pCaster = GetCaster();
if (pCaster->GetTypeId() != TYPEID_PLAYER)
return;
Creature* target = GetHitCreature();
if (!target)
return;
Unit* caster = GetCaster();
if (Creature* target = GetHitCreature())
{
uint32 spellId = 0;
switch (target->GetEntry())
{
@@ -459,10 +451,11 @@ public:
default:
return;
}
pCaster->CastSpell(pCaster, spellId, true, castItem);
pCaster->CastSpell(pCaster, SPELL_ROBOT_KILL_CREDIT, true);
caster->CastSpell(caster, spellId, true, castItem);
caster->CastSpell(caster, SPELL_ROBOT_KILL_CREDIT, true);
target->DespawnOrUnsummon();
}
}
void Register()
{
@@ -478,7 +471,7 @@ public:
// http://www.wowhead.com/quest=12459 That Which Creates Can Also Destroy
// 49587 Seeds of Nature's Wrath
enum eQuest12459Data
enum Quest12459Data
{
NPC_REANIMATED_FROSTWYRM = 26841,
NPC_WEAK_REANIMATED_FROSTWYRM = 27821,
@@ -492,13 +485,13 @@ enum eQuest12459Data
class spell_q12459_seeds_of_natures_wrath : public SpellScriptLoader
{
public:
public:
spell_q12459_seeds_of_natures_wrath() : SpellScriptLoader("spell_q12459_seeds_of_natures_wrath") { }
class spell_q12459_seeds_of_natures_wrath_SpellScript : public SpellScript
{
public:
PrepareSpellScript(spell_q12459_seeds_of_natures_wrath_SpellScript)
PrepareSpellScript(spell_q12459_seeds_of_natures_wrath_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Creature* creatureTarget = GetHitCreature())
@@ -529,7 +522,7 @@ public:
// http://www.wowhead.com/quest=12634 Some Make Lemonade, Some Make Liquor
// 51840 Despawn Fruit Tosser
enum eQuest12634Data
enum Quest12634Data
{
SPELL_BANANAS_FALL_TO_GROUND = 51836,
SPELL_ORANGE_FALLS_TO_GROUND = 51837,
@@ -539,22 +532,16 @@ enum eQuest12634Data
class spell_q12634_despawn_fruit_tosser : public SpellScriptLoader
{
public:
public:
spell_q12634_despawn_fruit_tosser() : SpellScriptLoader("spell_q12634_despawn_fruit_tosser") { }
class spell_q12634_despawn_fruit_tosser_SpellScript : public SpellScript
{
public:
PrepareSpellScript(spell_q12634_despawn_fruit_tosser_SpellScript)
PrepareSpellScript(spell_q12634_despawn_fruit_tosser_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_BANANAS_FALL_TO_GROUND))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_ORANGE_FALLS_TO_GROUND))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_PAPAYA_FALLS_TO_GROUND))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ADVENTUROUS_DWARF))
if (!sSpellMgr->GetSpellInfo(SPELL_BANANAS_FALL_TO_GROUND) || !sSpellMgr->GetSpellInfo(SPELL_ORANGE_FALLS_TO_GROUND) || !sSpellMgr->GetSpellInfo(SPELL_PAPAYA_FALLS_TO_GROUND) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_ADVENTUROUS_DWARF))
return false;
return true;
}
@@ -589,22 +576,22 @@ public:
// 52308 Take Sputum Sample
class spell_q12683_take_sputum_sample : public SpellScriptLoader
{
public:
public:
spell_q12683_take_sputum_sample() : SpellScriptLoader("spell_q12683_take_sputum_sample") { }
class spell_q12683_take_sputum_sample_SpellScript : public SpellScript
{
public:
PrepareSpellScript(spell_q12683_take_sputum_sample_SpellScript)
PrepareSpellScript(spell_q12683_take_sputum_sample_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
uint32 reqAuraId = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
Unit* pCaster = GetCaster();
if (pCaster->HasAuraEffect(reqAuraId, 0))
Unit* caster = GetCaster();
if (caster->HasAuraEffect(reqAuraId, 0))
{
uint32 spellId = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
pCaster->CastSpell(pCaster, spellId, true, NULL);
caster->CastSpell(caster, spellId, true, NULL);
}
}
@@ -622,7 +609,7 @@ public:
// http://www.wowhead.com/quest=12851 Going Bearback
// 54798 FLAMING Arrow Triggered Effect
enum eQuest12851Data
enum Quest12851Data
{
NPC_FROSTGIANT = 29351,
NPC_FROSTWORG = 29358,
@@ -634,13 +621,13 @@ enum eQuest12851Data
class spell_q12851_going_bearback : public SpellScriptLoader
{
public:
public:
spell_q12851_going_bearback() : SpellScriptLoader("spell_q12851_going_bearback") { }
class spell_q12851_going_bearback_AuraScript : public AuraScript
{
public:
PrepareAuraScript(spell_q12851_going_bearback_AuraScript)
PrepareAuraScript(spell_q12851_going_bearback_AuraScript);
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
@@ -680,7 +667,7 @@ public:
// http://www.wowhead.com/quest=12937 Relief for the Fallen
// 55804 Healing Finished
enum eQuest12937Data
enum Quest12937Data
{
SPELL_TRIGGER_AID_OF_THE_EARTHEN = 55809,
NPC_FALLEN_EARTHEN_DEFENDER = 30035,
@@ -688,13 +675,18 @@ enum eQuest12937Data
class spell_q12937_relief_for_the_fallen : public SpellScriptLoader
{
public:
public:
spell_q12937_relief_for_the_fallen() : SpellScriptLoader("spell_q12937_relief_for_the_fallen") { }
class spell_q12937_relief_for_the_fallen_SpellScript : public SpellScript
{
public:
PrepareSpellScript(spell_q12937_relief_for_the_fallen_SpellScript)
PrepareSpellScript(spell_q12937_relief_for_the_fallen_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGER_AID_OF_THE_EARTHEN))
@@ -704,17 +696,14 @@ public:
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* pCaster = GetCaster();
if (Player* player = pCaster->ToPlayer())
{
Player* caster = GetCaster()->ToPlayer();
if (Creature* target = GetHitCreature())
{
player->CastSpell(player, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, NULL);
player->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, 0);
caster->CastSpell(caster, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, NULL);
caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, 0);
target->DespawnOrUnsummon();
}
}
}
void Register()
{
@@ -728,10 +717,8 @@ public:
}
};
enum eWhoarethey
enum Whoarethey
{
SPELL_QUESTGIVER = 48917,
SPELL_MALE_DISGUISE = 38080,
SPELL_FEMALE_DISGUISE = 38081,
SPELL_GENERIC_DISGUISE = 32756
@@ -748,7 +735,7 @@ class spell_q10041_q10040_who_are_they : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_QUESTGIVER))
if (!sSpellMgr->GetSpellInfo(SPELL_MALE_DISGUISE) || !sSpellMgr->GetSpellInfo(SPELL_FEMALE_DISGUISE) || !sSpellMgr->GetSpellInfo(SPELL_GENERIC_DISGUISE))
return false;
return true;
}
@@ -756,11 +743,11 @@ class spell_q10041_q10040_who_are_they : public SpellScriptLoader
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit() || !GetHitUnit()->ToPlayer())
return;
GetHitUnit()->CastSpell(GetHitUnit(), GetHitUnit()->getGender() == GENDER_MALE ? SPELL_MALE_DISGUISE : SPELL_FEMALE_DISGUISE, true);
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_GENERIC_DISGUISE, true);
if (Player* target = GetHitPlayer())
{
target->CastSpell(target, target->getGender() == GENDER_MALE ? SPELL_MALE_DISGUISE : SPELL_FEMALE_DISGUISE, true);
target->CastSpell(target, SPELL_GENERIC_DISGUISE, true);
}
}
void Register()
@@ -783,7 +770,7 @@ enum symboloflife
// 8593 Symbol of life dummy
class spell_symbol_of_life_dummy : public SpellScriptLoader
{
public:
public:
spell_symbol_of_life_dummy() : SpellScriptLoader("spell_symbol_of_life_dummy") { }
class spell_symbol_of_life_dummy_SpellScript : public SpellScript
@@ -819,27 +806,29 @@ public:
// http://www.wowhead.com/quest=12659 Scalps!
// 52090 Ahunae's Knife
enum eQuest12659Data
enum Quest12659Data
{
NPC_SCALPS_KC_BUNNY = 28622,
};
class spell_q12659_ahunaes_knife : public SpellScriptLoader
{
public:
public:
spell_q12659_ahunaes_knife() : SpellScriptLoader("spell_q12659_ahunaes_knife") { }
class spell_q12659_ahunaes_knife_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q12659_ahunaes_knife_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
if (!caster)
return;
if (Creature* target = GetTargetUnit()->ToCreature())
if (Creature* target = GetHitCreature())
{
target->ForcedDespawn();
caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0);
@@ -875,17 +864,22 @@ class spell_q9874_liquid_fire : public SpellScriptLoader
{
PrepareSpellScript(spell_q9874_liquid_fire_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
Creature* target = GetHitUnit()->ToCreature();
if (!caster || !target || (target && target->HasAura(SPELL_FLAMES)))
return;
if (Creature* target = GetHitCreature())
if (target && target->HasAura(SPELL_FLAMES))
{
caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT, 0);
target->CastSpell(target, SPELL_FLAMES, true);
target->DespawnOrUnsummon(60000);
}
}
void Register()
{
@@ -915,17 +909,21 @@ class spell_q12805_lifeblood_dummy : public SpellScriptLoader
{
PrepareSpellScript(spell_q12805_lifeblood_dummy_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
Creature* target = GetHitUnit()->ToCreature();
if (!caster || !target)
return;
if (Creature* target = GetHitCreature())
{
caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT, 0);
target->CastSpell(target, uint32(GetEffectValue()), true);
target->DespawnOrUnsummon(2000);
}
}
void Register()
{
@@ -945,19 +943,20 @@ class spell_q12805_lifeblood_dummy : public SpellScriptLoader
59643 Plant Horde Battle Standard
4338 Plant Alliance Battle Standard
*/
enum eBattleStandard
enum BattleStandard
{
NPC_KING_OF_THE_MOUNTAINT_KC = 31766,
};
class spell_q13280_13283_plant_battle_standard: public SpellScriptLoader
{
public:
public:
spell_q13280_13283_plant_battle_standard() : SpellScriptLoader("spell_q13280_13283_plant_battle_standard") { }
class spell_q13280_13283_plant_battle_standard_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q13280_13283_plant_battle_standard_SpellScript)
PrepareSpellScript(spell_q13280_13283_plant_battle_standard_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
@@ -988,7 +987,7 @@ enum ChumTheWaterSummons
class spell_q14112_14145_chum_the_water: public SpellScriptLoader
{
public:
public:
spell_q14112_14145_chum_the_water() : SpellScriptLoader("spell_q14112_14145_chum_the_water") { }
class spell_q14112_14145_chum_the_water_SpellScript : public SpellScript
@@ -997,13 +996,7 @@ public:
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SUMMON_ANGRY_KVALDIR))
return false;
if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_MAKO))
return false;
if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_THRESHER))
return false;
if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_BLUE_SHARK))
if (!sSpellMgr->GetSpellInfo(SUMMON_ANGRY_KVALDIR) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_MAKO) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_THRESHER) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_BLUE_SHARK))
return false;
return true;
}
@@ -1041,15 +1034,16 @@ class spell_q9452_cast_net: public SpellScriptLoader
class spell_q9452_cast_net_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q9452_cast_net_SpellScript)
PrepareSpellScript(spell_q9452_cast_net_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
if (!caster)
return;
switch (urand(0, 2))
{
case 0: case 1:
+36 -38
View File
@@ -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,12 +28,13 @@ 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:
public:
spell_rog_cheat_death() : SpellScriptLoader("spell_rog_cheat_death") { }
class spell_rog_cheat_death_AuraScript : public AuraScript
@@ -43,14 +43,11 @@ public:
uint32 absorbChance;
enum Spell
{
ROG_SPELL_CHEAT_DEATH_COOLDOWN = 31231,
};
bool Validate(SpellInfo const* /*spellEntry*/)
{
return sSpellMgr->GetSpellInfo(ROG_SPELL_CHEAT_DEATH_COOLDOWN);
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN))
return false;
return true;
}
bool Load()
@@ -67,16 +64,12 @@ public:
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))
Player* target = GetTarget()->ToPlayer();
if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN) || !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);
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);
@@ -104,7 +97,7 @@ public:
// 31130 - Nerves of Steel
class spell_rog_nerves_of_steel : public SpellScriptLoader
{
public:
public:
spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { }
class spell_rog_nerves_of_steel_AuraScript : public AuraScript
@@ -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,10 +309,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader
void HandleBeforeHit()
{
Unit* target = GetHitUnit();
if (!target)
return;
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();
@@ -324,9 +321,9 @@ class spell_rog_deadly_poison : public SpellScriptLoader
return;
Player* player = GetCaster()->ToPlayer();
Unit* target = GetHitUnit();
if (!target)
return;
if (Unit* target = GetHitUnit())
{
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
@@ -370,6 +367,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader
}
}
}
}
void Register()
{
+243 -15
View File
@@ -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,7 +116,8 @@ class spell_sha_fire_nova : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* caster = GetCaster())
{
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
if (uint32 spellId = sSpellMgr->GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank))
{
@@ -128,6 +126,7 @@ class spell_sha_fire_nova : public SpellScriptLoader
caster->CastSpell(totem, spellId, true);
}
}
}
void Register()
{
@@ -154,16 +153,14 @@ 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* caster = GetCaster())
if (Unit* unitTarget = GetHitUnit())
{
if (unitTarget->getPowerType() == POWER_MANA)
@@ -204,16 +201,14 @@ 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* target = GetTarget())
if (Unit* caster = aurEff->GetBase()->GetCaster())
if (TempSummon* summon = caster->ToTempSummon())
if (Unit* owner = summon->GetOwner())
@@ -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();
}
+148 -14
View File
@@ -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,6 +283,7 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
void FilterTargets(std::list<Unit*>& unitList)
{
if (GetTargetUnit())
unitList.remove(GetTargetUnit());
}
@@ -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();
}
+281 -13
View File
@@ -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,6 +76,7 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader
void FilterTargets(std::list<Unit*>& unitList)
{
if (GetCaster())
unitList.remove(GetCaster());
}
@@ -115,24 +118,20 @@ public:
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
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) ||
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))
return;
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();
}