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; }
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()); }
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); }
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; }
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) { //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(); }
private void GlobalEventManager_onCharacterDeathGlobal(DamageReport damageReport) { if (NetworkServer.active) { if (damageReport.attackerBody && damageReport.attackerBody.inventory) { var itemCount = damageReport.attackerBody.inventory.GetItemCount(itemDef); if (itemCount > 0 && damageReport.victimIsElite) { var radius = ElitePotion.radius + ElitePotion.radiusPerStack * (itemCount - 1); var duration = ElitePotion.duration + ElitePotion.durationPerStack * (itemCount - 1); var damageMult = 1f + 0.8f * (itemCount - 1); foreach (var buffIndex in BuffCatalog.eliteBuffIndices.Where(x => damageReport.victimBody.HasBuff(x))) { foreach (var spreadEffectInfo in spreadEffectInfos.Where(x => x.eliteBuffDef.buffIndex == buffIndex)) { if (spreadEffectInfo.vfx) { EffectManager.SpawnEffect(spreadEffectInfo.vfx, new EffectData { origin = damageReport.victimBody.corePosition, scale = radius * (spreadEffectInfo.vfxScaleMultiplier != 0f ? spreadEffectInfo.vfxScaleMultiplier : 1f) }, true); } sphereSearch.origin = damageReport.victimBody.corePosition; sphereSearch.mask = LayerIndex.entityPrecise.mask; sphereSearch.radius = radius; sphereSearch.RefreshCandidates(); sphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(damageReport.attackerTeamIndex)); sphereSearch.FilterCandidatesByDistinctHurtBoxEntities(); sphereSearch.OrderCandidatesByDistance(); sphereSearch.GetHurtBoxes(hurtBoxes); sphereSearch.ClearCandidates(); foreach (var hurtBox in hurtBoxes) { if (hurtBox.healthComponent) { if (spreadEffectInfo.debuff) { hurtBox.healthComponent.body.AddTimedBuff(spreadEffectInfo.debuff, duration); } if (spreadEffectInfo.dot != default(DotController.DotIndex) && spreadEffectInfo.dot != DotController.DotIndex.None) { DotController.InflictDot(hurtBox.healthComponent.gameObject, damageReport.attacker, spreadEffectInfo.dot, duration, 1f); } } } if (spreadEffectInfo.damage != 0 || spreadEffectInfo.damageType != default) { new BlastAttack { radius = radius, baseDamage = damageReport.attackerBody.damage * spreadEffectInfo.damage * damageMult, procCoefficient = spreadEffectInfo.procCoefficient, crit = Util.CheckRoll(damageReport.attackerBody.crit, damageReport.attackerMaster), damageType = spreadEffectInfo.damageType, damageColorIndex = DamageColorIndex.Item, attackerFiltering = AttackerFiltering.Default, falloffModel = BlastAttack.FalloffModel.None, attacker = damageReport.attacker, teamIndex = damageReport.attackerTeamIndex, position = damageReport.victimBody.corePosition } }