[svn] Fix a compile error about M_PI_2.

Update Felmyst script to test new setActive function.
Fix the bug that priest's fear is unbreakable (dirty hack before find the correct way).
(some unfinished unused content included, just ignore them, will finish them later)

--HG--
branch : trunk
This commit is contained in:
megamage
2008-10-27 10:57:53 -05:00
parent 1bb1603592
commit 4cbc6f830a
7 changed files with 156 additions and 61 deletions

View File

@@ -157,15 +157,17 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI
Timer[EVENT_BERSERK] = 600000;
FlightCount = 0;
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT);
m_creature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10);
m_creature->SetFloatValue(UNIT_FIELD_COMBATREACH, 10);
DespawnSummons(MOB_VAPOR_TRAIL);
m_creature->setActive(false);
}
void Aggro(Unit *who)
{
m_creature->setActive(true);
DoZoneInCombat();
m_creature->CastSpell(m_creature, AURA_SUNWELL_RADIANCE, true);
m_creature->CastSpell(m_creature, AURA_NOXIOUS_FUMES, true);
@@ -282,20 +284,18 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI
m_creature->AttackStop();
m_creature->GetMotionMaster()->Clear(false);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING);
m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT);
m_creature->StopMoving();
DoYell(YELL_TAKEOFF, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_TAKEOFF);
Timer[EVENT_FLIGHT_SEQUENCE] = 2000;
break;
case 1:
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
m_creature->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX()+1, m_creature->GetPositionY(), m_creature->GetPositionZ()+10);
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
Timer[EVENT_FLIGHT_SEQUENCE] = 0;
break;
case 2:
if(Player* target = SelectRandomPlayer(50))
if(Player* target = SelectRandomPlayer(150))
{
Creature* Vapor = m_creature->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
if(Vapor)
@@ -311,7 +311,7 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI
case 3:
DespawnSummons(MOB_VAPOR_TRAIL);
//m_creature->CastSpell(m_creature, SPELL_VAPOR_SELECT); need core support
if(Player* target = SelectRandomPlayer(50))
if(Player* target = SelectRandomPlayer(150))
{
//target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support
Creature* Vapor = m_creature->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
@@ -330,15 +330,13 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI
Timer[EVENT_FLIGHT_SEQUENCE] = 1;
break;
case 5:
if(Player* target = SelectRandomPlayer(80))
if(Player* target = SelectRandomPlayer(150))
{
BreathX = target->GetPositionX();
BreathY = target->GetPositionY();
float x, y, z;
target->GetContactPoint(m_creature, x, y, z, 40);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
target->GetContactPoint(m_creature, x, y, z, 70);
m_creature->GetMotionMaster()->MovePoint(0, x, y, z+10);
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
}else EnterEvadeMode();
Timer[EVENT_FLIGHT_SEQUENCE] = 0;
break;
@@ -355,9 +353,7 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI
m_creature->GetPosition(x, y, z);
x = 2 * BreathX - x;
y = 2 * BreathY - y;
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
m_creature->GetMotionMaster()->MovePoint(0, x, y, z);
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
}
Timer[EVENT_SUMMON_FOG] = 1;
Timer[EVENT_FLIGHT_SEQUENCE] = 0;
@@ -374,14 +370,12 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI
{
float x, y, z;
target->GetContactPoint(m_creature, x, y, z);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
m_creature->GetMotionMaster()->MovePoint(0, x, y, z);
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
}else EnterEvadeMode();
Timer[EVENT_FLIGHT_SEQUENCE] = 0;
break;
case 10:
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT);
m_creature->StopMoving();
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
EnterPhase(PHASE_GROUND);
@@ -439,7 +433,7 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI
Timer[EVENT_GAS_NOVA] = 20000 + rand()%5 * 1000;
break;
case EVENT_ENCAPSULATE:
if(Unit* target = SelectRandomPlayer(50))
if(Unit* target = SelectRandomPlayer(150))
{
m_creature->CastSpell(target, SPELL_ENCAPSULATE_CHANNEL, false);
target->CastSpell(target, SPELL_ENCAPSULATE_EFFECT, true);// linked aura, need core patch to remove this hack

View File

@@ -1537,5 +1537,5 @@ void WorldObject::GetRandomContactPoint( const WorldObject* obj, float &x, float
float angle_offset_ratio = 1 - object_size/12.0f;
if (angle_offset_ratio < 0.05) angle_offset_ratio = 0.05;
// angle to face `obj` to `this`plus a random angle offset(from -90 degree to 90 degree)*angle_offset_ratio using distance from distance2dMin to distance2dMax includes size of `obj`
GetNearPoint(obj,x,y,z,object_size,distance2dMin+(distance2dMax-distance2dMin)*rand_norm(), GetAngle( obj ) + (M_PI_2 - M_PI * rand_norm()) * angle_offset_ratio);
GetNearPoint(obj,x,y,z,object_size,distance2dMin+(distance2dMax-distance2dMin)*rand_norm(), GetAngle( obj ) + (M_PI/2 - M_PI * rand_norm()) * angle_offset_ratio);
}

View File

@@ -1228,7 +1228,7 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const u
TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
}
if(!spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_MAX_TARGETS))
if(!spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_MAX_TARGETS))
{
TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
@@ -1357,7 +1357,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
case TARGET_ALL_AROUND_CASTER:
{
if(!unMaxTargets)
unMaxTargets = spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_MAX_TARGETS);
unMaxTargets = spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_MAX_TARGETS);
m_caster->GetPosition(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ);
}break;
case TARGET_CURRENT_ENEMY_COORDINATES:
@@ -1423,7 +1423,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
case TARGET_IN_FRONT_OF_CASTER:
case TARGET_UNIT_CONE_ENEMY_UNKNOWN:
{
switch(spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_CONE_TYPE))
switch(spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_CONE_TYPE))
{
default:
case 0:

View File

@@ -312,7 +312,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)
}
// Meteor like spells (divided damage to targets)
if(spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_SHARE_DAMAGE))
if(spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_SHARE_DAMAGE))
{
uint32 count = 0;
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)

