[svn] Continue the work of rewriting spell target selection functions (warning: this may cause some spells broken).

Add some spell_script_target.
Delete some workaround in scripts (since core provides spell support now).

--HG--
branch : trunk
This commit is contained in:
megamage
2008-10-25 10:37:28 -05:00
parent e22427d4b0
commit 43436c8f30
7 changed files with 542 additions and 767 deletions

View File

@@ -0,0 +1,8 @@
INSERT INTO `spell_script_target` VALUES ('30531', '1', '17256');
INSERT INTO `spell_script_target` VALUES ('41455', '1', '22949');
INSERT INTO `spell_script_target` VALUES ('41455', '1', '22950');
INSERT INTO `spell_script_target` VALUES ('41455', '1', '22951');
INSERT INTO `spell_script_target` VALUES ('41455', '1', '22952');
INSERT INTO `spell_script_target` VALUES ('42471', '1', '23817');
INSERT INTO `spell_script_target` VALUES ('43734', '1', '23817');
INSERT INTO `spell_script_target` VALUES ('42631', '1', '23920');

View File

@@ -96,6 +96,7 @@ EndScriptData */
#define SPELL_DUAL_WIELD 42459
//Phase Normal spells
#define SPELL_FLAME_CRASH_EFFECT 40836 // Firey blue ring of circle that the other flame crash summons
#define SPELL_SUMMON_SHADOWDEMON 41117 // Summon four shadowfiends
#define SPELL_SHADOWFIEND_PASSIVE 41913 // Passive aura for shadowfiends
#define SPELL_SHADOW_DEMON_PASSIVE 41079 // Adds the "shadowform" aura to Shadow Demons.
#define SPELL_CONSUME_SOUL 41080 // Once the Shadow Demons reach their target, they use this to kill them
@@ -385,13 +386,18 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
void Reset();
void JustSummoned(Creature* summon)//, TempSummonType type)
void JustSummoned(Creature* summon)
{
if(summon->GetCreatureInfo()->Entry == FLAME_CRASH)
if(summon->GetCreatureInfo()->Entry == SHADOW_DEMON)
{
// type = TEMPSUMMON_TIMED_DESPAWN;
Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target && target->GetTypeId() == TYPEID_PLAYER) // only on players.
{
summon->AddThreat(target, 5000000.0f);
summon->AI()->AttackStart(target);
}
DoZoneInCombat(summon);
}
//error_log("justsummoned %d %d", summon->GetCreatureInfo()->Entry, summon->GetGUID());
}
void SummonedCreatureDespawn(Creature* summon)
@@ -558,25 +564,6 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
void CastEyeBlast();
void SummonFlamesOfAzzinoth();
void SummonMaiev();
void SummonShadowDemon()
{
Creature* ShadowDemon = NULL;
Unit* target = NULL;
for(uint8 i = 0; i < 4; i++)
{
ShadowDemon = DoSpawnCreature(SHADOW_DEMON, 0,0,0,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,25000);
if(ShadowDemon)
{
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target && target->GetTypeId() == TYPEID_PLAYER) // only on players.
{
ShadowDemon->AddThreat(target, 5000000.0f);
ShadowDemon->AI()->AttackStart(target);
}
DoZoneInCombat(ShadowDemon);
}
}
}
void HandleTalkSequence();
void HandleFlightSequence()
{
@@ -943,7 +930,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
Timer[EVENT_SHADOW_BLAST] = 4000;
break;
case EVENT_SHADOWDEMON:
SummonShadowDemon();
DoCast(m_creature, SPELL_SUMMON_SHADOWDEMON);
Timer[EVENT_SHADOWDEMON] = 0;
Timer[EVENT_FLAME_BURST] += 10000;
break;

View File

@@ -695,8 +695,7 @@ struct TRINITY_DLL_DECL boss_lady_malandeAI : public boss_illidari_councilAI
if(CircleOfHealingTimer < diff)
{
//Currently bugged and puts Malande on the threatlist of the other council members. It also heals players.
//DoCast(m_creature, SPELL_CIRCLE_OF_HEALING);
DoCast(m_creature, SPELL_CIRCLE_OF_HEALING);
CircleOfHealingTimer = 60000;
}else CircleOfHealingTimer -= diff;

View File

@@ -807,7 +807,7 @@ enum Targets
TARGET_IN_FRONT_OF_CASTER = 24,
//TARGET_UNIT_CONE_ENEMY
TARGET_DUELVSPLAYER = 25,
//TARGET_UNIT_SINGLE
//TARGET_UNIT_TARGET
TARGET_GAMEOBJECT_ITEM = 26,
//TARGET_OBJECT_ITEM_PICKLOCK
TARGET_MASTER = 27,
@@ -842,7 +842,7 @@ enum Targets
TARGET_CHAIN_HEAL = 45,
//TARGET_UNIT_CHAINHEAL
TARGET_SCRIPT_COORDINATES = 46,
//TARGET_DEST_TABLE_UNKNOWN
//TARGET_DEST_NEARBY_ENTRY
TARGET_DEST_CASTER_FRONT = 47,
TARGET_DEST_CASTER_BACK = 48,
TARGET_DEST_CASTER_RIGHT = 49,

File diff suppressed because it is too large Load Diff

View File

@@ -75,14 +75,12 @@ enum SpellNotifyPushType
PUSH_IN_BACK,
PUSH_SELF_CENTER,
PUSH_DEST_CENTER,
PUSH_TARGET_CENTER
};
bool IsQuestTameSpell(uint32 spellId);
namespace Trinity
{
struct SpellNotifierPlayer;
struct SpellNotifierCreatureAndPlayer;
}
@@ -180,13 +178,27 @@ enum SpellState
SPELL_STATE_DELAYED = 5
};
enum ReplenishType
{
REPLENISH_UNDEFINED = 0,
REPLENISH_HEALTH = 20,
REPLENISH_MANA = 21,
REPLENISH_RAGE = 22
};
enum SpellTargets
{
SPELL_TARGETS_FRIENDLY,
SPELL_TARGETS_AOE_DAMAGE,
SPELL_TARGETS_ENTRY
};
#define SPELL_SPELL_CHANNEL_UPDATE_INTERVAL 1000
typedef std::multimap<uint64, uint64> SpellTargetTimeMap;
class Spell
{
friend struct Trinity::SpellNotifierPlayer;
friend struct Trinity::SpellNotifierCreatureAndPlayer;
public:
@@ -497,6 +509,10 @@ class Spell
void DoAllEffectOnTarget(GOTargetInfo *target);
void DoAllEffectOnTarget(ItemTargetInfo *target);
bool IsAliveUnitPresentInTargetList();
void SearchAreaTarget(std::list<Unit*> &data, float radius, const uint32 &type,
SpellTargets TargetType, uint32 entry = 0);
Unit* SearchNearbyTarget(float radius, SpellTargets TargetType, uint32 entry = 0);
void SearchChainTarget(std::list<Unit*> &data, Unit* pUnitTarget, float max_range, uint32 unMaxTargets);
// -------------------------------------------
//List For Triggered Spells
@@ -518,60 +534,8 @@ class Spell
SpellEntry const* m_triggeredByAuraSpell;
};
enum ReplenishType
{
REPLENISH_UNDEFINED = 0,
REPLENISH_HEALTH = 20,
REPLENISH_MANA = 21,
REPLENISH_RAGE = 22
};
enum SpellTargets
{
SPELL_TARGETS_HOSTILE,
SPELL_TARGETS_NOT_FRIENDLY,
SPELL_TARGETS_NOT_HOSTILE,
SPELL_TARGETS_FRIENDLY,
SPELL_TARGETS_AOE_DAMAGE
};
namespace Trinity
{
struct TRINITY_DLL_DECL SpellNotifierPlayer
{
std::list<Unit*> &i_data;
Spell &i_spell;
const uint32& i_index;
float i_radius;
Unit* i_originalCaster;
SpellNotifierPlayer(Spell &spell, std::list<Unit*> &data, const uint32 &i, float radius)
: i_data(data), i_spell(spell), i_index(i), i_radius(radius)
{
i_originalCaster = i_spell.GetOriginalCaster();
}
void Visit(PlayerMapType &m)
{
if(!i_originalCaster)
return;
for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
Player * pPlayer = itr->getSource();
if( !pPlayer->isAlive() || pPlayer->isInFlight())
continue;
if( i_originalCaster->IsFriendlyTo(pPlayer) )
continue;
if( pPlayer->GetDistance(i_spell.m_targets.m_destX, i_spell.m_targets.m_destY, i_spell.m_targets.m_destZ) < i_radius )
i_data.push_back(pPlayer);
}
}
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
};
struct TRINITY_DLL_DECL SpellNotifierCreatureAndPlayer
{
std::list<Unit*> *i_data;
@@ -580,10 +544,11 @@ namespace Trinity
float i_radius;
SpellTargets i_TargetType;
Unit* i_originalCaster;
uint32 i_entry;
SpellNotifierCreatureAndPlayer(Spell &spell, std::list<Unit*> &data, float radius, const uint32 &type,
SpellTargets TargetType = SPELL_TARGETS_NOT_FRIENDLY)
: i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType)
SpellTargets TargetType = SPELL_TARGETS_AOE_DAMAGE, uint32 entry = 0)
: i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType), i_entry(entry)
{
i_originalCaster = spell.GetOriginalCaster();
}
@@ -602,18 +567,6 @@ namespace Trinity
switch (i_TargetType)
{
case SPELL_TARGETS_HOSTILE:
if (!itr->getSource()->isTargetableForAttack() || !i_originalCaster->IsHostileTo( itr->getSource() ))
continue;
break;
case SPELL_TARGETS_NOT_FRIENDLY:
if (!itr->getSource()->isTargetableForAttack() || i_originalCaster->IsFriendlyTo( itr->getSource() ))
continue;
break;
case SPELL_TARGETS_NOT_HOSTILE:
if (!itr->getSource()->isTargetableForAttack() || i_originalCaster->IsHostileTo( itr->getSource() ))
continue;
break;
case SPELL_TARGETS_FRIENDLY:
if (!itr->getSource()->isTargetableForAttack() || !i_originalCaster->IsFriendlyTo( itr->getSource() ))
continue;
@@ -637,8 +590,12 @@ namespace Trinity
if (!check->IsHostileTo( itr->getSource() ))
continue;
}
}
break;
}break;
case SPELL_TARGETS_ENTRY:
{
if(itr->getSource()->GetTypeId()!=TYPEID_UNIT || itr->getSource()->GetEntry()!= i_entry)
continue;
}break;
default: continue;
}
@@ -660,10 +617,6 @@ namespace Trinity
if((itr->getSource()->GetDistance(i_spell.m_targets.m_destX, i_spell.m_targets.m_destY, i_spell.m_targets.m_destZ) < i_radius ))
i_data->push_back(itr->getSource());
break;
case PUSH_TARGET_CENTER:
if(i_spell.m_targets.getUnitTarget()->IsWithinDistInMap((Unit*)(itr->getSource()), i_radius))
i_data->push_back(itr->getSource());
break;
}
}
}

View File

@@ -1793,7 +1793,7 @@ void SpellMgr::LoadSpellScriptTarget()
continue;
}
bool targetfound = false;
/*bool targetfound = false;
for(int i = 0; i <3; ++i)
{
if( spellProto->EffectImplicitTargetA[i]==TARGET_SCRIPT ||
@@ -1809,7 +1809,7 @@ void SpellMgr::LoadSpellScriptTarget()
{
sLog.outErrorDb("Table `spell_script_target`: spellId %u listed for TargetEntry %u does not have any implicit target TARGET_SCRIPT(38) or TARGET_SCRIPT_COORDINATES (46).",spellId,targetEntry);
continue;
}
}*/
if( type >= MAX_SPELL_TARGET_TYPE )
{