Example #1
0
        private void GlobalEventManager_ServerDamageDealt(On.RoR2.GlobalEventManager.orig_ServerDamageDealt orig, DamageReport damageReport)
        {
            orig(damageReport);
            if (damageReport.attacker == null || damageReport.victimBody == null)
            {
                return;
            }
            CharacterBody attacker = damageReport.attackerBody;
            CharacterBody victim   = damageReport.victimBody;

            if (damageReport.victimIsBoss)
            {
                var attackerIndex = attacker.GetUserName();
                if (map.ContainsKey(attackerIndex))
                {
                    map[attackerIndex] += damageReport.damageDealt;
                }
                else
                {
                    map.Add(attackerIndex, damageReport.damageDealt);
                }
                bossName          = victim.GetUserName();
                totalDamageDealt += damageReport.damageDealt;
            }
        }
        private static void GlobalEventManager_ServerDamageDealt(On.RoR2.GlobalEventManager.orig_ServerDamageDealt orig, DamageReport damageReport)
        {
            orig(damageReport);

            if ((damageReport.attackerBody) && damageReport.dotType == DotController.DotIndex.None && damageReport.attackerBody.HasBuff(_buffIndex))
            {
                damageReport.victimBody.AddTimedBuff(BuffIndex.Blight, 2f);
                DotController.InflictDot(damageReport.victimBody.gameObject, damageReport.attacker, DotController.DotIndex.Blight, 2f, 1f);
            }
        }
Example #3
0
        private void Event_ServerDamageDealt(On.RoR2.GlobalEventManager.orig_ServerDamageDealt orig, DamageReport damageReport)
        {
            orig(damageReport);

            DamageReportHandler damageReportHandler = new DamageReportHandler(damageReport);

            Chat.SimpleChatMessage chatMessage = null;
            int hitPointPercentage             = ConfigHpPercentageFilter.Value;

            string teamEntityLabel;
            string enemyEntityLabel;

            if (!damageReportHandler.VictimIsInPlayerTeam() || damageReport.damageInfo.rejected)
            {
                return;
            }

            teamEntityLabel = GetTeamEntityLabel(damageReportHandler.Victim);
            if (teamEntityLabel == null)
            {
                return;
            }

            // Fall Damage
            if (damageReportHandler.CheckIfFallDamageBroadcast(hitPointPercentage) &&
                AtLeastOnePlayerTeamLogEnabled() &&
                LogFallDamage())
            {
                chatMessage = ComposeNewFallDamageMessage(teamEntityLabel, damageReportHandler.Damage);
            }
            // Shrines of Blood
            else if (damageReportHandler.CheckIfShrineBloodDamageBroadcast(hitPointPercentage) &&
                     AtLeastOnePlayerTeamLogEnabled() &&
                     LogShrinesOfBlood())
            {
                chatMessage = ComposeNewShrineOfBloodMessage(teamEntityLabel, damageReportHandler.Damage);
            }
            // DoT Debuffs
            else if (tickDebuffHandler.IsTickDamageEvent(damageReportHandler) &&
                     AtLeastOnePlayerTeamLogEnabled() &&
                     LogDebuffs())
            {
                enemyEntityLabel = tickDebuffHandler.ComposeLabel(damageReportHandler.TickingDebuffIndex);
                if (enemyEntityLabel == null)
                {
                    return;
                }
                chatMessage = ComposeNewDebuffInfoMessage(enemyEntityLabel, teamEntityLabel);
            }
            // Normal Damage
            else if (damageReportHandler.CheckIfDamageBroadcast(hitPointPercentage) &&
                     damageReportHandler.Attacker != null &&
                     AtLeastOnePlayerTeamLogEnabled())
            {
                BuffIndex attackerBuff = GetAttackerEliteBuff(damageReportHandler.Attacker);
                enemyEntityLabel = ComposeEnemyEntitiyLabel(damageReportHandler, attackerBuff);
                if (enemyEntityLabel == null)
                {
                    return;
                }
                chatMessage = ComposeNewHitInfoMessage(enemyEntityLabel, teamEntityLabel, damageReportHandler.Damage);
            }

            if (chatMessage != null)
            {
                Chat.SendBroadcastChat(chatMessage);
            }
        }