bool RPG_Projectile_Healing::ShouldHit(RPG_DamageableEntity* target) { if(!target) { // pass through non-entities return false; } if(target == m_characterOwner) { // pass through firing character return false; } if(m_targetToTrack && target != m_targetToTrack) { // hit only tracked target return false; } if(target->IsFrom(RPG_Character)) { RPG_Character* targetCharacter = static_cast<RPG_Character*>(target); if(targetCharacter->GetTeam() == m_characterOwner->GetTeam()) { return true; } } return true; }
bool RPG_Projectile::ShouldHit(RPG_DamageableEntity* target) { VASSERT_MSG(m_characterOwner, "Please set your projectile's character owner."); if(!target || !m_characterOwner) { return true; } if(target->IsFrom(RPG_Character)) { RPG_Character* targetCharacter = static_cast<RPG_Character*>(target); if(targetCharacter->GetTeam() != m_characterOwner->GetTeam()) { return true; } } else if(target->Components().GetComponentOfType<RPG_AttackableComponent>()) { return true; } return false; }