Core/Spells: More research on SPELL_ATTR6_ONLY_CAST_WHILE_POSSESSED and implement new research (original caster should be charmer or owner) and implement QAston's earlier research (only castable while possessed).

This commit is contained in:
Machiavelli
2011-08-18 20:24:46 +02:00
parent b4ee9ebfc8
commit 917ffdffac
4 changed files with 25 additions and 29 deletions

View File

@@ -497,7 +497,7 @@ enum SpellAttr6
SPELL_ATTR6_UNK15 = 0x00008000, // 15 not set in 3.0.3
SPELL_ATTR6_UNK16 = 0x00010000, // 16
SPELL_ATTR6_UNK17 = 0x00020000, // 17
SPELL_ATTR6_ONLY_CAST_WHILE_POSSESSED = 0x00040000, // 18 (NYI) client won't allow to cast these spells when unit does not have possessor
SPELL_ATTR6_ONLY_CAST_WHILE_POSSESSED = 0x00040000, // 18 client won't allow to cast these spells when unit is not possessed && charmer of caster will be original caster
SPELL_ATTR6_UNK19 = 0x00080000, // 19
SPELL_ATTR6_UNK20 = 0x00100000, // 20
SPELL_ATTR6_CLIENT_UI_TARGET_EFFECTS = 0x00200000, // 21 it's only client-side attribute

View File

@@ -5609,20 +5609,17 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
{
case 54798: // FLAMING Arrow Triggered Effect
{
if (!caster || !target || !target->ToCreature() || !caster->IsVehicle() || target->HasAura(54683))
if (!caster || !target || !target->ToCreature() || !caster->GetVehicle() || target->HasAura(54683))
break;
if (Unit* rider = caster->GetVehicleKit()->GetPassenger(0))
{
target->CastSpell(target, 54683, true);
target->CastSpell(target, 54683, true);
// Credit Frostworgs
if (target->GetEntry() == 29358)
rider->CastSpell(rider, 54896, true);
// Credit Frost Giants
else if (target->GetEntry() == 29351)
rider->CastSpell(rider, 54893, true);
}
// Credit Frostworgs
if (target->GetEntry() == 29358)
caster->CastSpell(caster, 54896, true);
// Credit Frost Giants
else if (target->GetEntry() == 29351)
caster->CastSpell(caster, 54893, true);
break;
}
case 62292: // Blaze (Pool of Tar)

View File

@@ -498,6 +498,8 @@ m_caster(caster), m_spellValue(new SpellValue(m_spellInfo))
if (originalCasterGUID)
m_originalCasterGUID = originalCasterGUID;
else if (info->AttributesEx6 & SPELL_ATTR6_ONLY_CAST_WHILE_POSSESSED)
m_originalCasterGUID = m_caster->GetCharmerOrOwnerGUID();
else
m_originalCasterGUID = m_caster->GetGUID();
@@ -506,7 +508,8 @@ m_caster(caster), m_spellValue(new SpellValue(m_spellInfo))
else
{
m_originalCaster = ObjectAccessor::GetUnit(*m_caster, m_originalCasterGUID);
if (m_originalCaster && !m_originalCaster->IsInWorld()) m_originalCaster = NULL;
if (m_originalCaster && !m_originalCaster->IsInWorld())
m_originalCaster = NULL;
}
m_spellState = SPELL_STATE_NULL;
@@ -4743,6 +4746,11 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_DONT_REPORT;
}
//! Client checks this already
if (m_spellInfo->AttributesEx6 & SPELL_ATTR6_ONLY_CAST_WHILE_POSSESSED && !m_caster->GetCharmerOrOwnerGUID())
return SPELL_FAILED_DONT_REPORT;
Unit* target = m_targets.GetUnitTarget();
// In pure self-cast spells, the client won't send any unit target
if (!target && (m_targets.GetTargetMask() == TARGET_FLAG_SELF || m_targets.GetTargetMask() & TARGET_FLAG_UNIT_ALLY)) // TARGET_FLAG_SELF == 0, remember!

View File

@@ -5062,27 +5062,18 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
m_caster->ToPlayer()->learnSpell(discoveredSpell, false);
return;
}
case 62428: // Load into Catapult
{
if (Vehicle* seat = m_caster->GetVehicleKit())
if (Unit* passenger = seat->GetPassenger(0))
if (Unit* demolisher = m_caster->GetVehicleBase())
passenger->CastSpell(demolisher, damage, true);
return;
}
case 62482: // Grab Crate
{
if (unitTarget)
{
if (Vehicle* seat = m_caster->GetVehicleKit())
if (Unit* seat = m_caster->GetVehicleBase())
{
if (Unit* passenger = seat->GetPassenger(1))
if (Creature* oldContainer = passenger->ToCreature())
oldContainer->DisappearAndDie();
// TODO: a hack, range = 11, should after some time cast, otherwise too far
m_caster->CastSpell(seat->GetBase(), 62496, true);
unitTarget->EnterVehicle(m_caster, 1);
if (Unit* parent = seat->GetVehicleBase())
{
// TODO: a hack, range = 11, should after some time cast, otherwise too far
m_caster->CastSpell(parent, 62496, true);
unitTarget->CastSpell(parent, m_spellInfo->Effects[EFFECT_0].CalcValue());
}
}
}
return;