Beispiel #1
0
 // Token: 0x06002147 RID: 8519 RVA: 0x00090090 File Offset: 0x0008E290
 private void DoSearch()
 {
     if (this.ai.body)
     {
         Ray aimRay = this.ai.bodyInputBank.GetAimRay();
         this.search.viewer = this.ai.body;
         this.search.filterByDistinctEntity = true;
         this.search.filterByLoS            = false;
         this.search.maxDistanceFilter      = float.PositiveInfinity;
         this.search.minDistanceFilter      = 0f;
         this.search.maxAngleFilter         = 360f;
         this.search.searchDirection        = aimRay.direction;
         this.search.searchOrigin           = aimRay.origin;
         this.search.sortMode = BullseyeSearch.SortMode.Distance;
         this.search.queryTriggerInteraction = QueryTriggerInteraction.UseGlobal;
         TeamMask none = TeamMask.none;
         none.AddTeam(this.ai.master.teamIndex);
         this.search.teamMaskFilter = none;
         this.search.RefreshCandidates();
         this.search.FilterOutGameObject(this.ai.body.gameObject);
         BaseAI.Target customTarget = this.ai.customTarget;
         HurtBox       hurtBox      = this.search.GetResults().Where(new Func <HurtBox, bool>(this.TargetPassesFilters)).FirstOrDefault <HurtBox>();
         customTarget.gameObject = ((hurtBox != null) ? hurtBox.healthComponent.gameObject : null);
     }
 }
Beispiel #2
0
        private void GetCurrentTargetInfo(out HurtBox currentTargetHurtBox, out HealthComponent currentTargetHealthComponent)
        {
            Ray aimRay = base.GetAimRay();

            this.search.filterByDistinctEntity = true;
            this.search.filterByLoS            = true;
            this.search.minDistanceFilter      = 0f;
            this.search.maxDistanceFilter      = Paint.maxDistance;
            this.search.minAngleFilter         = 0f;
            this.search.maxAngleFilter         = Paint.maxAngle;
            this.search.viewer          = base.characterBody;
            this.search.searchOrigin    = aimRay.origin;
            this.search.searchDirection = aimRay.direction;
            this.search.sortMode        = BullseyeSearch.SortMode.DistanceAndAngle;
            this.search.teamMaskFilter  = TeamMask.GetUnprotectedTeams(base.GetTeam());
            this.search.RefreshCandidates();
            this.search.FilterOutGameObject(base.gameObject);
            foreach (HurtBox hurtBox in this.search.GetResults())
            {
                if (hurtBox.healthComponent && hurtBox.healthComponent.alive)
                {
                    currentTargetHurtBox         = hurtBox;
                    currentTargetHealthComponent = hurtBox.healthComponent;
                    return;
                }
            }
            currentTargetHurtBox         = null;
            currentTargetHealthComponent = null;
        }
Beispiel #3
0
        private void SiphonNearbyController_SearchForTargets(On.RoR2.SiphonNearbyController.orig_SearchForTargets orig, SiphonNearbyController self, List <HurtBox> dest)
        {
            orig(self, dest);
            self.sphereSearch.ClearCandidates();
            self.sphereSearch.RefreshCandidates();
            self.sphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(self.networkedBodyAttachment.attachedBody.teamComponent.teamIndex));
            var destCopy = new List <HurtBox>(dest);

            foreach (var hurtBox in destCopy)
            {
                //Debug.Log("Mired Urn: Checking " + hurtBox.healthComponent.body.GetDisplayName());
                if ((bool)hurtBox.healthComponent?.body?.hasCloakBuff)
                {
                    dest.Remove(hurtBox);
                    //Debug.Log("Removed");
                }
                else
                {
                    //Debug.Log("Kept");
                }
            }
            self.sphereSearch.OrderCandidatesByDistance();
            self.sphereSearch.FilterCandidatesByDistinctHurtBoxEntities();
            self.sphereSearch.GetHurtBoxes(dest);
            self.sphereSearch.ClearCandidates();
        }
