[10610] Renamed some functions from the Creature class

Also other classes have been affected, due to the use of search&replace.
This will probably break some patches and 3rd party libraries, so make sure to update them if required.
Thanks to Phille for the original idea and patch!
This commit is contained in:
DasBlub 2010-10-14 21:56:40 +02:00
parent d090bce461
commit 61102e3b16
50 changed files with 305 additions and 305 deletions

View file

@ -323,7 +323,7 @@ void Unit::Update( uint32 p_time )
getThreatManager().UpdateForClient(p_time);
// update combat timer only for players and pets
if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->isPet() || ((Creature*)this)->isCharmed()))
if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->IsPet() || ((Creature*)this)->isCharmed()))
{
// Check UNIT_STAT_MELEE_ATTACKING or UNIT_STAT_CHASE (without UNIT_STAT_FOLLOW in this case) so pets can reach far away
// targets without stopping half way there and running off.
@ -581,7 +581,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
((Creature*)pVictim)->SetLootRecipient(this);
pVictim->setDeathState(JUST_DIED);
pVictim->SetDeathState(JUST_DIED);
pVictim->SetHealth(0);
// allow loot only if has loot_id in creature_template
@ -680,7 +680,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (pVictim->GetTypeId() == TYPEID_PLAYER)
((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage);
if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet() && !((Creature*)pVictim)->HasLootRecipient())
if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->IsPet() && !((Creature*)pVictim)->HasLootRecipient())
((Creature*)pVictim)->SetLootRecipient(this);
if (health <= damage)
@ -768,7 +768,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (!spiritOfRedemtionTalentReady)
{
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"SET JUST_DIED");
pVictim->setDeathState(JUST_DIED);
pVictim->SetDeathState(JUST_DIED);
}
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageHealth1");
@ -829,7 +829,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageNotPlayer");
Creature *cVictim = (Creature*)pVictim;
if(!cVictim->isPet())
if(!cVictim->IsPet())
{
cVictim->DeleteThreatList();
// only lootable if it has loot or can drop gold
@ -842,7 +842,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (cVictim->AI())
cVictim->AI()->JustDied(this);
if (cVictim->isTemporarySummon())
if (cVictim->IsTemporarySummon())
{
TemporarySummon* pSummon = (TemporarySummon*)cVictim;
if (pSummon->GetSummonerGuid().IsCreature())
@ -2682,9 +2682,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
// Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
if( attType != RANGED_ATTACK &&
(GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->isPet()) &&
pVictim->GetTypeId() != TYPEID_PLAYER && !((Creature*)pVictim)->isPet() &&
getLevel() < pVictim->getLevelForTarget(this) )
(GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->IsPet()) &&
pVictim->GetTypeId() != TYPEID_PLAYER && !((Creature*)pVictim)->IsPet() &&
getLevel() < pVictim->GetLevelForTarget(this) )
{
// cap possible value (with bonuses > max skill)
int32 skill = attackerWeaponSkill;
@ -2701,9 +2701,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
}
// mobs can score crushing blows if they're 4 or more levels above victim
if (getLevelForTarget(pVictim) >= pVictim->getLevelForTarget(this) + 4 &&
if (GetLevelForTarget(pVictim) >= pVictim->GetLevelForTarget(this) + 4 &&
// can be from by creature (if can) or from controlled player that considered as creature
(GetTypeId()!=TYPEID_PLAYER && !((Creature*)this)->isPet() &&
(GetTypeId()!=TYPEID_PLAYER && !((Creature*)this)->IsPet() &&
!(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) ||
GetTypeId()==TYPEID_PLAYER && GetCharmerOrOwnerGUID()))
{
@ -3028,7 +3028,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
SpellSchoolMask schoolMask = GetSpellSchoolMask(spell);
// PvP - PvE spell misschances per leveldif > 2
int32 lchance = pVictim->GetTypeId() == TYPEID_PLAYER ? 7 : 11;
int32 leveldif = int32(pVictim->getLevelForTarget(this)) - int32(getLevelForTarget(pVictim));
int32 leveldif = int32(pVictim->GetLevelForTarget(this)) - int32(GetLevelForTarget(pVictim));
// Base hit chance from attacker and victim levels
int32 modHitChance;
@ -3114,7 +3114,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
return SPELL_MISS_EVADE;
// Check for immune
if (pVictim->IsImmunedToSpell(spell))
if (pVictim->IsImmuneToSpell(spell))
return SPELL_MISS_IMMUNE;
// All positive spells can`t miss
@ -3244,7 +3244,7 @@ float Unit::GetUnitDodgeChance() const
return GetFloatValue(PLAYER_DODGE_PERCENTAGE);
else
{
if(((Creature const*)this)->isTotem())
if(((Creature const*)this)->IsTotem())
return 0.0f;
else
{
@ -3306,7 +3306,7 @@ float Unit::GetUnitBlockChance() const
}
else
{
if(((Creature const*)this)->isTotem())
if(((Creature const*)this)->IsTotem())
return 0.0f;
else
{
@ -3718,9 +3718,9 @@ void Unit::SetFacingToObject(WorldObject* pObject)
bool Unit::isInAccessablePlaceFor(Creature const* c) const
{
if(IsInWater())
return c->canSwim();
return c->CanSwim();
else
return c->canWalk() || c->canFly();
return c->CanWalk() || c->CanFly();
}
bool Unit::IsInWater() const
@ -4671,7 +4671,7 @@ void Unit::RemoveSpellAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mode)
Totem* statue = NULL;
Unit* caster = holder->GetCaster();
if(IsChanneledSpell(AurSpellInfo) && caster)
if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->IsTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
statue = ((Totem*)caster);
if (m_spellAuraHoldersUpdateIterator != m_spellAuraHolders.end() && m_spellAuraHoldersUpdateIterator->second == holder)
@ -5255,7 +5255,7 @@ void Unit::setPowerType(Powers new_powertype)
if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE);
}
else if(((Creature*)this)->isPet())
else if(((Creature*)this)->IsPet())
{
Pet *pet = ((Pet*)this);
if(pet->isControlled())
@ -5939,7 +5939,7 @@ Totem* Unit::GetTotem(TotemSlot slot ) const
return NULL;
Creature *totem = GetMap()->GetCreature(m_TotemSlot[slot]);
return totem && totem->isTotem() ? (Totem*)totem : NULL;
return totem && totem->IsTotem() ? (Totem*)totem : NULL;
}
bool Unit::IsAllTotemSlotsUsed() const
@ -5982,7 +5982,7 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro
Unit* unit = this;
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->IsTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
unit = GetOwner();
if (unit->GetTypeId()==TYPEID_PLAYER)
@ -6076,7 +6076,7 @@ int32 Unit::SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 total, int3
float coeff;
// Not apply this to creature casted spells
if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet())
if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->IsPet())
coeff = 1.0f;
// Check for table values
else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id))
@ -6130,7 +6130,7 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u
return pdamage;
// For totems get damage bonus from owner (statue isn't totem in fact)
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->IsTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
{
if(Unit* owner = GetOwner())
return owner->SpellDamageBonusDone(pVictim, spellProto, pdamage, damagetype);
@ -6140,7 +6140,7 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u
int32 DoneTotal = 0;
// Creature damage
if( GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet() )
if( GetTypeId() == TYPEID_UNIT && !((Creature*)this)->IsPet() )
DoneTotalMod *= ((Creature*)this)->GetSpellDamageMod(((Creature*)this)->GetCreatureInfo()->rank);
AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
@ -6415,7 +6415,7 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u
// Pets just add their bonus damage to their spell damage
// note that their spell damage is just gain of their own auras
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
DoneAdvertisedBenefit += ((Pet*)this)->GetBonusDamage();
// apply ap bonus and benefit affected by spell power implicit coeffs and spell level penalties
@ -6475,7 +6475,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto,
if(IsAreaOfEffectSpell(spellProto))
{
TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask);
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE, schoolMask);
}
@ -6784,7 +6784,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 dama
uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack)
{
// For totems get healing bonus from owner (statue isn't totem in fact)
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->IsTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
if(Unit* owner = GetOwner())
return owner->SpellHealingBonusDone(pVictim, spellProto, healamount, damagetype, stack);
@ -7001,7 +7001,7 @@ bool Unit::IsImmunedToDamage(SpellSchoolMask shoolMask)
return false;
}
bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
bool Unit::IsImmuneToSpell(SpellEntry const* spellInfo)
{
if (!spellInfo)
return false;
@ -7040,7 +7040,7 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
return false;
}
bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
{
//If m_immuneToEffect type contain this effect type, IMMUNE effect.
uint32 effect = spellInfo->Effect[index];
@ -7139,7 +7139,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
}
// Pets just add their bonus damage to their melee damage
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
DoneFlat += ((Pet*)this)->GetBonusDamage();
}
@ -7399,7 +7399,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp
if(spellProto && IsAreaOfEffectSpell(spellProto))
{
TakenPercent *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask);
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
TakenPercent *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE, schoolMask);
}
@ -7600,7 +7600,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
if (isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->isPet()))
if (isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->IsPet()))
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
// interrupt all delayed non-combat casts
@ -7627,7 +7627,7 @@ void Unit::ClearInCombat()
m_CombatTimer = 0;
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
if(isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->isPet()))
if(isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->IsPet()))
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
// Player's state will be cleared in Player::UpdateContestedPvP
@ -7939,7 +7939,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
//Visible distance is modified by
//-Level Diff (every level diff = 1.0f in visible distance)
visibleDistance += int32(u->getLevelForTarget(this)) - int32(getLevelForTarget(u));
visibleDistance += int32(u->GetLevelForTarget(this)) - int32(GetLevelForTarget(u));
//This allows to check talent tree and will add addition stealth dependent on used points)
int32 stealthMod = GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL);
@ -8061,12 +8061,12 @@ void Unit::UpdateWalkMode(Unit* source, bool self)
if (on)
{
if (((Creature*)this)->isPet() && hasUnitState(UNIT_STAT_FOLLOW))
if (((Creature*)this)->IsPet() && hasUnitState(UNIT_STAT_FOLLOW))
((Creature*)this)->AddSplineFlag(SPLINEFLAG_WALKMODE);
}
else
{
if (((Creature*)this)->isPet())
if (((Creature*)this)->IsPet())
((Creature*)this)->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
}
}
@ -8082,7 +8082,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
case MOVE_RUN:
case MOVE_WALK:
case MOVE_SWIM:
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet() && hasUnitState(UNIT_STAT_FOLLOW))
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet() && hasUnitState(UNIT_STAT_FOLLOW))
{
if(Unit* owner = GetOwner())
{
@ -8332,7 +8332,7 @@ void Unit::SetHover(bool on)
RemoveAurasDueToSpell(11010);
}
void Unit::setDeathState(DeathState s)
void Unit::SetDeathState(DeathState s)
{
if (s != ALIVE && s!= JUST_ALIVED)
{
@ -8401,15 +8401,15 @@ bool Unit::CanHaveThreatList() const
Creature const* creature = ((Creature const*)this);
// totems can not have threat list
if (creature->isTotem())
if (creature->IsTotem())
return false;
// vehicles can not have threat list
if (creature->isVehicle())
if (creature->IsVehicle())
return false;
// pets can not have a threat list, unless they are controlled by a creature
if (creature->isPet() && IS_PLAYER_GUID(((Pet const*)creature)->GetOwnerGUID()))
if (creature->IsPet() && IS_PLAYER_GUID(((Pet const*)creature)->GetOwnerGUID()))
return false;
// charmed units can not have a threat list if charmed by player
@ -9076,7 +9076,7 @@ void Unit::SetHealth(uint32 val)
if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP);
}
else if(((Creature*)this)->isPet())
else if(((Creature*)this)->IsPet())
{
Pet *pet = ((Pet*)this);
if(pet->isControlled())
@ -9099,7 +9099,7 @@ void Unit::SetMaxHealth(uint32 val)
if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_HP);
}
else if(((Creature*)this)->isPet())
else if(((Creature*)this)->IsPet())
{
Pet *pet = ((Pet*)this);
if(pet->isControlled())
@ -9143,7 +9143,7 @@ void Unit::SetPower(Powers power, uint32 val)
if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER);
}
else if(((Creature*)this)->isPet())
else if(((Creature*)this)->IsPet())
{
Pet *pet = ((Pet*)this);
if(pet->isControlled())
@ -9172,7 +9172,7 @@ void Unit::SetMaxPower(Powers power, uint32 val)
if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER);
}
else if(((Creature*)this)->isPet())
else if(((Creature*)this)->IsPet())
{
Pet *pet = ((Pet*)this);
if(pet->isControlled())
@ -9197,7 +9197,7 @@ void Unit::ApplyPowerMod(Powers power, uint32 val, bool apply)
if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER);
}
else if(((Creature*)this)->isPet())
else if(((Creature*)this)->IsPet())
{
Pet *pet = ((Pet*)this);
if(pet->isControlled())
@ -9219,7 +9219,7 @@ void Unit::ApplyMaxPowerMod(Powers power, uint32 val, bool apply)
if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER);
}
else if(((Creature*)this)->isPet())
else if(((Creature*)this)->IsPet())
{
Pet *pet = ((Pet*)this);
if(pet->isControlled())
@ -9248,9 +9248,9 @@ uint32 Unit::GetCreatePowers( Powers power ) const
case POWER_HEALTH: return 0;
case POWER_MANA: return GetCreateMana();
case POWER_RAGE: return 1000;
case POWER_FOCUS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 100);
case POWER_FOCUS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 100);
case POWER_ENERGY: return 100;
case POWER_HAPPINESS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 1050000);
case POWER_HAPPINESS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 1050000);
case POWER_RUNIC_POWER: return 1000;
case POWER_RUNE: return 0;
}
@ -9744,7 +9744,7 @@ Player* Unit::GetSpellModOwner()
{
if(GetTypeId()==TYPEID_PLAYER)
return (Player*)this;
if(((Creature*)this)->isPet() || ((Creature*)this)->isTotem())
if(((Creature*)this)->IsPet() || ((Creature*)this)->IsTotem())
{
Unit* owner = GetOwner();
if(owner && owner->GetTypeId()==TYPEID_PLAYER)
@ -10002,7 +10002,7 @@ void Unit::SetDisplayId(uint32 modelId)
UpdateModelData();
if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
{
Pet *pet = ((Pet*)this);
if(!pet->isControlled())
@ -10212,7 +10212,7 @@ void Unit::UpdateAuraForGroup(uint8 slot)
player->SetAuraUpdateMask(slot);
}
}
else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
{
Pet *pet = ((Pet*)this);
if(pet->isControlled())
@ -10537,7 +10537,7 @@ float Unit::GetCombatRatingReduction(CombatRating cr) const
{
if (GetTypeId() == TYPEID_PLAYER)
return ((Player const*)this)->GetRatingBonusValue(cr);
else if (((Creature const*)this)->isPet())
else if (((Creature const*)this)->IsPet())
{
// Player's pet get 100% resilience from owner
if (Unit* owner = GetOwner())