Nopch fix

This commit is contained in:
Shauren
2017-05-24 21:30:43 +02:00
parent 1bc60ed48d
commit 2200b4b0e1
17 changed files with 107 additions and 63 deletions

View File

@@ -16,6 +16,10 @@
*/
#include "PlayerAI.h"
#include "Creature.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Spell.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
@@ -383,6 +387,25 @@ enum Spells
SPELL_LIFEBLOOM = 48451
};
PlayerAI::PlayerAI(Player* player) : UnitAI(player), me(player),
_selfSpec(player->GetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID)),
_isSelfHealer(PlayerAI::IsPlayerHealer(player)),
_isSelfRangedAttacker(PlayerAI::IsPlayerRangedAttacker(player))
{
}
Creature* PlayerAI::GetCharmer() const
{
if (me->GetCharmerGUID().IsCreature())
return ObjectAccessor::GetCreature(*me, me->GetCharmerGUID());
return nullptr;
}
uint16 PlayerAI::GetSpec(Player const* who /*= nullptr*/) const
{
return (!who || who == me) ? _selfSpec : who->GetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID);
}
bool PlayerAI::IsPlayerHealer(Player const* who)
{
if (!who)
@@ -543,6 +566,13 @@ PlayerAI::TargetedSpell PlayerAI::SelectSpellCast(PossibleSpellVector& spells)
return selected;
}
void PlayerAI::DoCastAtTarget(TargetedSpell spell)
{
SpellCastTargets targets;
targets.SetUnitTarget(spell.second);
spell.first->prepare(&targets);
}
void PlayerAI::DoRangedAttackIfReady()
{
if (me->HasUnitState(UNIT_STATE_CASTING))
@@ -614,6 +644,11 @@ void PlayerAI::CancelAllShapeshifts()
me->RemoveOwnedAura(aura, AURA_REMOVE_BY_CANCEL);
}
Unit* PlayerAI::SelectAttackTarget() const
{
return me->GetCharmer() ? me->GetCharmer()->GetVictim() : nullptr;
}
struct UncontrolledTargetSelectPredicate : public std::unary_function<Unit*, bool>
{
bool operator()(Unit const* target) const
@@ -621,6 +656,7 @@ struct UncontrolledTargetSelectPredicate : public std::unary_function<Unit*, boo
return !target->HasBreakableByDamageCrowdControlAura();
}
};
Unit* SimpleCharmedPlayerAI::SelectAttackTarget() const
{
if (Unit* charmer = me->GetCharmer())

View File

@@ -19,25 +19,19 @@
#define TRINITY_PLAYERAI_H
#include "UnitAI.h"
#include "Player.h"
#include "Spell.h"
#include "Creature.h"
class Spell;
class TC_GAME_API PlayerAI : public UnitAI
{
public:
explicit PlayerAI(Player* player) : UnitAI(player), me(player), _selfSpec(player->GetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID)), _isSelfHealer(PlayerAI::IsPlayerHealer(player)), _isSelfRangedAttacker(PlayerAI::IsPlayerRangedAttacker(player)) { }
explicit PlayerAI(Player* player);
void OnCharmed(bool /*apply*/) override { } // charm AI application for players is handled by Unit::SetCharmedBy / Unit::RemoveCharmedBy
Creature* GetCharmer() const
{
if (me->GetCharmerGUID().IsCreature())
return ObjectAccessor::GetCreature(*me, me->GetCharmerGUID());
return nullptr;
}
Creature* GetCharmer() const;
// helper functions to determine player info
uint16 GetSpec(Player const* who = nullptr) const { return (!who || who == me) ? _selfSpec : who->GetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID); }
uint16 GetSpec(Player const* who = nullptr) const;
static bool IsPlayerHealer(Player const* who);
bool IsHealer(Player const* who = nullptr) const { return (!who || who == me) ? _isSelfHealer : IsPlayerHealer(who); }
static bool IsPlayerRangedAttacker(Player const* who);
@@ -81,14 +75,9 @@ class TC_GAME_API PlayerAI : public UnitAI
This invalidates the vector, and empties it to prevent accidental misuse. */
TargetedSpell SelectSpellCast(PossibleSpellVector& spells);
/* Helper method - casts the included spell at the included target */
inline void DoCastAtTarget(TargetedSpell spell)
{
SpellCastTargets targets;
targets.SetUnitTarget(spell.second);
spell.first->prepare(&targets);
}
void DoCastAtTarget(TargetedSpell spell);
virtual Unit* SelectAttackTarget() const { return me->GetCharmer() ? me->GetCharmer()->GetVictim() : nullptr; }
virtual Unit* SelectAttackTarget() const;
void DoRangedAttackIfReady();
void DoAutoAttackIfReady();