Beispiel #4
0
        // Token: 0x06003247 RID: 12871 RVA: 0x000D9538 File Offset: 0x000D7738
        public override void OnEnter()
        {
            base.OnEnter();
            this.totalDuration  = FireSweepBarrage.baseTotalDuration / this.attackSpeedStat;
            this.firingDuration = FireSweepBarrage.baseFiringDuration / this.attackSpeedStat;
            base.characterBody.SetAimTimer(3f);
            base.PlayAnimation("Gesture, Additive", "FireSweepBarrage", "FireSweepBarrage.playbackRate", this.totalDuration);
            base.PlayAnimation("Gesture, Override", "FireSweepBarrage", "FireSweepBarrage.playbackRate", this.totalDuration);
            Util.PlaySound(FireSweepBarrage.enterSound, base.gameObject);
            Ray            aimRay         = base.GetAimRay();
            BullseyeSearch bullseyeSearch = new BullseyeSearch();

            bullseyeSearch.teamMaskFilter    = TeamMask.AllExcept(base.GetTeam());
            bullseyeSearch.maxAngleFilter    = FireSweepBarrage.fieldOfView * 0.5f;
            bullseyeSearch.maxDistanceFilter = FireSweepBarrage.maxDistance;
            bullseyeSearch.searchOrigin      = aimRay.origin;
            bullseyeSearch.searchDirection   = aimRay.direction;
            bullseyeSearch.sortMode          = BullseyeSearch.SortMode.DistanceAndAngle;
            bullseyeSearch.filterByLoS       = true;
            bullseyeSearch.RefreshCandidates();
            this.targetHurtboxes    = bullseyeSearch.GetResults().Where(new Func <HurtBox, bool>(Util.IsValid)).Distinct(default(HurtBox.EntityEqualityComparer)).ToList <HurtBox>();
            this.totalBulletsToFire = Mathf.Max(this.targetHurtboxes.Count, FireSweepBarrage.minimumFireCount);
            this.timeBetweenBullets = this.firingDuration / (float)this.totalBulletsToFire;
            this.childLocator       = base.GetModelTransform().GetComponent <ChildLocator>();
            this.muzzleIndex        = this.childLocator.FindChildIndex(FireSweepBarrage.muzzle);
            this.muzzleTransform    = this.childLocator.FindChild(this.muzzleIndex);
        }
Beispiel #5
0
        // Token: 0x06001F26 RID: 7974 RVA: 0x000875D0 File Offset: 0x000857D0
        private void SearchForTarget()
        {
            this.sphereSearch.origin = this.transform.position;
            this.sphereSearch.radius = this.lookRange;
            this.sphereSearch.mask   = LayerIndex.entityPrecise.mask;
            this.sphereSearch.queryTriggerInteraction = QueryTriggerInteraction.UseGlobal;
            this.sphereSearch.RefreshCandidates();
            this.sphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.AllExcept(this.teamFilter.teamIndex));
            this.sphereSearch.OrderCandidatesByDistance();
            this.sphereSearch.FilterCandidatesByDistinctHurtBoxEntities();
            this.sphereSearch.GetHurtBoxes(ProjectileSphereTargetFinder.foundHurtBoxes);
            HurtBox target = null;

            if (ProjectileSphereTargetFinder.foundHurtBoxes.Count > 0)
            {
                int i     = 0;
                int count = ProjectileSphereTargetFinder.foundHurtBoxes.Count;
                while (i < count)
                {
                    if (this.PassesFilters(ProjectileSphereTargetFinder.foundHurtBoxes[i]))
                    {
                        target = ProjectileSphereTargetFinder.foundHurtBoxes[i];
                        break;
                    }
                    i++;
                }
                ProjectileSphereTargetFinder.foundHurtBoxes.Clear();
            }
            this.SetTarget(target);
        }
            public void Awake()
            {
                holdoutZoneController = GetComponent <HoldoutZoneController>();

                animationCurve = new AnimationCurve
                {
                    keys = new Keyframe[]
                    {
                        new Keyframe(0f, 0f),
                        new Keyframe(0.5f, 1f),
                        new Keyframe(1f, 0f)
                    },
                    preWrapMode  = WrapMode.Clamp,
                    postWrapMode = WrapMode.Clamp
                };

                sphereSearch = new SphereSearch
                {
                    mask   = LayerIndex.entityPrecise.mask,
                    origin = transform.position,
                    queryTriggerInteraction = QueryTriggerInteraction.Collide,
                    radius = 0f
                };
                teamMask = TeamMask.AllExcept(TeamIndex.Player);
            }
Beispiel #7
0
 public override void OnEnter()
 {
     attackSoundString = SummonEggs.attackSoundString;
     spitPrefab        = SummonEggs.spitPrefab;
     guardSpawnCard    = SummonEggs.spawnCard;
     base.OnEnter();
     animator       = GetModelAnimator();
     modelTransform = GetModelTransform();
     childLocator   = modelTransform.GetComponent <ChildLocator>();
     duration       = baseDuration;
     PlayCrossfade("Gesture", "SummonEggs", 0.5f);
     Util.PlaySound(attackSoundString, base.gameObject);
     if (NetworkServer.active)
     {
         enemySearch = new BullseyeSearch();
         enemySearch.filterByDistinctEntity = false;
         enemySearch.filterByLoS            = false;
         enemySearch.maxDistanceFilter      = float.PositiveInfinity;
         enemySearch.minDistanceFilter      = 0f;
         enemySearch.minAngleFilter         = 0f;
         enemySearch.maxAngleFilter         = 180f;
         enemySearch.teamMaskFilter         = TeamMask.GetEnemyTeams(GetTeam());
         enemySearch.sortMode = BullseyeSearch.SortMode.Distance;
         enemySearch.viewer   = base.characterBody;
     }
 }