View File

@@ -1969,29 +1969,31 @@ void SpellMgr::LoadSpellPetAuras()
}
// set data in core for now
void SpellMgr::LoadSpellExtraInfo()
void SpellMgr::LoadSpellExtraAttr()
{
SpellExtraInfo info;
info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 0;
info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 0;
info.info[SPELL_EXTRA_INFO_SHARE_DAMAGE] = 0;
SpellExtraAttribute tempAttr;
tempAttr.attr[SPELL_EXTRA_ATTR_CONE_TYPE] = 0;
tempAttr.attr[SPELL_EXTRA_ATTR_MAX_TARGETS] = 0;
tempAttr.attr[SPELL_EXTRA_ATTR_SHARE_DAMAGE] = 0;
info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 1;
SpellEntry const* tempSpell;
for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
tempAttr.attr[SPELL_EXTRA_ATTR_CONE_TYPE] = 1;
{
tempSpell = GetSpellStore()->LookupEntry(i);
if(tempSpell && tempSpell->SpellVisual == 3879)
mSpellExtraInfoMap[tempSpell->Id] = info;
SpellEntry const* tempSpell;
for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
{
tempSpell = GetSpellStore()->LookupEntry(i);
if(tempSpell && tempSpell->SpellVisual == 3879)
mSpellExtraAttrMap[tempSpell->Id] = tempAttr;
}
}
info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 2;
mSpellExtraInfoMap[26029] = info; // dark glare
mSpellExtraInfoMap[37433] = info; // spout
mSpellExtraInfoMap[43140] = info; // flame breath
mSpellExtraInfoMap[43215] = info; // flame breath
info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 0;
tempAttr.attr[SPELL_EXTRA_ATTR_CONE_TYPE] = 2;
mSpellExtraAttrMap[26029] = tempAttr; // dark glare
mSpellExtraAttrMap[37433] = tempAttr; // spout
mSpellExtraAttrMap[43140] = tempAttr; // flame breath
mSpellExtraAttrMap[43215] = tempAttr; // flame breath
tempAttr.attr[SPELL_EXTRA_ATTR_CONE_TYPE] = 0;
info.info[SPELL_EXTRA_INFO_SHARE_DAMAGE] = 1;
tempAttr.attr[SPELL_EXTRA_ATTR_SHARE_DAMAGE] = 1;
for(uint32 i = 0; i < 46000; ++i)
{
switch(i)
@@ -2004,15 +2006,15 @@ void SpellMgr::LoadSpellExtraInfo()
case 40810: case 43267: case 43268: // Saber Lash
case 42384: // Brutal Swipe
case 45150: // Meteor Slash
mSpellExtraInfoMap[i] = info;
mSpellExtraAttrMap[i] = tempAttr;
break;
default:
break;
}
}
info.info[SPELL_EXTRA_INFO_SHARE_DAMAGE] = 0;
tempAttr.attr[SPELL_EXTRA_ATTR_SHARE_DAMAGE] = 0;
info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 1;
tempAttr.attr[SPELL_EXTRA_ATTR_MAX_TARGETS] = 1;
for(uint32 i = 0; i < 46000; ++i)
{
switch(i)
@@ -2021,15 +2023,101 @@ void SpellMgr::LoadSpellExtraInfo()
case 45004: case 45006: case 45010: // Wild Magic
case 31347: // Doom
case 41635: // Prayer of Mending
mSpellExtraInfoMap[i] = info;
mSpellExtraAttrMap[i] = tempAttr;
break;
default:
break;
}
}
info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 3;
mSpellExtraInfoMap[41376] = info; //Spite
info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 0;
tempAttr.attr[SPELL_EXTRA_ATTR_MAX_TARGETS] = 3;
mSpellExtraAttrMap[41376] = tempAttr; //Spite
tempAttr.attr[SPELL_EXTRA_ATTR_MAX_TARGETS] = 0;
//hack here, only for those strange exceptions!
// Psychic Scream
SpellEntry *tempSpell;
if(tempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(8122))
tempSpell->AttributesEx |= SPELL_ATTR_BREAKABLE_BY_DAMAGE;
if(tempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(8124))
tempSpell->AttributesEx |= SPELL_ATTR_BREAKABLE_BY_DAMAGE;
if(tempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(10888))
tempSpell->AttributesEx |= SPELL_ATTR_BREAKABLE_BY_DAMAGE;
if(tempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(10890))
tempSpell->AttributesEx |= SPELL_ATTR_BREAKABLE_BY_DAMAGE;
}
void SpellMgr::LoadSpellLinked()
{
mSpellLinkedMap.clear(); // need for reload case
uint32 count = 0;
// 0 1
QueryResult *result = WorldDatabase.Query("SELECT spell0, spell1 FROM spell_linked_spell");
if( !result )
{
barGoLink bar( 1 );
bar.step();
sLog.outString();
sLog.outString( ">> Loaded %u spell pet auras", count );
return;
}
barGoLink bar( result->GetRowCount() );
do
{
Field *fields = result->Fetch();
bar.step();
uint16 spell = fields[0].GetUInt16();
uint16 pet = fields[1].GetUInt16();
uint16 aura = fields[2].GetUInt16();
SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find(spell);
if(itr != mSpellPetAuraMap.end())
{
itr->second.AddAura(pet, aura);
}
else
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
if (!spellInfo)
{
sLog.outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell);
continue;
}
int i = 0;
for(; i < 3; ++i)
if((spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DUMMY) ||
spellInfo->Effect[i] == SPELL_EFFECT_DUMMY)
break;
if(i == 3)
{
sLog.outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell);
continue;
}
SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(aura);
if (!spellInfo2)
{
sLog.outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura);
continue;
}
PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[i] == TARGET_PET, spellInfo->EffectBasePoints[i] + spellInfo->EffectBaseDice[i]);
mSpellPetAuraMap[spell] = pa;
}
++count;
} while( result->NextRow() );
delete result;
sLog.outString();
sLog.outString( ">> Loaded %u spell pet auras", count );
}
/// Some checks for spells, to prevent adding depricated/broken spells for trainers, spell book, etc

