예제 #1
0
        public bool IsTickDamageEvent(DamageReportHandler damageReportHandler)
        {
            CharacterBody victim = damageReportHandler.Victim;

            EnsureIsCachedAndAlive(victim);

            if (!TickDebuffCache.ContainsKey(GetVictimNetworkUserId(victim)))
            {
                return(false);
            }

            switch (damageReportHandler.TickingDebuffIndex)
            {
            case (DotController.DotIndex.Burn):
                if (!victim.HasBuff(BuffIndex.OnFire) && IsCached(victim, DotController.DotIndex.Burn))
                {
                    RemoveDebuff(victim, DotController.DotIndex.Burn);
                    return(false);
                }
                return(CheckNew(victim, DotController.DotIndex.Burn));

            case (DotController.DotIndex.PercentBurn):
                if (!victim.HasBuff(BuffIndex.OnFire) && IsCached(victim, DotController.DotIndex.PercentBurn))
                {
                    RemoveDebuff(victim, DotController.DotIndex.PercentBurn);
                    return(false);
                }
                return(CheckNew(victim, DotController.DotIndex.PercentBurn));

            case (DotController.DotIndex.Bleed):
                if (!victim.HasBuff(BuffIndex.Bleeding) && IsCached(victim, DotController.DotIndex.Bleed))
                {
                    RemoveDebuff(victim, DotController.DotIndex.Bleed);
                    return(false);
                }
                return(CheckNew(victim, DotController.DotIndex.Bleed));

            case (DotController.DotIndex.Blight):
                if (!victim.HasBuff(BuffIndex.Blight) && IsCached(victim, DotController.DotIndex.Blight))
                {
                    RemoveDebuff(victim, DotController.DotIndex.Blight);
                    return(false);
                }
                return(CheckNew(victim, DotController.DotIndex.Blight));

            case (DotController.DotIndex.Poison):
                if (!victim.HasBuff(BuffIndex.Poisoned) && IsCached(victim, DotController.DotIndex.Poison))
                {
                    RemoveDebuff(victim, DotController.DotIndex.Poison);
                    return(false);
                }
                return(CheckNew(victim, DotController.DotIndex.Poison));

            default:
                return(false);
            }
        }
예제 #2
0
        private string __ComposeEnemyEntitiyLabel(DamageReportHandler damageReportHandler, string hexColor, string affixLabel)
        {
            string name = damageReportHandler.Attacker.GetDisplayName();

            if (damageReportHandler.AttackIsFriendlyFire() && IsRealPlayer(damageReportHandler.Attacker))
            {
                name = damageReportHandler.Attacker.GetUserName();
            }

            return($"<color={hexColor}>{(affixLabel == "" ? "" : affixLabel + " ")}{name}</color>");
        }
예제 #3
0
        private string ComposeEnemyEntitiyLabel(DamageReportHandler damageReportHandler, BuffIndex buffIndex)
        {
            switch (buffIndex)
            {
            case BuffIndex.AffixBlue:
                return(__ComposeEnemyEntitiyLabel(damageReportHandler, "#0066cc", "Overloading"));

            case BuffIndex.AffixRed:
                return(__ComposeEnemyEntitiyLabel(damageReportHandler, "#b30000", "Blazing"));

            case BuffIndex.AffixHaunted:
                return(__ComposeEnemyEntitiyLabel(damageReportHandler, "#99ffbb", "Celestine"));

            case BuffIndex.AffixPoison:
                return(__ComposeEnemyEntitiyLabel(damageReportHandler, "#008000", "Malachite"));

            case BuffIndex.AffixWhite:
                return(__ComposeEnemyEntitiyLabel(damageReportHandler, "#98e4ed", "Glacial"));

            default:
                return(__ComposeEnemyEntitiyLabel(damageReportHandler, DefaultHighlightColor, ""));
            }
        }
예제 #4
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);
            }
        }