Beispiel #8
0
 private void FixedUpdate()
 {
     //Tick up the stopwatch
     this.trackerUpdateStopwatch += Time.fixedDeltaTime;
     //If the stopwatch has gone on for .1 seconds...
     if (this.trackerUpdateStopwatch >= 1f / this.trackerUpdateFrequency)
     {
         //Reset the timer
         this.trackerUpdateStopwatch -= 1f / this.trackerUpdateFrequency;
         //Poisoncounter to 0 cause we haven't found any poisoned creatures yet
         this.poisonCounter = 0;
         //Spheresearch it
         foreach (HurtBox hurtBox in new SphereSearch
         {
             origin = characterBody.footPosition,
             radius = this.maxTrackingDistance,
             mask = LayerIndex.entityPrecise.mask
         }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(this.teamComponent.teamIndex)).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes())
         {
             //Get the targets body component
             CharacterBody body = hurtBox.healthComponent.body;
             //Make sure they stats ain't brokeded
             body.RecalculateStats();
             //If they have either buff, tick up the counter
             if (body.HasBuff(RoR2Content.Buffs.Poisoned) || body.HasBuff(RoR2Content.Buffs.Blight))
             {
                 this.poisonCounter += 1;
             }
         }
         //Set the totalpoisoned count to what we found
         this.totalPoisoned = this.poisonCounter;
     }
 }
Beispiel #9
0
 public void ConfigureTargetFinderForEnemies(EquipmentSlot self)
 {
     ConfigureTargetFinderBase(self);
     TargetFinder.teamMaskFilter = TeamMask.GetUnprotectedTeams(self.characterBody.teamComponent.teamIndex);
     TargetFinder.RefreshCandidates();
     TargetFinder.FilterOutGameObject(self.gameObject);
     AdditionalBullseyeFunctionality(TargetFinder);
     PlaceTargetingIndicator(TargetFinder.GetResults());
 }
