// Token: 0x06000A4F RID: 2639 RVA: 0x0002D0EC File Offset: 0x0002B2EC
 private void OnDotStackRemovedServer(DotController.DotStack dotStack)
 {
     DotController.DotDef dotDef = dotStack.dotDef;
     if (dotDef.associatedBuff != BuffIndex.None && this.victimBody)
     {
         this.victimBody.RemoveBuff(dotDef.associatedBuff);
     }
 }
        // Token: 0x06000A51 RID: 2641 RVA: 0x0002D158 File Offset: 0x0002B358
        private void EvaluateDotStacksForType(DotController.DotIndex dotIndex, float dt, out int remainingActive)
        {
            List <DotController.PendingDamage> list = new List <DotController.PendingDamage>();

            remainingActive = 0;
            DotController.DotDef dotDef = this.GetDotDef(dotIndex);
            for (int i = this.dotStackList.Count - 1; i >= 0; i--)
            {
                DotController.DotStack dotStack = this.dotStackList[i];
                if (dotStack.dotIndex == dotIndex)
                {
                    dotStack.timer -= dt;
                    DotController.AddPendingDamageEntry(list, dotStack.attackerObject, dotStack.damage, dotStack.damageType);
                    if (dotStack.timer <= 0f)
                    {
                        this.RemoveDotStackAtServer(i);
                    }
                    else
                    {
                        remainingActive++;
                    }
                }
            }
            if (this.victimObject && this.victimHealthComponent)
            {
                Vector3 corePosition = this.victimBody.corePosition;
                for (int j = 0; j < list.Count; j++)
                {
                    DamageInfo damageInfo = new DamageInfo();
                    damageInfo.attacker         = list[j].attackerObject;
                    damageInfo.crit             = false;
                    damageInfo.damage           = list[j].totalDamage;
                    damageInfo.force            = Vector3.zero;
                    damageInfo.inflictor        = base.gameObject;
                    damageInfo.position         = corePosition;
                    damageInfo.procCoefficient  = 0f;
                    damageInfo.damageColorIndex = dotDef.damageColorIndex;
                    damageInfo.damageType       = list[j].damageType;
                    damageInfo.dotIndex         = dotIndex;
                    this.victimHealthComponent.TakeDamage(damageInfo);
                }
            }
        }
        private void AddDot(GameObject attackerObject, float duration, DotController.DotIndex dotIndex, float damageMultiplier)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.DotController::AddDot(UnityEngine.GameObject,System.Single,RoR2.DotController/DotIndex,System.Single)' called on client");
                return;
            }
            if (dotIndex < DotController.DotIndex.Bleed || dotIndex >= DotController.DotIndex.Count)
            {
                return;
            }
            TeamIndex     teamIndex = TeamIndex.Neutral;
            float         num       = 0f;
            TeamComponent component = attackerObject.GetComponent <TeamComponent>();

            if (component)
            {
                teamIndex = component.teamIndex;
            }
            CharacterBody component2 = attackerObject.GetComponent <CharacterBody>();

            if (component2)
            {
                num = component2.damage;
            }
            DotController.DotDef   dotDef   = DotController.dotDefs[(int)dotIndex];
            DotController.DotStack dotStack = new DotController.DotStack
            {
                dotIndex       = dotIndex,
                dotDef         = dotDef,
                attackerObject = attackerObject,
                attackerTeam   = teamIndex,
                timer          = duration,
                damage         = dotDef.damageCoefficient * num * damageMultiplier,
                damageType     = DamageType.Generic
            };
            switch (dotIndex)
            {
            case DotController.DotIndex.Helfire:
            {
                if (!component2)
                {
                    return;
                }
                HealthComponent healthComponent = component2.healthComponent;
                if (!healthComponent)
                {
                    return;
                }
                dotStack.damage = healthComponent.fullHealth * 0.01f * damageMultiplier;
                if (this.victimObject == attackerObject)
                {
                    dotStack.damageType |= (DamageType.NonLethal | DamageType.Silent);
                }
                else if (this.victimTeam == teamIndex)
                {
                    dotStack.damage *= 0.5f;
                }
                else
                {
                    dotStack.damage *= 24f;
                }
                int i     = 0;
                int count = this.dotStackList.Count;
                while (i < count)
                {
                    if (this.dotStackList[i].dotIndex == DotController.DotIndex.Helfire && this.dotStackList[i].attackerObject == attackerObject)
                    {
                        this.dotStackList[i].timer  = Mathf.Max(this.dotStackList[i].timer, duration);
                        this.dotStackList[i].damage = dotStack.damage;
                        return;
                    }
                    i++;
                }
                if (this.victimBody)
                {
                    EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/HelfireIgniteEffect"), new EffectData
                        {
                            origin = this.victimBody.corePosition
                        }, true);
                }
                break;
            }

            case DotController.DotIndex.PercentBurn:
                dotStack.damage = Mathf.Min(dotStack.damage, this.victimBody.healthComponent.fullCombinedHealth * 0.01f);
                break;

            case DotController.DotIndex.Poison:
            {
                float a = this.victimHealthComponent.fullCombinedHealth / 100f * 1f * dotDef.interval;
                dotStack.damage     = Mathf.Min(Mathf.Max(a, dotStack.damage), dotStack.damage * 50f);
                dotStack.damageType = DamageType.NonLethal;
                int j      = 0;
                int count2 = this.dotStackList.Count;
                while (j < count2)
                {
                    if (this.dotStackList[j].dotIndex == DotController.DotIndex.Poison)
                    {
                        this.dotStackList[j].timer  = Mathf.Max(this.dotStackList[j].timer, duration);
                        this.dotStackList[j].damage = dotStack.damage;
                        return;
                    }
                    j++;
                }
                bool flag = false;
                for (int k = 0; k < this.dotStackList.Count; k++)
                {
                    if (this.dotStackList[k].dotIndex == DotController.DotIndex.Poison)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag && component2 != null)
                {
                    CharacterMaster master = component2.master;
                    if (master != null)
                    {
                        PlayerStatsComponent playerStatsComponent = master.playerStatsComponent;
                        if (playerStatsComponent != null)
                        {
                            playerStatsComponent.currentStats.PushStatValue(StatDef.totalCrocoInfectionsInflicted, 1UL);
                        }
                    }
                }
                break;
            }
            }
            this.dotStackList.Add(dotStack);
            this.OnDotStackAddedServer(dotStack);
        }
 // Token: 0x06000A50 RID: 2640 RVA: 0x0002D128 File Offset: 0x0002B328
 private void RemoveDotStackAtServer(int i)
 {
     DotController.DotStack dotStack = this.dotStackList[i];
     this.dotStackList.RemoveAt(i);
     this.OnDotStackRemovedServer(dotStack);
 }
