Core/Spells: convert some spell effects to SpellScripts

This commit is contained in:
joschiwald
2012-05-28 04:07:51 +02:00
parent 58f63509cd
commit ca07f30d03
26 changed files with 1099 additions and 455 deletions
@@ -777,33 +777,18 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load)
m_amplitude = 1 * IN_MILLISECONDS;
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_PERIODIC_ENERGIZE:
case SPELL_AURA_OBS_MOD_HEALTH:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
case SPELL_AURA_PERIODIC_ENERGIZE:
case SPELL_AURA_PERIODIC_LEECH:
case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
case SPELL_AURA_PERIODIC_MANA_LEECH:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
case SPELL_AURA_POWER_BURN:
m_isPeriodic = true;
break;
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
if (GetId() == 51912)
m_amplitude = 3000;
m_isPeriodic = true;
break;
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
case SPELL_AURA_PERIODIC_DUMMY:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
m_isPeriodic = true;
break;
case SPELL_AURA_DUMMY:
// Haunting Spirits - perdiodic trigger demon
if (GetId() == 7057)
{
m_isPeriodic = true;
m_amplitude = irand (0, 60) + 30;
m_amplitude *= IN_MILLISECONDS;
}
break;
default:
break;
}
@@ -1099,14 +1084,6 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
{
switch (GetAuraType())
{
case SPELL_AURA_DUMMY:
// Haunting Spirits
if (GetId() == 7057)
{
m_amplitude = irand (0, 60) + 30;
m_amplitude *= IN_MILLISECONDS;
}
break;
case SPELL_AURA_PERIODIC_DUMMY:
switch (GetSpellInfo()->SpellFamilyName)
{
@@ -1308,11 +1285,6 @@ void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster)
case SPELL_AURA_POWER_BURN:
HandlePeriodicPowerBurnAuraTick(target, caster);
break;
case SPELL_AURA_DUMMY:
// Haunting Spirits
if (GetId() == 7057)
target->CastSpell((Unit*)NULL, GetAmount(), true);
break;
default:
break;
}
@@ -4804,38 +4776,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (Unit* spellTarget = ObjectAccessor::GetUnit(*target, target->ToPlayer()->GetComboTarget()))
target->CastSpell(spellTarget, 51699, true);
break;
case 28832: // Mark of Korth'azz
case 28833: // Mark of Blaumeux
case 28834: // Mark of Rivendare
case 28835: // Mark of Zeliek
if (caster) // actually we can also use cast(this, originalcasterguid)
{
int32 damage;
switch (GetBase()->GetStackAmount())
{
case 1: damage = 0; break;
case 2: damage = 500; break;
case 3: damage = 1000; break;
case 4: damage = 1500; break;
case 5: damage = 4000; break;
case 6: damage = 12000; break;
default:damage = 20000 + 1000 * (GetBase()->GetStackAmount() - 7); break;
}
if (damage)
caster->CastCustomSpell(28836, SPELLVALUE_BASE_POINT0, damage, target);
}
break;
case 63322: // Saronite Vapors
{
if (caster)
{
int32 mana = int32(GetAmount() * pow(2.0f, GetBase()->GetStackAmount())); // mana restore - bp * 2^stackamount
int32 damage = mana * 2; // damage
caster->CastCustomSpell(target, 63337, &mana, NULL, NULL, true);
caster->CastCustomSpell(target, 63338, &damage, NULL, NULL, true);
}
break;
}
case 71563:
if (Aura* newAura = target->AddAura(71564, target))
newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount);
@@ -4929,57 +4869,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
break;
}
break;
case SPELLFAMILY_MAGE:
// Living Bomb
if (m_spellInfo->SpellFamilyFlags[1] & 0x20000)
{
AuraRemoveMode removeMode = aurApp->GetRemoveMode();
if (caster && (removeMode == AURA_REMOVE_BY_ENEMY_SPELL || removeMode == AURA_REMOVE_BY_EXPIRE))
caster->CastSpell(target, GetAmount(), true);
}
break;
case SPELLFAMILY_PRIEST:
// Vampiric Touch
if (m_spellInfo->SpellFamilyFlags[1] & 0x0400 && aurApp->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL && GetEffIndex() == 0)
if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
{
int32 damage = aurEff->GetAmount() * 8;
// backfire damage
target->CastCustomSpell(target, 64085, &damage, NULL, NULL, true, NULL, NULL, GetCasterGUID());
}
break;
case SPELLFAMILY_WARLOCK:
// Haunt
if (m_spellInfo->SpellFamilyFlags[1] & 0x40000)
if (caster)
target->CastCustomSpell(caster, 48210, &m_amount, 0, 0, true, NULL, this, GetCasterGUID());
break;
case SPELLFAMILY_DRUID:
// Lifebloom
if (GetSpellInfo()->SpellFamilyFlags[1] & 0x10)
{
// Final heal only on duration end
if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
// final heal
int32 stack = GetBase()->GetStackAmount();
int32 heal = m_amount;
if (caster)
{
heal = caster->SpellHealingBonusDone(target, GetSpellInfo(), heal, HEAL, stack);
heal = target->SpellHealingBonusTaken(GetSpellInfo(), heal, HEAL, stack);
}
target->CastCustomSpell(target, 33778, &heal, &stack, NULL, true, NULL, this, GetCasterGUID());
// restore mana
if (caster)
{
int32 returnmana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, this, GetCasterGUID());
}
}
break;
case SPELLFAMILY_DEATHKNIGHT:
// Summon Gargoyle (Dismiss Gargoyle at remove)
if (GetId() == 61777)
@@ -5087,16 +4976,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
}
break;
}
case 57723: // Exhaustion
case 57724: // Sated
{
switch (GetId())
{
case 57723: target->ApplySpellImmune(GetId(), IMMUNITY_ID, 32182, apply); break; // Heroism
case 57724: target->ApplySpellImmune(GetId(), IMMUNITY_ID, 2825, apply); break; // Bloodlust
}
break;
}
case 57819: // Argent Champion
case 57820: // Ebon Champion
case 57821: // Champion of the Kirin Tor
@@ -5884,14 +5763,6 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
if (caster)
caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, NULL, this);
return;
// Detonate Mana
case 27819:
if (int32 mana = (int32)(target->GetMaxPower(POWER_MANA) / 10))
{
mana = target->ModifyPower(POWER_MANA, -mana);
target->CastCustomSpell(27820, SPELLVALUE_BASE_POINT0, -mana*10, target, true, NULL, this);
}
return;
// Inoculate Nestlewood Owlkin
case 29528:
if (target->GetTypeId() != TYPEID_UNIT) // prevent error reports in case ignored player target