Beispiel #10
0
        public void Pull()
        {
            //Check if this pulse crits
            this.isCrit = base.RollCrit();
            //Spheresearch
            foreach (HurtBox hurtBox in new SphereSearch
            {
                origin = base.characterBody.corePosition,
                radius = this.baseRadius,
                mask = LayerIndex.entityPrecise.mask
            }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(base.teamComponent.teamIndex)).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes())
            {
                //force calc
                //Get body of the enemy
                CharacterBody body = hurtBox.healthComponent.body;
                //Calc for finding direction
                Vector3 a = hurtBox.transform.position - base.characterBody.corePosition;
                //Determine distance
                float magnitude = a.magnitude;
                //Grab direction
                Vector3 direction = a.normalized;
                //Get mass of enemy
                float mass = body.GetComponent <Rigidbody>().mass;
                //Hold this
                float massEval;
                //If not flying, we can pull harder
                if (!body.isFlying)
                {
                    massEval = mass * -20f - 400f;
                }
                //If flying, pull softer
                else
                {
                    massEval = (mass * -20f - 400f) / 2;
                }
                //Cap the mass evaluation so big creatures don't fly
                float[] maxMass = new float[] { massEval, -6000 };
                //Determine applied force with mass, direction, and magnitude scaling with distance
                Vector3 appliedForce = maxMass.Max() * direction * ((magnitude + 15) / (this.baseRadius * 2));

                //damage
                //Network check
                if (NetworkServer.active)
                {
                    //Prep damage
                    DamageInfo damageInfo = new DamageInfo
                    {
                        attacker         = base.gameObject,
                        inflictor        = base.gameObject,
                        crit             = this.isCrit,
                        damage           = base.damageStat * this.damageCoefficient,
                        damageColorIndex = DamageColorIndex.Default,
                        damageType       = DamageType.Stun1s,
                        force            = appliedForce,
                        procCoefficient  = 0.4f,
                        procChainMask    = default,
        private static void CharacterMotor_OnHitGround(On.RoR2.CharacterMotor.orig_OnHitGround orig, CharacterMotor self, CharacterMotor.HitGroundInfo hitGroundInfo)
        {
            bool hasGoombad        = false;
            bool restoreFallDamage = false;

            if (RunArtifactManager.instance.IsArtifactEnabled(GoombaArtifactDef.artifactIndex))
            {
                if (self.body)
                {
                    if (Math.Abs(hitGroundInfo.velocity.y) >= minFallSpeed)
                    {
                        Chat.AddMessage("Speed: " + Math.Abs(hitGroundInfo.velocity.y) + "/" + minFallSpeed);
                        var bodySearch = new BullseyeSearch() //let's just get the nearest player
                        {
                            viewer         = self.body,
                            sortMode       = BullseyeSearch.SortMode.Distance,
                            teamMaskFilter = TeamMask.GetEnemyTeams(self.body.teamComponent.teamIndex),
                        };
                        bodySearch.RefreshCandidates();
                        Debug.Log("Nearest Enemies: " + bodySearch.GetResults().ToList());

                        var nearestBody = bodySearch.GetResults().ToList();

                        // We very likely landed on an enemy.
                        if (nearestBody.Count > 0)
                        {
                            var firstBody = nearestBody.FirstOrDefault();
                            var distance  = Vector3.Distance(hitGroundInfo.position, Helpers.GetHeadPosition(firstBody.healthComponent.body));
                            if (distance <= maxDistance)
                            {
                                goombaDamageInfo.attacker = self.body.gameObject;
                                firstBody.healthComponent.TakeDamage(goombaDamageInfo);
                                if ((self.body.bodyFlags & CharacterBody.BodyFlags.IgnoreFallDamage) == CharacterBody.BodyFlags.None)
                                {
                                    self.body.bodyFlags |= CharacterBody.BodyFlags.IgnoreFallDamage;
                                    restoreFallDamage    = true;
                                }
                                Chat.AddMessage("Goomba!");
                                hasGoombad = true;
                            }
                        }
                    }
                }
            }
            orig(self, hitGroundInfo);
            if (hasGoombad)
            {
                self.Motor.ForceUnground();
                self.ApplyForce(Vector3.up * bounceForce);
            }
            if (restoreFallDamage)
            {
                self.body.bodyFlags &= ~CharacterBody.BodyFlags.IgnoreFallDamage;
            }
        }
Beispiel #12
0
        private void GenerateSphereSearch(CharacterBody origin, bool getSameTeam = false)
        {
            List <HurtBox> hurtBoxesList = new List <HurtBox>();
            TeamMask       enemyTeams    = TeamMask.GetEnemyTeams(origin.teamComponent.teamIndex);
            SphereSearch   sphereSearch  = new RoR2.SphereSearch()
            {
                mask   = LayerIndex.entityPrecise.mask,
                origin = origin.transform.position,
                queryTriggerInteraction = QueryTriggerInteraction.Collide,
                radius = sphereSearchRadius
            };

#if DEBUG
            TurboEdition._logger.LogWarning(EquipmentName + ": generated " + sphereSearch + " with radius " + sphereSearchRadius + " and origin " + origin.transform);
#endif
            if (!getSameTeam)
            {
#if DEBUG
                TurboEdition._logger.LogWarning(EquipmentName + ": filtering the sphereSearch by enemy teams.");
#endif
                sphereSearch.RefreshCandidates().FilterCandidatesByHurtBoxTeam(enemyTeams).FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes(hurtBoxesList);
            }
            else
            {
#if DEBUG
                TurboEdition._logger.LogWarning(EquipmentName + ": filtering the sphereSearch by SAME TEAM as origin.");
#endif
                TeamMask selfdestructionguaranteed = new TeamMask();
                selfdestructionguaranteed.AddTeam(origin.teamComponent.teamIndex);
                sphereSearch.RefreshCandidates().FilterCandidatesByHurtBoxTeam(selfdestructionguaranteed).FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes(hurtBoxesList);
            }

            for (int i = 0, j = 0; i < hurtBoxesList.Count && j < sphereLinkCount; i++)
            {
                var hc = hurtBoxesList[i].healthComponent;
                if (hc)
                {
                    var body = hc.body;
                    if (body)
                    {
                        var linkGameObject = body.GetComponentInChildren <LinkComponent>()?.gameObject;
#if DEBUG
                        TurboEdition._logger.LogWarning(EquipmentName + ": adding linkedBuff to someone, theres " + (i + 1) + " out of " + hurtBoxesList.Count + " hurtboxes with max " + sphereLinkCount);
#endif
                        body.AddTimedBuff(linkedBuff, linkedBuffDuration);
                        if (!linkGameObject)
                        {
                            //If they dont have a component that means they are brand new and unique
                            //If they do, this doesn't get executed and they just get their debuff updated
                            j++;
                        }
                    }
                }
            }
        }
 // Token: 0x060030AB RID: 12459 RVA: 0x000D1A48 File Offset: 0x000CFC48
 private BullseyeSearch CreateBullseyeSearch(Vector3 origin)
 {
     return(new BullseyeSearch
     {
         searchOrigin = origin,
         filterByDistinctEntity = true,
         maxDistanceFilter = Detonate.blastRadius,
         sortMode = BullseyeSearch.SortMode.Distance,
         maxAngleFilter = 360f,
         teamMaskFilter = TeamMask.AllExcept(base.projectileController.teamFilter.teamIndex)
     });
 }
Beispiel #14
0
 private void SearchForTarget(Ray aimRay)
 {
     this.search.teamMaskFilter    = TeamMask.GetUnprotectedTeams(this.TeamComponent.teamIndex);
     this.search.filterByLoS       = true;
     this.search.searchOrigin      = aimRay.origin;
     this.search.searchDirection   = aimRay.direction;
     this.search.sortMode          = BullseyeSearch.SortMode.Distance;
     this.search.maxDistanceFilter = this.maxTrackingDistance;
     this.search.maxAngleFilter    = this.maxTrackingAngle;
     this.search.RefreshCandidates();
     this.search.FilterOutGameObject(this.gameObject);
     this.trackingTarget = this.search.GetResults().FirstOrDefault <HurtBox>();
 }
            private void FindTarget()
            {
                this.targetFinder.teamMaskFilter = TeamMask.allButNeutral;
                this.targetFinder.teamMaskFilter.RemoveTeam(this.teamIndex);
                this.targetFinder.sortMode    = BullseyeSearch.SortMode.Distance;
                this.targetFinder.filterByLoS = true;
                Ray ray = CameraRigController.ModifyAimRayIfApplicable(characterMaster.GetBody().inputBank.GetAimRay(), base.gameObject, out float num);

                this.targetFinder.searchOrigin    = ray.origin;
                this.targetFinder.searchDirection = ray.direction;
                //this.targetFinder.maxAngleFilter = 10f;
                this.targetFinder.viewer         = characterMaster.GetBody();
                this.targetFinder.teamMaskFilter = TeamMask.GetUnprotectedTeams(teamIndex);
            }
Beispiel #16
0
 internal void GetTargets(Vector3 impactPos)
 {
     //Spheresearch around the spot we hit
     foreach (HurtBox hurtBox in new SphereSearch
     {
         origin = impactPos,
         radius = 25,
         mask = LayerIndex.entityPrecise.mask
     }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(base.GetComponent <TeamComponent>().teamIndex)).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes())
     {
         //Every valid target we find, add them to the hitlist >:)
         this.AddToTargets(hurtBox);
     }
 }
Beispiel #17
0
 internal void AddKill(CharacterBody body)
 {
     foreach (HurtBox hurtBox in new SphereSearch
     {
         origin = characterBody.corePosition,
         radius = 16,
         mask = LayerIndex.entityPrecise.mask
     }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(teamComponent.teamIndex)).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes())
     {
         nearbyEnemies.Add(hurtBox.hurtBoxGroup.mainHurtBox);
     }
     if (nearbyEnemies.Contains(body.mainHurtBox))
     {
         kills += 1;
     }
 }
            private void ServerPulse(TeamIndex teamIndex)
            {
#if DEBUG
                TurboEdition._logger.LogWarning("Server Pulse made.");
#endif
                this.sphereSearch = new RoR2.SphereSearch()
                {
                    mask   = LayerIndex.entityPrecise.mask,                     //This should be ok too
                    origin = owner.transform.position,                          //This should be ok
                    queryTriggerInteraction = QueryTriggerInteraction.Collide,
                    radius = 0f                                                 //it starts with 0 radius, yea
                };
                this.finalRadius = radius;
                this.rate        = 1f / duration;
                this.enemyTeams  = TeamMask.GetEnemyTeams(teamIndex); //inb4 this will give issues with chaos and you will get affected by yourself
            }
        // Token: 0x06002B3E RID: 11070 RVA: 0x000B6404 File Offset: 0x000B4604
        private void FirstPulse()
        {
            Vector3        position       = base.transform.position;
            BullseyeSearch bullseyeSearch = new BullseyeSearch();

            bullseyeSearch.searchOrigin           = position;
            bullseyeSearch.teamMaskFilter         = TeamMask.AllExcept(this.teamIndex);
            bullseyeSearch.maxDistanceFilter      = this.pulseRadius;
            bullseyeSearch.sortMode               = BullseyeSearch.SortMode.Distance;
            bullseyeSearch.filterByLoS            = true;
            bullseyeSearch.filterByDistinctEntity = true;
            bullseyeSearch.RefreshCandidates();
            IEnumerable <HurtBox> results = bullseyeSearch.GetResults();
            int num = 0;

            foreach (HurtBox hurtBox in results)
            {
                num++;
                Vector3    a          = hurtBox.transform.position - position;
                float      magnitude  = a.magnitude;
                Vector3    a2         = a / magnitude;
                Rigidbody  component  = hurtBox.healthComponent.GetComponent <Rigidbody>();
                float      num2       = component ? component.mass : 1f;
                float      num3       = FlowerProjectileHover.yankSuitabilityCurve.Evaluate(num2);
                Vector3    force      = a2 * (num2 * num3 * -FlowerProjectileHover.yankSpeed);
                DamageInfo damageInfo = new DamageInfo
                {
                    attacker         = this.owner,
                    inflictor        = base.gameObject,
                    crit             = this.crit,
                    damage           = this.damage,
                    damageColorIndex = DamageColorIndex.Default,
                    damageType       = this.damageType,
                    force            = force,
                    position         = hurtBox.transform.position,
                    procChainMask    = this.procChainMask,
                    procCoefficient  = this.procCoefficient
                };
                hurtBox.healthComponent.TakeDamage(damageInfo);
            }
            this.healPulseHealthFractionValue = (float)num * FlowerProjectileHover.healthFractionYieldPerHit / (float)(this.pulseCount - 1);
        }
Beispiel #20
0
        //What to do when attempting to richochet the bullet
        private void HandleRichochet(Vector3 pos)
        {
            //Hold variable for whether target is found or not
            bool targetFound = false;

            //If the bullet can still recurse...
            if (this.recursion < this.maxRecursion)
            {
                //Half the damage
                this.damage /= 2;
                //Loop via spheresearch
                foreach (HurtBox hurtBox in new SphereSearch
                {
                    origin = pos,
                    radius = 25f,
                    mask = LayerIndex.entityPrecise.mask,
                }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(base.teamComponent.teamIndex)).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes())
                {
                    //Get the mainhurtbox
                    HurtBox mainBox = hurtBox.hurtBoxGroup.mainHurtBox;
                    //If the mainhurtbox is not yet in our list...
                    if (!hitHurtBoxes.Contains(mainBox))
                    {
                        //Add the found target to the list
                        this.hitHurtBoxes.Add(mainBox);
                        //Trip the bool flag
                        targetFound = true;
                        //Mark that we recursed
                        this.recursion += 1;
                        //Emulate the bullet, because doing another ACTUAL bullet attack is hell and a half, also feels bad to have all your shots miss cause some geometry
                        SimulateBullet(pos, mainBox);
                        //End the loop cause we found our target
                        break;
                    }
                }
                //If we go through having never found a target, max out the recursion so the loop ends completely
                if (!targetFound)
                {
                    this.recursion = this.maxRecursion;
                }
            }
        }