Exemple #5
0
        private void AddDot(GameObject attackerObject, float duration, DotController.DotIndex dotIndex, float damageMultiplier)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.DotController::AddDot(UnityEngine.GameObject,System.Single,RoR2.DotController/DotIndex,System.Single)' called on client");
                return;
            }
            if (dotIndex < DotController.DotIndex.Bleed || dotIndex >= DotController.DotIndex.Count)
            {
                return;
            }
            TeamIndex     teamIndex = TeamIndex.Neutral;
            float         num       = 0f;
            TeamComponent component = attackerObject.GetComponent <TeamComponent>();

            if (component)
            {
                teamIndex = component.teamIndex;
            }
            CharacterBody component2 = attackerObject.GetComponent <CharacterBody>();

            if (component2)
            {
                num = component2.damage;
            }
            DotController.DotDef   dotDef   = DotController.dotDefs[(int)dotIndex];
            DotController.DotStack dotStack = new DotController.DotStack
            {
                dotIndex       = dotIndex,
                dotDef         = dotDef,
                attackerObject = attackerObject,
                attackerTeam   = teamIndex,
                timer          = duration,
                damage         = dotDef.damageCoefficient * num * damageMultiplier,
                damageType     = DamageType.Generic
            };
            if (dotIndex == DotController.DotIndex.Helfire)
            {
                if (!component2)
                {
                    return;
                }
                HealthComponent healthComponent = component2.healthComponent;
                if (!healthComponent)
                {
                    return;
                }
                dotStack.damage = healthComponent.fullHealth * 0.01f * damageMultiplier;
                if (this.victimObject == attackerObject)
                {
                    dotStack.damageType |= (DamageType.NonLethal | DamageType.Silent);
                }
                else if (this.victimTeam == teamIndex)
                {
                    dotStack.damage *= 0.5f;
                }
                else
                {
                    dotStack.damage *= 24f;
                }
                int i     = 0;
                int count = this.dotStackList.Count;
                while (i < count)
                {
                    if (this.dotStackList[i].dotIndex == DotController.DotIndex.Helfire && this.dotStackList[i].attackerObject == attackerObject)
                    {
                        this.dotStackList[i].timer  = Mathf.Max(this.dotStackList[i].timer, duration);
                        this.dotStackList[i].damage = dotStack.damage;
                        return;
                    }
                    i++;
                }
                if (this.victimBody)
                {
                    EffectManager.instance.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/HelfireIgniteEffect"), new EffectData
                    {
                        origin = this.victimBody.corePosition
                    }, true);
                }
            }
            this.dotStackList.Add(dotStack);
        }