Merge branch 'master' into 310

Conflicts:
	src/game/GameObject.cpp
This commit is contained in:
tomrus88 2009-03-18 07:45:29 +03:00
commit 9d2acc22b4
47 changed files with 1772 additions and 1246 deletions

View file

@ -39,6 +39,7 @@
#include "Formulas.h"
#include "BattleGround.h"
#include "CreatureAI.h"
#include "ScriptCalls.h"
#include "Util.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
@ -1442,7 +1443,7 @@ void Aura::TriggerSpell()
caster->ModifyPower( POWER_MANA, mana );
caster->SendEnergizeSpellLog(caster, 23493, mana, POWER_MANA);
}
break;
return;
}
// // Stoneclaw Totem Passive TEST
// case 23792: break;
@ -1510,8 +1511,11 @@ void Aura::TriggerSpell()
// case 28522: break;
// // Silithyst
// case 29519: break;
// // Inoculate Nestlewood Owlkin
case 29528: trigger_spell_id = 28713; break;
// Inoculate Nestlewood Owlkin
case 29528:
if(target->GetTypeId()!=TYPEID_UNIT)// prevent error reports in case ignored player target
return;
break;
// // Overload
// case 29768: break;
// // Return Fire
@ -1553,7 +1557,6 @@ void Aura::TriggerSpell()
creature->SetHealth(0); // just for nice GM-mode view
}
return;
break;
}
// Quake
case 30576: trigger_spell_id = 30571; break;
@ -1934,13 +1937,9 @@ void Aura::TriggerSpell()
default:
break;
}
// Reget trigger spell proto
triggeredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id);
if(triggeredSpellInfo == NULL)
{
sLog.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
return;
}
}
else
{
@ -1992,8 +1991,12 @@ void Aura::TriggerSpell()
}
}
}
// All ok cast by default case
caster->CastSpell(target, triggeredSpellInfo, true, 0, this);
if(triggeredSpellInfo)
caster->CastSpell(target, triggeredSpellInfo, true, 0, this);
else if(target->GetTypeId()!=TYPEID_UNIT || !Script->EffectDummyCreature(caster, GetId(), GetEffIndex(), (Creature*)target))
sLog.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
}
void Aura::TriggerSpellWithValue()
@ -2261,6 +2264,45 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
}
case SPELLFAMILY_DRUID:
{
switch(GetId())
{
case 34246: // Idol of the Emerald Queen
{
if (m_target->GetTypeId() != TYPEID_PLAYER)
return;
if(apply)
{
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_DOT;
mod->value = m_modifier.m_amount/7;
mod->type = SPELLMOD_FLAT;
mod->spellId = GetId();
mod->mask = 0x001000000000LL;
mod->mask2= 0LL;
m_spellmod = mod;
}
((Player*)m_target)->AddSpellMod(m_spellmod, apply);
return;
}
case 61336: // Survival Instincts
{
if(apply)
{
if (!m_target->IsInFeralForm())
return;
int32 bp0 = int32(m_target->GetMaxHealth() * m_modifier.m_amount / 100);
m_target->CastCustomSpell(m_target, 50322, &bp0, NULL, NULL, true);
}
else
m_target-> RemoveAurasDueToSpell(50322);
return;
}
}
// Lifebloom
if ( GetSpellProto()->SpellFamilyFlags & 0x1000000000LL )
{
@ -2300,25 +2342,6 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
((Player*)m_target)->UpdateAttackPowerAndDamage();
return;
}
// Idol of the Emerald Queen
if ( GetId() == 34246 && m_target->GetTypeId()==TYPEID_PLAYER )
{
if(apply)
{
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_DOT;
mod->value = m_modifier.m_amount/7;
mod->type = SPELLMOD_FLAT;
mod->spellId = GetId();
mod->mask = 0x001000000000LL;
mod->mask2= 0LL;
m_spellmod = mod;
}
((Player*)m_target)->AddSpellMod(m_spellmod, apply);
return;
}
break;
}
case SPELLFAMILY_HUNTER:
@ -3329,7 +3352,7 @@ void Aura::HandleAuraModDisarm(bool apply, bool Real)
return;
// main-hand attack speed already set to special value for feral form already and don't must change and reset at remove.
if (((Player *)m_target)->IsInFeralForm())
if (m_target->IsInFeralForm())
return;
if (apply)
@ -4693,6 +4716,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real)
case 28726: // Nightmare Seed ( Nightmare Seed )
case 34511: // Valor (Bulwark of Kings, Bulwark of the Ancient Kings)
case 44055: // Tremendous Fortitude (Battlemaster's Alacrity)
case 50322: // Survival Instincts
{
if(Real)
{
@ -5924,6 +5948,15 @@ void Aura::PeriodicTick()
}
case SPELL_AURA_PERIODIC_MANA_LEECH:
{
if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
return;
Powers power = Powers(m_modifier.m_miscvalue);
// power type might have changed between aura applying and tick (druid's shapeshift)
if(m_target->getPowerType() != power)
return;
Unit *pCaster = GetCaster();
if(!pCaster)
return;
@ -5942,18 +5975,20 @@ void Aura::PeriodicTick()
// ignore non positive values (can be result apply spellmods to aura damage
uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
// Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
// It's mana percent cost spells, m_modifier.m_amount is percent drain from target
if (m_spellProto->ManaCostPercentage)
{
// max value
uint32 maxmana = pCaster->GetMaxPower(power) * pdamage * 2 / 100;
pdamage = m_target->GetMaxPower(power) * pdamage / 100;
if(pdamage > maxmana)
pdamage = maxmana;
}
sLog.outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId());
if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
break;
Powers power = Powers(m_modifier.m_miscvalue);
// power type might have changed between aura applying and tick (druid's shapeshift)
if(m_target->getPowerType() != power)
break;
int32 drain_amount = m_target->GetPower(power) > pdamage ? pdamage : m_target->GetPower(power);
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)