Beispiel #21
0
 public void Attack(TeamMask team, float damage)
 {
     Collider2D[] cols = Physics2D.OverlapCircleAll(
         transform.position, 0.15f, LayerMask.GetMask("Pawn")
         );
     foreach (var col in cols)
     {
         var pawnctl = col.transform.GetComponent <PawnController>();
         if (pawnctl != null)
         {
             var pawn = pawnctl.pawn;
             if ((team & pawn.Team) != TeamMask.None)
             {
                 pawn.Health -= damage;
                 var hitBackDir = pawn.transform.position - transform.position;
                 pawnctl.HitBackBy(hitBackDir.normalized * hitBackDist);
             }
         }
     }
 }
Beispiel #22
0
 // Token: 0x06002FD7 RID: 12247 RVA: 0x000CCF68 File Offset: 0x000CB168
 public override void OnEnter()
 {
     base.OnEnter();
     this.highestFallSpeed = 0f;
     if (base.isAuthority)
     {
         if (this.body)
         {
             TeamMask  allButNeutral = TeamMask.allButNeutral;
             TeamIndex objectTeam    = TeamComponent.GetObjectTeam(this.bodyGameObject);
             if (objectTeam != TeamIndex.None)
             {
                 allButNeutral.RemoveTeam(objectTeam);
             }
             BullseyeSearch bullseyeSearch = new BullseyeSearch();
             bullseyeSearch.filterByLoS       = true;
             bullseyeSearch.maxDistanceFilter = 300f;
             bullseyeSearch.maxAngleFilter    = HeadstompersFall.seekCone;
             bullseyeSearch.searchOrigin      = this.body.footPosition;
             bullseyeSearch.searchDirection   = Vector3.down;
             bullseyeSearch.sortMode          = BullseyeSearch.SortMode.Angle;
             bullseyeSearch.teamMaskFilter    = allButNeutral;
             bullseyeSearch.viewer            = this.body;
             bullseyeSearch.RefreshCandidates();
             HurtBox hurtBox = bullseyeSearch.GetResults().FirstOrDefault <HurtBox>();
             this.seekTransform = ((hurtBox != null) ? hurtBox.transform : null);
             GameObject gameObject;
             if (hurtBox == null)
             {
                 gameObject = null;
             }
             else
             {
                 HealthComponent healthComponent = hurtBox.healthComponent;
                 gameObject = ((healthComponent != null) ? healthComponent.gameObject : null);
             }
             this.seekBodyObject = gameObject;
         }
         this.SetOnHitGroundProvider(this.bodyMotor);
     }
 }
