Exemplo n.º 1
0
        public void UpdateTargetDamage(LogicGameObject target, int damage)
        {
            if (target != null && !this.m_dummy && target.GetHitpointComponent() != null)
            {
                int totalDamage = damage;

                if (LogicCombatComponent.IsPreferredTarget(this.m_preferredTarget, target))
                {
                    totalDamage = damage * this.m_preferredTargetDamageMod / 100;
                }

                if (totalDamage >= 0 || target.GetData().GetDataType() == LogicDataType.HERO &&
                    (totalDamage = totalDamage * LogicDataTables.GetGlobals().GetHeroHealMultiplier() / 100) > 0 || !target.IsPreventsHealing())
                {
                    if (this.m_damageRadius <= 0)
                    {
                        target.GetHitpointComponent().CauseDamage(totalDamage, this.m_groupsId, this.m_groups);
                    }
                    else
                    {
                        this.m_level.AreaDamage(this.m_groupsId, target.GetMidX(), target.GetMidY(), this.m_damageRadius, damage, this.m_preferredTarget,
                                                this.m_preferredTargetDamageMod, this.m_hitEffect, this.m_myTeam, this.m_unk160, this.m_flyingTarget ? 0 : 1, 0, this.m_pushBack,
                                                this.m_gravity, false, 100, 0, this.m_groups, 100, 0);
                    }
                }

                int slowdownDefensePercent = this.GetProjectileData().GetSlowdownDefensePercent();

                if (slowdownDefensePercent > 0 && target.GetGameObjectType() == LogicGameObjectType.BUILDING)
                {
                    LogicCombatComponent combatComponent = target.GetCombatComponent();

                    if (combatComponent != null)
                    {
                        combatComponent.Boost(100, -slowdownDefensePercent, 120);
                    }
                }
            }
        }