aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 235a2c99272..8b7677e6d2f 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -564,8 +564,8 @@ void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb)
//if( GetTypeId()== TYPEID_UNIT && ((Creature *)this)->AI())
// ((Creature *)this)->AI()->DamageDeal(pVictim, damage);
//Script Event damage taken
- if( pVictim->GetTypeId()== TYPEID_UNIT && ((Creature *)pVictim)->IsAIEnabled )
- ((Creature *)pVictim)->AI()->DamageTaken(this, damage);
+ //if( pVictim->GetTypeId()== TYPEID_UNIT && ((Creature *)pVictim)->IsAIEnabled )
+ // ((Creature *)pVictim)->AI()->DamageTaken(this, damage);
if(absorb && originalDamage > damage)
absorb += (originalDamage - damage);
@@ -575,6 +575,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
{
if( pVictim->GetTypeId()== TYPEID_UNIT)
{
+ if(((Creature *)pVictim)->IsAIEnabled)
+ ((Creature *)pVictim)->AI()->DamageTaken(this, damage);
+
// Set tagging
if(!pVictim->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER) && !((Creature*)pVictim)->isPet())
{
@@ -11763,20 +11766,30 @@ void CharmInfo::InitCharmCreateSpells()
bool CharmInfo::AddSpellToAB(uint32 oldid, uint32 newid, ActiveStates newstate)
{
- for(uint8 i = 0; i < 10; i++)
+ // new spell already listed for example in case prepered switch to lesser rank in Pet::removeSpell
+ for(uint8 i = 0; i < 10; ++i)
+ if (PetActionBar[i].Type == ACT_DISABLED || PetActionBar[i].Type == ACT_ENABLED || PetActionBar[i].Type == ACT_PASSIVE)
+ if (newid && PetActionBar[i].SpellOrAction == newid)
+ return true;
+
+ // old spell can be leasted for example in case learn high rank
+ for(uint8 i = 0; i < 10; ++i)
{
- if((PetActionBar[i].Type == ACT_DISABLED || PetActionBar[i].Type == ACT_ENABLED || PetActionBar[i].Type == ACT_PASSIVE) && PetActionBar[i].SpellOrAction == oldid)
+ if (PetActionBar[i].Type == ACT_DISABLED || PetActionBar[i].Type == ACT_ENABLED || PetActionBar[i].Type == ACT_PASSIVE)
{
- PetActionBar[i].SpellOrAction = newid;
- if(!oldid)
+ if (PetActionBar[i].SpellOrAction == oldid)
{
- if(newstate == ACT_DECIDE)
- PetActionBar[i].Type = ACT_DISABLED;
- else
- PetActionBar[i].Type = newstate;
- }
+ PetActionBar[i].SpellOrAction = newid;
+ if (!oldid)
+ {
+ if (newstate == ACT_DECIDE)
+ PetActionBar[i].Type = ACT_DISABLED;
+ else
+ PetActionBar[i].Type = newstate;
+ }
- return true;
+ return true;
+ }
}
}
return false;
@@ -12794,6 +12807,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true);
// this enables pet details window (Shift+P)
pet->InitPetCreateSpells();
+ //pet->InitLevelupSpellsForLevel();
pet->InitTalentForLevel();
pet->SetHealth(pet->GetMaxHealth());