Beispiel #23
0
        private HurtBox Evis_SearchForTarget(On.EntityStates.Merc.Evis.orig_SearchForTarget orig, EntityStates.Merc.Evis self)
        {
            var original = orig(self);

            if (!original.healthComponent.body.hasCloakBuff)
            {
                return(original);
            }
            BullseyeSearch bullseyeSearch = new BullseyeSearch
            {
                searchOrigin      = self.transform.position,
                searchDirection   = UnityEngine.Random.onUnitSphere,
                maxDistanceFilter = evisMaxRange,
                teamMaskFilter    = TeamMask.GetUnprotectedTeams(self.GetTeam()),
                sortMode          = BullseyeSearch.SortMode.Distance
            };

            bullseyeSearch.RefreshCandidates();
            bullseyeSearch.FilterOutGameObject(self.gameObject);
            return(FilterMethod(bullseyeSearch.GetResults()));
        }
 private void SearchForTarget(Ray aimRay)
 {
     this.search.teamMaskFilter    = TeamMask.GetUnprotectedTeams(this.teamComponent.teamIndex);
     this.search.filterByLoS       = true;
     this.search.searchOrigin      = aimRay.origin;
     this.search.searchDirection   = aimRay.direction;
     this.search.sortMode          = BullseyeSearch.SortMode.Angle;
     this.search.maxDistanceFilter = this.maxTrackingDistance;
     this.search.maxAngleFilter    = this.maxTrackingAngle;
     this.search.RefreshCandidates();
     this.search.FilterOutGameObject(base.gameObject);
     this.trackingTarget = this.search.GetResults().FirstOrDefault <HurtBox>();
     if (this.trackingTarget && this.trackingTarget.healthComponent && this.trackingTarget.healthComponent.body &&
         (!this.trackingTarget.healthComponent.body.HasBuff(SniperContent.spotterStatDebuff)) && this.trackingTarget.healthComponent.body.masterObject)
     {
         this.hasTrackingTarget = true;
         return;
     }
     this.hasTrackingTarget = false;
     this.trackingTarget    = null;
 }
