// Token: 0x06001AF0 RID: 6896 RVA: 0x00072584 File Offset: 0x00070784
        public static TeamMask AllExcept(TeamIndex teamIndexToExclude)
        {
            TeamMask result = TeamMask.all;

            result.RemoveTeam(teamIndexToExclude);
            return(result);
        }
 public void FixedUpdate()
 {
     if (!Body.HasBuff(EliteBuffIndex))
     {
         UnityEngine.Object.Destroy(Overlay);
         UnityEngine.Object.Destroy(this);
     }
     if (PulseTimer > 0)
     {
         PulseTimer -= Time.fixedDeltaTime;
         if (PulseTimer <= 0)
         {
             RoR2.TeamMask  enemyTeams = RoR2.TeamMask.GetEnemyTeams(Body.teamComponent.teamIndex);
             RoR2.HurtBox[] hurtBoxes  = new RoR2.SphereSearch
             {
                 radius = 40,
                 mask   = RoR2.LayerIndex.entityPrecise.mask,
                 origin = Body.corePosition
             }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(enemyTeams).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes();
             foreach (RoR2.HurtBox enemyHurtbox in hurtBoxes)
             {
                 var enemyHealthComponent = enemyHurtbox.healthComponent;
                 if (enemyHealthComponent)
                 {
                     var enemyBody = enemyHealthComponent.body;
                     if (enemyBody)
                     {
                         RaycastHit raycastHit;
                         var        rayCast = RoR2.Util.CharacterRaycast(Body.gameObject, new Ray(Body.corePosition, enemyBody.corePosition - Body.corePosition), out raycastHit, 40, RoR2.LayerIndex.entityPrecise.mask | RoR2.LayerIndex.world.mask, QueryTriggerInteraction.Ignore);
                         if (rayCast && raycastHit.collider)
                         {
                             var hurtbox = raycastHit.collider.GetComponent <RoR2.HurtBox>();
                             if (hurtbox && hurtbox.healthComponent)
                             {
                                 var body = hurtbox.healthComponent.body;
                                 if (body == enemyBody)
                                 {
                                     if (NetworkServer.active)
                                     {
                                         RoR2.EffectManager.SimpleEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/IgniteExplosionVFX"), enemyBody.corePosition, RoR2.Util.QuaternionSafeLookRotation(Body.corePosition - enemyBody.corePosition), true);
                                     }
                                     RoR2.DotController.InflictDot(enemyBody.gameObject, Body.gameObject, RoR2.DotController.DotIndex.Burn, 2);
                                 }
                             }
                         }
                     }
                 }
             }
             PulseTimer = 1;
         }
     }
 }
        /// <summary>
        /// Returns a point above a hit enemy at the distance specified. If it collides with the world before that point, it returns that point instead.
        /// </summary>
        /// <param name="damageInfo"></param>
        /// <param name="distanceAboveTarget"></param>
        /// <returns></returns>
        public static Vector3?AboveTargetVectorFromDamageInfo(DamageInfo damageInfo, float distanceAboveTarget)
        {
            if (damageInfo.rejected || !damageInfo.attacker)
            {
                return(null);
            }


            var attackerBody = damageInfo.attacker.GetComponent <CharacterBody>();

            if (attackerBody)
            {
                RoR2.TeamMask enemyTeams = RoR2.TeamMask.GetEnemyTeams(attackerBody.teamComponent.teamIndex);
                HurtBox       hurtBox    = new RoR2.SphereSearch
                {
                    radius = 1,
                    mask   = RoR2.LayerIndex.entityPrecise.mask,
                    origin = damageInfo.position
                }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(enemyTeams).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes().FirstOrDefault();

                if (hurtBox)
                {
                    if (hurtBox.healthComponent && hurtBox.healthComponent.body)
                    {
                        var body = hurtBox.healthComponent.body;

                        var closestPointOnBounds = body.mainHurtBox.collider.ClosestPointOnBounds(body.transform.position + new Vector3(0, 10000, 0));

                        var raycastPoint = RaycastToDirection(closestPointOnBounds, distanceAboveTarget, Vector3.up, LayerIndex.world.mask);
                        if (raycastPoint.HasValue)
                        {
                            return(raycastPoint.Value);
                        }
                        else
                        {
                            return(closestPointOnBounds + (Vector3.up * distanceAboveTarget));
                        }
                    }
                }
            }

            return(null);
        }
Esempio n. 4
0
        private void ForceFeedPotion(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self)
        {
            if (NetworkServer.active)
            {
                var InventoryCount = GetCount(self);
                if (InventoryCount > 0)
                {
                    if (!self.HasBuff(AccursedPotionSipCooldownDebuff) && self.activeBuffsListCount <= maxEffectsAccrued)
                    {
                        BuffIndex ChosenBuff = RoR2.BuffCatalog.buffDefs[random.RangeInt(0, RoR2.BuffCatalog.buffCount - 1)].buffIndex;
                        if (RoR2.BuffCatalog.GetBuffDef(ChosenBuff).iconPath != null && ChosenBuff != BuffIndex.Immune && ChosenBuff != BuffIndex.HiddenInvincibility)
                        {
                            var BuffCount = RoR2.BuffCatalog.GetBuffDef(ChosenBuff).canStack ? InventoryCount : 1;

                            var            randomEffectDuration = random.RangeFloat(10, 20);
                            RoR2.TeamMask  enemyTeams           = RoR2.TeamMask.GetEnemyTeams(self.teamComponent.teamIndex);
                            RoR2.HurtBox[] hurtBoxes            = new RoR2.SphereSearch
                            {
                                radius = baseRadiusGranted + (additionalRadiusGranted * (InventoryCount - 1)),
                                mask   = RoR2.LayerIndex.entityPrecise.mask,
                                origin = self.corePosition
                            }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(enemyTeams).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes();

                            for (int i = 0; i < hurtBoxes.Length; i++)
                            {
                                var body = hurtBoxes[i].healthComponent.body;
                                if (body)
                                {
                                    AddBuffAndDot(ChosenBuff, randomEffectDuration, BuffCount, body);
                                }
                            }
                            AddBuffAndDot(AccursedPotionSipCooldownDebuff, baseSipCooldownDuration * (float)Math.Pow(additionalStackSipCooldownReductionPercentage, InventoryCount - 1), 1, self);
                            AddBuffAndDot(ChosenBuff, randomEffectDuration, BuffCount, self);
                        }
                    }
                }
            }
            orig(self);
        }