*Merge.
--HG-- branch : trunk
This commit is contained in:
@@ -108,7 +108,7 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
|
|||||||
//*************
|
//*************
|
||||||
|
|
||||||
//Called at creature reset either by death or evade
|
//Called at creature reset either by death or evade
|
||||||
virtual void Reset() = 0;
|
void Reset() {}
|
||||||
|
|
||||||
//Called at creature aggro either by MoveInLOS or Attack Start
|
//Called at creature aggro either by MoveInLOS or Attack Start
|
||||||
virtual void Aggro(Unit*) = 0;
|
virtual void Aggro(Unit*) = 0;
|
||||||
|
|||||||
@@ -618,7 +618,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
|
|||||||
i_AI = ai ? ai : FactorySelector::selectAI(this);
|
i_AI = ai ? ai : FactorySelector::selectAI(this);
|
||||||
if(oldAI) delete oldAI;
|
if(oldAI) delete oldAI;
|
||||||
IsAIEnabled = true;
|
IsAIEnabled = true;
|
||||||
i_AI->Reset();
|
i_AI->InitializeAI();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-15
@@ -23,6 +23,7 @@
|
|||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Pet.h"
|
#include "Pet.h"
|
||||||
#include "SpellAuras.h"
|
#include "SpellAuras.h"
|
||||||
|
#include "World.h"
|
||||||
|
|
||||||
void UnitAI::AttackStart(Unit *victim)
|
void UnitAI::AttackStart(Unit *victim)
|
||||||
{
|
{
|
||||||
@@ -104,22 +105,15 @@ void CreatureAI::DoZoneInCombat(Unit* pUnit)
|
|||||||
|
|
||||||
void CreatureAI::MoveInLineOfSight(Unit *who)
|
void CreatureAI::MoveInLineOfSight(Unit *who)
|
||||||
{
|
{
|
||||||
if(!me->getVictim() && me->canStartAttack(who))
|
if(me->getVictim())
|
||||||
AttackStart(who);
|
return;
|
||||||
|
|
||||||
if (who->isInCombat() && who->getVictim() && me->GetCreatureType()==CREATURE_TYPE_HUMANOID && me->IsFriendlyTo(who))
|
if(me->canStartAttack(who))
|
||||||
{
|
AttackStart(who);
|
||||||
if (me->GetDistanceZ(who) <= 2 && me->IsWithinLOSInMap(who))
|
else if(who->getVictim() && me->IsFriendlyTo(who)
|
||||||
{
|
&& me->IsWithinDistInMap(who, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
|
||||||
float attackRadius = (me->GetAttackDistance(who) *0.5);
|
&& me->canAttack(who->getVictim()))
|
||||||
if (me->IsWithinDistInMap(who, attackRadius))
|
AttackStart(who->getVictim());
|
||||||
{
|
|
||||||
Unit* target = NULL;
|
|
||||||
target = who->getVictim();
|
|
||||||
AttackStart(target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreatureAI::UpdateVictim()
|
bool CreatureAI::UpdateVictim()
|
||||||
|
|||||||
@@ -79,7 +79,8 @@ class TRINITY_DLL_SPEC UnitAI
|
|||||||
virtual void AttackStart(Unit *);
|
virtual void AttackStart(Unit *);
|
||||||
virtual void UpdateAI(const uint32 diff) = 0;
|
virtual void UpdateAI(const uint32 diff) = 0;
|
||||||
|
|
||||||
// Initialize
|
virtual void InitializeAI() { Reset(); }
|
||||||
|
|
||||||
virtual void Reset() {};
|
virtual void Reset() {};
|
||||||
|
|
||||||
// Called when unit is charmed
|
// Called when unit is charmed
|
||||||
|
|||||||
+1
-8
@@ -2045,14 +2045,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
|
|||||||
if(m_spellInfo->Id == 5246) //Intimidating Shout
|
if(m_spellInfo->Id == 5246) //Intimidating Shout
|
||||||
TagUnitMap.remove(m_targets.getUnitTarget());
|
TagUnitMap.remove(m_targets.getUnitTarget());
|
||||||
|
|
||||||
// remove random units from the map
|
Trinity::RandomResizeList(TagUnitMap, unMaxTargets);
|
||||||
std::list<Unit*>::iterator itr;
|
|
||||||
while(TagUnitMap.size() > unMaxTargets)
|
|
||||||
{
|
|
||||||
itr = TagUnitMap.begin();
|
|
||||||
advance(itr, urand(0, TagUnitMap.size() - 1));
|
|
||||||
TagUnitMap.erase(itr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*if(m_spellInfo->Id==57669) //Replenishment (special target selection)
|
/*if(m_spellInfo->Id==57669) //Replenishment (special target selection)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ Aura::~Aura()
|
|||||||
|
|
||||||
AuraEffect::AuraEffect(Aura * parentAura, uint8 effIndex, int32 * currentBasePoints , Unit * caster, Item* castItem) :
|
AuraEffect::AuraEffect(Aura * parentAura, uint8 effIndex, int32 * currentBasePoints , Unit * caster, Item* castItem) :
|
||||||
m_parentAura(parentAura), m_spellmod(NULL), m_periodicTimer(0), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false),
|
m_parentAura(parentAura), m_spellmod(NULL), m_periodicTimer(0), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false),
|
||||||
m_target(parentAura->GetTarget())
|
m_target(parentAura->GetTarget()), m_tickNumber(0)
|
||||||
{
|
{
|
||||||
m_spellProto = parentAura->GetSpellProto();
|
m_spellProto = parentAura->GetSpellProto();
|
||||||
m_effIndex = effIndex;
|
m_effIndex = effIndex;
|
||||||
@@ -696,6 +696,8 @@ void AuraEffect::Update(uint32 diff)
|
|||||||
m_periodicTimer -= diff;
|
m_periodicTimer -= diff;
|
||||||
if(m_periodicTimer <= 0) // tick also at m_periodicTimer==0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N
|
if(m_periodicTimer <= 0) // tick also at m_periodicTimer==0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N
|
||||||
{
|
{
|
||||||
|
++m_tickNumber;
|
||||||
|
|
||||||
// update before applying (aura can be removed in TriggerSpell or PeriodicTick calls)
|
// update before applying (aura can be removed in TriggerSpell or PeriodicTick calls)
|
||||||
m_periodicTimer += m_amplitude;
|
m_periodicTimer += m_amplitude;
|
||||||
|
|
||||||
@@ -5668,7 +5670,7 @@ void AuraEffect::PeriodicTick()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_amount += 100;
|
m_amount = 100 * m_tickNumber;
|
||||||
}break;
|
}break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -5700,11 +5702,12 @@ void AuraEffect::PeriodicTick()
|
|||||||
// Curse of Agony damage-per-tick calculation
|
// Curse of Agony damage-per-tick calculation
|
||||||
if (GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x400) && GetSpellProto()->SpellIconID==544)
|
if (GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x400) && GetSpellProto()->SpellIconID==544)
|
||||||
{
|
{
|
||||||
|
uint32 totalTick = GetParentAura()->GetAuraMaxDuration() / m_amplitude;
|
||||||
// 1..4 ticks, 1/2 from normal tick damage
|
// 1..4 ticks, 1/2 from normal tick damage
|
||||||
if (GetParentAura()->GetAuraDuration()>=((GetParentAura()->GetAuraMaxDuration()-m_amplitude)*2/3))
|
if(m_tickNumber <= totalTick / 3)
|
||||||
pdamage = pdamage/2;
|
pdamage = pdamage/2;
|
||||||
// 9..12 ticks, 3/2 from normal tick damage
|
// 9..12 ticks, 3/2 from normal tick damage
|
||||||
else if(GetParentAura()->GetAuraDuration()<((GetParentAura()->GetAuraMaxDuration()-m_amplitude)/3))
|
else if(m_tickNumber > totalTick * 2 / 3)
|
||||||
pdamage += (pdamage+1)/2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
|
pdamage += (pdamage+1)/2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
|
||||||
// 5..8 ticks have normal tick damage
|
// 5..8 ticks have normal tick damage
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,6 +338,7 @@ class TRINITY_DLL_SPEC AuraEffect
|
|||||||
int32 GetAuraAmplitude(){return m_amplitude;}
|
int32 GetAuraAmplitude(){return m_amplitude;}
|
||||||
virtual void Update(uint32 diff);
|
virtual void Update(uint32 diff);
|
||||||
|
|
||||||
|
uint32 GetTickNumber() const { return m_tickNumber; }
|
||||||
bool IsAreaAura() const { return m_isAreaAura; }
|
bool IsAreaAura() const { return m_isAreaAura; }
|
||||||
bool IsPeriodic() const { return m_isPeriodic; }
|
bool IsPeriodic() const { return m_isPeriodic; }
|
||||||
bool IsPersistent() const { return m_isPersistent; }
|
bool IsPersistent() const { return m_isPersistent; }
|
||||||
@@ -366,6 +367,7 @@ class TRINITY_DLL_SPEC AuraEffect
|
|||||||
Unit * const m_target;
|
Unit * const m_target;
|
||||||
|
|
||||||
SpellEntry const *m_spellProto;
|
SpellEntry const *m_spellProto;
|
||||||
|
uint32 m_tickNumber;
|
||||||
|
|
||||||
uint8 m_effIndex;
|
uint8 m_effIndex;
|
||||||
AuraType m_auraName;
|
AuraType m_auraName;
|
||||||
|
|||||||
Reference in New Issue
Block a user