Beispiel #25
0
        private void AttemptGrab(float grabRadius)
        {
            if (this.grabController)
            {
                return;
            }

            Ray aimRay = base.GetAimRay();

            BullseyeSearch search = new BullseyeSearch
            {
                teamMaskFilter    = TeamMask.GetEnemyTeams(base.GetTeam()),
                filterByLoS       = false,
                searchOrigin      = this.grabTransform.position,
                searchDirection   = Random.onUnitSphere,
                sortMode          = BullseyeSearch.SortMode.Distance,
                maxDistanceFilter = grabRadius,
                maxAngleFilter    = 360f
            };

            search.RefreshCandidates();
            search.FilterOutGameObject(base.gameObject);

            HurtBox target = search.GetResults().FirstOrDefault <HurtBox>();

            if (target)
            {
                if (target.healthComponent && target.healthComponent.body)
                {
                    if (BodyMeetsGrabConditions(target.healthComponent.body))
                    {
                        this.grabController = target.healthComponent.body.gameObject.AddComponent <RegigigasGrabController>();
                        this.grabController.pivotTransform         = this.grabTransform;
                        this.grabController.grabberHealthComponent = base.healthComponent;
                        this.grabTarget = target;
                        return;
                    }
                }
            }
        }
        // Token: 0x06002DEA RID: 11754 RVA: 0x000C36CC File Offset: 0x000C18CC
        private void FireSecondaryRaysServer()
        {
            Ray            aimRay         = base.GetAimRay();
            TeamIndex      team           = base.GetTeam();
            BullseyeSearch bullseyeSearch = new BullseyeSearch();

            bullseyeSearch.teamMaskFilter    = TeamMask.AllExcept(team);
            bullseyeSearch.maxAngleFilter    = BigPunch.maxShockFOV * 0.5f;
            bullseyeSearch.maxDistanceFilter = BigPunch.maxShockDistance;
            bullseyeSearch.searchOrigin      = aimRay.origin;
            bullseyeSearch.searchDirection   = this.punchVector;
            bullseyeSearch.sortMode          = BullseyeSearch.SortMode.Distance;
            bullseyeSearch.filterByLoS       = false;
            bullseyeSearch.RefreshCandidates();
            List <HurtBox> list      = bullseyeSearch.GetResults().Where(new Func <HurtBox, bool>(Util.IsValid)).ToList <HurtBox>();
            Transform      transform = base.FindModelChild(this.swingEffectMuzzleString);

            if (transform)
            {
                for (int i = 0; i < Mathf.Min(list.Count, BigPunch.maxShockCount); i++)
                {
                    HurtBox hurtBox = list[i];
                    if (hurtBox)
                    {
                        LightningOrb lightningOrb = new LightningOrb();
                        lightningOrb.bouncedObjects   = new List <HealthComponent>();
                        lightningOrb.attacker         = base.gameObject;
                        lightningOrb.teamIndex        = team;
                        lightningOrb.damageValue      = this.damageStat * BigPunch.shockDamageCoefficient;
                        lightningOrb.isCrit           = base.RollCrit();
                        lightningOrb.origin           = transform.position;
                        lightningOrb.bouncesRemaining = 0;
                        lightningOrb.lightningType    = LightningOrb.LightningType.Loader;
                        lightningOrb.procCoefficient  = BigPunch.shockProcCoefficient;
                        lightningOrb.target           = hurtBox;
                        OrbManager.instance.AddOrb(lightningOrb);
                    }
                }
            }
        }
 private void SearchForTarget(Ray aimRay)
 {
     //Let it target non-allies
     this.search.teamMaskFilter = TeamMask.GetUnprotectedTeams(this.teamComponent.teamIndex);
     //Must have LoS to target
     this.search.filterByLoS = true;
     //Start search at player aimray
     this.search.searchOrigin = aimRay.origin;
     //Search where player facing
     this.search.searchDirection = aimRay.direction;
     //Sort by distance
     this.search.sortMode = BullseyeSearch.SortMode.Distance;
     //Max dist and angle, dist based on speed
     this.search.maxDistanceFilter = this.maxTrackingDistance * 1;
     this.search.maxAngleFilter    = this.maxTrackingAngle;
     //Refresh the targets
     this.search.RefreshCandidates();
     //Don't target self (lol)
     this.search.FilterOutGameObject(base.gameObject);
     //Get the target
     this.trackingTarget = this.search.GetResults().FirstOrDefault();
 }
 // Token: 0x06002E79 RID: 11897 RVA: 0x000C571C File Offset: 0x000C391C
 public override void OnEnter()
 {
     base.OnEnter();
     if (base.isAuthority)
     {
         TeamMask  mask      = TeamMask.AllExcept(base.ownerBody.teamComponent.teamIndex);
         HurtBox[] hurtBoxes = new SphereSearch
         {
             radius = AimState.targetAcquisitionRadius,
             mask   = LayerIndex.entityPrecise.mask,
             origin = base.transform.position,
             queryTriggerInteraction = QueryTriggerInteraction.UseGlobal
         }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(mask).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes();
         float blastRadius = FireMainBeamState.secondBombPrefab.GetComponent <ProjectileImpactExplosion>().blastRadius;
         int   num         = -1;
         int   num2        = 0;
         for (int i = 0; i < hurtBoxes.Length; i++)
         {
             HurtBox[] hurtBoxes2 = new SphereSearch
             {
                 radius = blastRadius,
                 mask   = LayerIndex.entityPrecise.mask,
                 origin = hurtBoxes[i].transform.position,
                 queryTriggerInteraction = QueryTriggerInteraction.UseGlobal
             }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(mask).FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes();
             if (hurtBoxes2.Length > num2)
             {
                 num  = i;
                 num2 = hurtBoxes2.Length;
             }
         }
         if (num != -1)
         {
             base.simpleRotateToDirection.targetRotation = Quaternion.LookRotation(hurtBoxes[num].transform.position - base.transform.position);
             this.foundTarget = true;
         }
     }
 }