View File

@@ -15,12 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "Player.h"
#include "Spell.h"
#include "blackrock_spire.h"
#include "InstanceScript.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
enum Text
{

View File

@@ -28,9 +28,10 @@ npc_ruul_snowhoof
EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "GameObject.h"
#include "Player.h"
#include "ScriptedEscortAI.h"
#include "SpellInfo.h"
#include "SpellScript.h"
/*####

View File

@@ -17,12 +17,13 @@
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "Player.h"
#include "SpellScript.h"
#include "CreatureTextMgr.h"
#include "CombatAI.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptedEscortAI.h"
#include "SpellInfo.h"
#include "SpellScript.h"
#include "TemporarySummon.h"
/*######
## Quest 12027: Mr. Floppy's Perilous Adventure

View File

@@ -37,13 +37,15 @@ npc_enraged_spirit
EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "GameObject.h"
#include "Group.h"
#include "SpellScript.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "WorldSession.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
#include "SpellInfo.h"
#include "SpellScript.h"
#include "TemporarySummon.h"
/*#####
# npc_invis_infernal_caster

View File

@@ -21,12 +21,13 @@
* Scriptnames of files in this file should be prefixed with "spell_dk_".
*/
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "Containers.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
#include "Containers.h"
#include "SpellScript.h"
enum DeathKnightSpells
{

View File

@@ -21,15 +21,16 @@
* Scriptnames in this file should be prefixed with "spell_#holidayname_".
*/
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
#include "CreatureAIImpl.h"
#include "GridNotifiersImpl.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "Vehicle.h"
#include "World.h"
// 45102 Romantic Picnic
enum SpellsPicnic

View File

@@ -21,15 +21,17 @@
* Scriptnames of files in this file should be prefixed with "spell_item_".
*/
#include "Player.h"
#include "ScriptMgr.h"
#include "Battleground.h"
#include "CreatureAIImpl.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SkillDiscovery.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
#include "SkillDiscovery.h"
#include "Battleground.h"
#include "Log.h"
#include "SpellScript.h"
// Generic script for handling item dummy effects which trigger another spell.
class spell_item_trigger_spell : public SpellScriptLoader

View File

@@ -21,13 +21,14 @@
* Scriptnames of files in this file should be prefixed with "spell_mage_".
*/
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellHistory.h"
#include "SpellAuraEffects.h"
#include "Pet.h"
#include "GridNotifiers.h"
#include "ObjectAccessor.h"
#include "Pet.h"
#include "Player.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
#include "SpellScript.h"
enum MageSpells
{

View File

@@ -21,7 +21,9 @@
*/
#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
#include "SpellScript.h"
#include "Unit.h"

View File

@@ -22,11 +22,12 @@
*/
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "Unit.h"
#include "Player.h"
#include "ObjectMgr.h"
#include "Pet.h"
#include "Player.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "Unit.h"
enum HunterPetCalculate
{

View File

@@ -22,8 +22,8 @@
*/
#include "CellImpl.h"
#include "CreatureAIImpl.h"
#include "CreatureTextMgr.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Player.h"
#include "ScriptMgr.h"

View File

@@ -24,6 +24,7 @@
#include "ScriptMgr.h"
#include "Containers.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"

View File

@@ -25,6 +25,7 @@
#include "CellImpl.h"
#include "CreatureAIImpl.h" // for RAND()
#include "GridNotifiersImpl.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "SpellScript.h"
#include "SpellHistory.h"

View File

@@ -21,13 +21,16 @@
* Scriptnames of files in this file should be prefixed with "spell_warl_".
*/
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
#include "AreaTrigger.h"
#include "AreaTriggerTemplate.h"
#include "Creature.h"
#include "GameObject.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
#include "SpellScript.h"
enum WarlockSpells
{

View File

@@ -17,9 +17,10 @@
#include "ScriptMgr.h"
#include "Channel.h"
#include "Guild.h"
#include "Group.h"
#include "Guild.h"
#include "Log.h"
#include "Player.h"
class ChatLogScript : public PlayerScript
{