View File

@@ -634,19 +634,21 @@ inline bool IsProfessionSkill(uint32 skill)
return IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING || skill == SKILL_FIRST_AID;
}
enum SpellExtraInfoType
enum SpellExtraAttributeType
{
SPELL_EXTRA_INFO_MAX_TARGETS,
SPELL_EXTRA_INFO_CONE_TYPE,
SPELL_EXTRA_INFO_SHARE_DAMAGE
SPELL_EXTRA_ATTR_MAX_TARGETS,
SPELL_EXTRA_ATTR_CONE_TYPE,
SPELL_EXTRA_ATTR_SHARE_DAMAGE
};
struct SpellExtraInfo
struct SpellExtraAttribute
{
uint32 info[3];
uint32 attr[3];
};
typedef std::map<uint32, SpellExtraInfo> SpellExtraInfoMap;
typedef std::map<uint32, SpellExtraAttribute> SpellExtraAttrMap;
typedef std::map<int32, int32> SpellLinkedMap;
class SpellMgr
{
@@ -846,11 +848,20 @@ class SpellMgr
return NULL;
}
uint32 GetSpellExtraInfo(uint32 spell_id, uint32 type) const
uint32 GetSpellExtraAttr(uint32 spell_id, uint32 type) const
{
SpellExtraInfoMap::const_iterator itr = mSpellExtraInfoMap.find(spell_id);
if(itr != mSpellExtraInfoMap.end())
return itr->second.info[type];
SpellExtraAttrMap::const_iterator itr = mSpellExtraAttrMap.find(spell_id);
if(itr != mSpellExtraAttrMap.end())
return itr->second.attr[type];
else
return 0;
}
int32 GetSpellLinked(int32 spell_id) const
{
SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id);
if(itr != mSpellLinkedMap.end())
return itr->second;
else
return 0;
}
@@ -871,7 +882,8 @@ class SpellMgr
void LoadSpellThreats();
void LoadSkillLineAbilityMap();
void LoadSpellPetAuras();
void LoadSpellExtraInfo();
void LoadSpellExtraAttr();
void LoadSpellLinked();
private:
SpellScriptTarget mSpellScriptTarget;
@@ -885,7 +897,8 @@ class SpellMgr
SpellProcEventMap mSpellProcEventMap;
SkillLineAbilityMap mSkillLineAbilityMap;
SpellPetAuraMap mSpellPetAuraMap;
SpellExtraInfoMap mSpellExtraInfoMap;
SpellExtraAttrMap mSpellExtraAttrMap;
SpellLinkedMap mSpellLinkedMap;
};
#define spellmgr SpellMgr::Instance()

View File

@@ -1093,8 +1093,8 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading spell pet auras..." );
spellmgr.LoadSpellPetAuras();
sLog.outString( "Loading spell extra infos...(TODO)" );
spellmgr.LoadSpellExtraInfo();
sLog.outString( "Loading spell extra attributes...(TODO)" );
spellmgr.LoadSpellExtraAttr();
sLog.outString( "Loading player Create Info & Level Stats..." );
objmgr.LoadPlayerInfo();