Ejemplo n.º 1
0
        private static string GetDamageText(TotalDamageInfo totalDamageInfo, float targetMaxHp)
        {
            string text = "";

            if (totalDamageInfo.physicalDamage > 0)
            {
                text += GetDamageSubText("Physical: ", totalDamageInfo.physicalDamage, targetMaxHp);
            }

            if (totalDamageInfo.magicalDamage > 0)
            {
                text += GetDamageSubText("Magical: ", totalDamageInfo.magicalDamage, targetMaxHp);
            }

            if (totalDamageInfo.mixedDamage > 0)
            {
                text += GetDamageSubText("Mixed: ", totalDamageInfo.mixedDamage, targetMaxHp);
            }

            if (totalDamageInfo.trueDamage > 0)
            {
                text += GetDamageSubText("True: ", totalDamageInfo.trueDamage, targetMaxHp);
            }

            return(text);
        }
Ejemplo n.º 2
0
        private static void RecalculateFinalDamage(bool clearCache = false)
        {
            CleanDamageCache();
            totalDamageTaken.ResetDamage();
            totalDamageDealt.ResetDamage();

            finalDamage = new Dictionary <string, TotalDamageInfo>();
            foreach (var damageInfo in dmgCache)
            {
                TotalDamageInfo totalDamage;
                if (finalDamage.TryGetValue(damageInfo.sourceName, out totalDamage))
                {
                    IncrementTotalDamage(damageInfo, ref totalDamage);
                }
                else
                {
                    totalDamage = new TotalDamageInfo(damageInfo.sourceID, damageInfo.sourceName);
                    IncrementTotalDamage(damageInfo, ref totalDamage);
                    finalDamage.Add(damageInfo.sourceName, totalDamage);
                }
                IncrementTotalDamage(damageInfo, ref totalDamageTaken);
            }

            myFinalDamage = new Dictionary <int, TotalDamageInfo>();
            foreach (var damageInfo in myDmgCache)
            {
                TotalDamageInfo totalDamage;
                if (myFinalDamage.TryGetValue(damageInfo.sourceID, out totalDamage))
                {
                    IncrementTotalDamage(damageInfo, ref totalDamage);
                }
                else
                {
                    totalDamage = new TotalDamageInfo(damageInfo.sourceID, damageInfo.sourceName);
                    IncrementTotalDamage(damageInfo, ref totalDamage);
                    myFinalDamage.Add(damageInfo.sourceID, totalDamage);
                }
                IncrementTotalDamage(damageInfo, ref totalDamageDealt);
            }

            orderedFinalDamage   = finalDamage.Values.OrderByDescending(value => value.totalDamage).ToList();
            orderedMyFinalDamage = myFinalDamage.Values.OrderByDescending(value => value.totalDamage).ToList();

            if (clearCache)
            {
                Utility.DelayAction.Add(5000, () => dmgCache.Clear());
                Utility.DelayAction.Add(5000, () => myDmgCache.Clear());
            }
        }
Ejemplo n.º 3
0
        private static void IncrementTotalDamage(DamageInfo damageInfo, ref TotalDamageInfo totalDamage)
        {
            if (damageInfo.type == DamageType.Magical)
            {
                totalDamage.magicalDamage += damageInfo.damageValue;
            }
            else if (damageInfo.type == DamageType.Physical)
            {
                totalDamage.physicalDamage += damageInfo.damageValue;
            }
            else if (damageInfo.type == DamageType.True)
            {
                totalDamage.trueDamage += damageInfo.damageValue;
            }
            else
            {
                totalDamage.mixedDamage += damageInfo.damageValue;
            }

            totalDamage.totalDamage += damageInfo.damageValue;
            totalDamage.comboCount  += 1;
        }
Ejemplo n.º 4
0
        private static string GetDamageText(TotalDamageInfo totalDamageInfo, float targetMaxHp)
        {
            string text = "";
                        
            if (totalDamageInfo.physicalDamage > 0)
            {
                text += GetDamageSubText("Physical: ", totalDamageInfo.physicalDamage, targetMaxHp);
            }

            if (totalDamageInfo.magicalDamage > 0)
            {
                text += GetDamageSubText("Magical: ", totalDamageInfo.magicalDamage, targetMaxHp);
            }

            if (totalDamageInfo.mixedDamage > 0)
            {
                text += GetDamageSubText("Mixed: ", totalDamageInfo.mixedDamage, targetMaxHp);
            }

            if (totalDamageInfo.trueDamage > 0)
            {
                text += GetDamageSubText("True: ", totalDamageInfo.trueDamage, targetMaxHp);
            }

            return text;
        }
Ejemplo n.º 5
0
        private static void RecalculateFinalDamage(bool clearCache = false)
        {
            CleanDamageCache();
            totalDamageTaken.ResetDamage();
            totalDamageDealt.ResetDamage();

            finalDamage = new Dictionary<string, TotalDamageInfo>();
            foreach (var damageInfo in dmgCache)
            {
                TotalDamageInfo totalDamage;
                if (finalDamage.TryGetValue(damageInfo.sourceName, out totalDamage))
                {
                    IncrementTotalDamage(damageInfo, ref totalDamage);
                }
                else
                {
                    totalDamage = new TotalDamageInfo(damageInfo.sourceID, damageInfo.sourceName);
                    IncrementTotalDamage(damageInfo, ref totalDamage);
                    finalDamage.Add(damageInfo.sourceName, totalDamage);

                }
                IncrementTotalDamage(damageInfo, ref totalDamageTaken);
            }

            myFinalDamage = new Dictionary<int, TotalDamageInfo>();
            foreach (var damageInfo in myDmgCache)
            {
                TotalDamageInfo totalDamage;
                if (myFinalDamage.TryGetValue(damageInfo.sourceID, out totalDamage))
                {
                    IncrementTotalDamage(damageInfo, ref totalDamage);
                }
                else
                {
                    totalDamage = new TotalDamageInfo(damageInfo.sourceID, damageInfo.sourceName);
                    IncrementTotalDamage(damageInfo, ref totalDamage);
                    myFinalDamage.Add(damageInfo.sourceID, totalDamage);

                }
                IncrementTotalDamage(damageInfo, ref totalDamageDealt);
            }

            orderedFinalDamage = finalDamage.Values.OrderByDescending(value => value.totalDamage).ToList();
            orderedMyFinalDamage = myFinalDamage.Values.OrderByDescending(value => value.totalDamage).ToList();

            if (clearCache)
            {
                Utility.DelayAction.Add(5000, () => dmgCache.Clear());
                Utility.DelayAction.Add(5000, () => myDmgCache.Clear());
            }
        }
Ejemplo n.º 6
0
        private static void IncrementTotalDamage(DamageInfo damageInfo, ref TotalDamageInfo totalDamage)
        {
            if (damageInfo.type == DamageType.Magical)
            {
                totalDamage.magicalDamage += damageInfo.damageValue;
            }
            else if (damageInfo.type == DamageType.Physical)
            {
                totalDamage.physicalDamage += damageInfo.damageValue;
            }
            else if (damageInfo.type == DamageType.True)
            {
                totalDamage.trueDamage += damageInfo.damageValue;
            }
            else
            {
                totalDamage.mixedDamage += damageInfo.damageValue;
            }

            totalDamage.totalDamage += damageInfo.damageValue;
            totalDamage.comboCount += 1;
        }