Beispiel #29
0
        public static void KillAll()
        {
            var localUser  = LocalUserManager.GetFirstLocalUser();
            var controller = localUser.cachedMasterController;

            if (!controller)
            {
                return;
            }
            var body = controller.master.GetBody();

            if (!body)
            {
                return;
            }

            var bullseyeSearch = new BullseyeSearch
            {
                filterByLoS       = false,
                maxDistanceFilter = float.MaxValue,
                maxAngleFilter    = float.MaxValue
            };

            var team = body.GetComponent <TeamComponent>();

            bullseyeSearch.teamMaskFilter = TeamMask.AllExcept(team.teamIndex);
            bullseyeSearch.RefreshCandidates();
            var hurtBoxList = bullseyeSearch.GetResults();

            foreach (var hurtbox in hurtBoxList)
            {
                var    mob     = HurtBox.FindEntityObject(hurtbox);
                string mobName = mob.name.Replace("Body(Clone)", ""); // Create Chat message with this.
                var    health  = mob.GetComponent <HealthComponent>();
                health.Suicide();
                Chat.AddMessage($"<color=yellow>Killed {mobName} </color>");
            }
        }
Beispiel #30
0
 public override void OnEnter()
 {
     //Do normal onenter things first
     base.OnEnter();
     //Play the animation
     base.PlayAnimation("Gesture, Mouth", "FireSpit", "FireSpit.playbackRate", 1f);
     //Spheresearch for enemies in range, starting from doggo foots
     foreach (HurtBox hurtBox in new SphereSearch
     {
         origin = base.characterBody.footPosition,
         radius = this.maxTrackingDistance,
         mask = LayerIndex.entityPrecise.mask
     }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(base.teamComponent.teamIndex)).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes())
     {
         //Get the characterbody cause we need buffcount
         CharacterBody body = hurtBox.healthComponent.body;
         //Get health component for poison calc
         HealthComponent component = hurtBox.healthComponent;
         //If they have the poison debuff...
         if (body.HasBuff(RoR2Content.Buffs.Poisoned))
         {
             //Network check
             if (base.isAuthority)
             {
                 //Make blast attack and fire it at pos of all enemies
                 new BlastAttack
                 {
                     position          = body.corePosition,
                     baseDamage        = component.fullHealth * this.healthFraction + base.damageStat * this.poisonDamageCoefficient,
                     baseForce         = 0f,
                     radius            = this.detonationRadius,
                     attacker          = base.gameObject,
                     inflictor         = base.gameObject,
                     teamIndex         = base.teamComponent.teamIndex,
                     crit              = base.RollCrit(),
                     procChainMask     = default,