private void SummonGuardEgg() { Vector3 searchOrigin = GetAimRay().origin; if ((bool)base.inputBank && base.inputBank.GetAimRaycast(float.PositiveInfinity, out var hitInfo)) { searchOrigin = hitInfo.point; } if (enemySearch == null) { return; } enemySearch.searchOrigin = searchOrigin; enemySearch.RefreshCandidates(); HurtBox hurtBox = enemySearch.GetResults().FirstOrDefault(); Transform transform = (((bool)hurtBox && (bool)hurtBox.healthComponent) ? hurtBox.healthComponent.body.coreTransform : base.characterBody.coreTransform); if ((bool)transform) { DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest(guardSpawnCard, new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Approximate, minDistance = 3f, maxDistance = 20f, spawnOnTarget = transform }, RoR2Application.rng); directorSpawnRequest.summonerBodyObject = base.gameObject; directorSpawnRequest.onSpawnedServer = (Action <SpawnCard.SpawnResult>) Delegate.Combine(directorSpawnRequest.onSpawnedServer, (Action <SpawnCard.SpawnResult>) delegate(SpawnCard.SpawnResult spawnResult) { spawnResult.spawnedInstance.GetComponent <Inventory>().CopyEquipmentFrom(base.characterBody.inventory); }); DirectorCore.instance?.TrySpawnObject(directorSpawnRequest); } }
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 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; } }
private void TaseTarget() { FindTarget(); this.targetFinder.maxDistanceFilter = cfgWolfRadius.Value; this.targetFinder.RefreshCandidates(); this.targetFinder.FilterOutGameObject(base.gameObject); var result = targetFinder.GetResults().FirstOrDefault <HurtBox>(); if (result) { result.healthComponent.TakeDamage( new DamageInfo() { attacker = characterMaster.GetBodyObject(), crit = false, damage = 1f, damageColorIndex = DamageColorIndex.Item, damageType = DamageType.Shock5s, force = Vector3.zero, position = result.healthComponent.body.corePosition, inflictor = gameObject, procCoefficient = 0 }); Vector3 position = result.healthComponent.body.corePosition; Vector3 start = characterMaster.GetBody().corePosition; if (EntityStates.CaptainDefenseMatrixItem.DefenseMatrixOn.tracerEffectPrefab) { EffectData effectData = new EffectData { origin = position, start = start }; EffectManager.SpawnEffect(EntityStates.CaptainDefenseMatrixItem.DefenseMatrixOn.tracerEffectPrefab, effectData, true); } /* * FireProjectileInfo fireProjectileInfo = new FireProjectileInfo * { * projectilePrefab = EntityStates.Captain.Weapon.FireTazer.projectilePrefab, * position = characterMaster.GetBody().corePosition, * owner = characterMaster.GetBodyObject(), * damage = 0f, * force = FireTazer.force, * }; * var lookAtRot = fireProjectileInfo.position - result.healthComponent.body.corePosition; * fireProjectileInfo.rotation = Util.QuaternionSafeLookRotation(lookAtRot); * //fireProjectileInfo.crit = Util.CheckRoll(this.critStat, base.characterBody.master); * ProjectileManager.instance.FireProjectile(fireProjectileInfo);*/ } }
// 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); }
public static List <HurtBox> GetHurtBoxes() { var localUser = LocalUserManager.GetFirstLocalUser(); var controller = localUser.cachedMasterController; if (!controller) { return(null); } var body = controller.master.GetBody(); if (!body) { return(null); } var inputBank = body.GetComponent <InputBankTest>(); var aimRay = new Ray(inputBank.aimOrigin, inputBank.aimDirection); var bullseyeSearch = new BullseyeSearch(); var team = body.GetComponent <TeamComponent>(); bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.filterByLoS = false; bullseyeSearch.maxDistanceFilter = 125; bullseyeSearch.maxAngleFilter = 40f; bullseyeSearch.teamMaskFilter = TeamMask.all; bullseyeSearch.teamMaskFilter.RemoveTeam(team.teamIndex); bullseyeSearch.RefreshCandidates(); var hurtBoxList = bullseyeSearch.GetResults().ToList(); return(hurtBoxList); }
private void SearchForAllies() { Ray aimRay = base.GetAimRay(); BullseyeSearch search = new BullseyeSearch { teamMaskFilter = TeamMask.none, filterByLoS = false, searchOrigin = base.transform.position, searchDirection = Random.onUnitSphere, sortMode = BullseyeSearch.SortMode.Distance, maxDistanceFilter = 3f, maxAngleFilter = 360f }; search.teamMaskFilter.AddTeam(base.GetTeam()); search.RefreshCandidates(); search.FilterOutGameObject(base.gameObject); HurtBox target = search.GetResults().FirstOrDefault <HurtBox>(); if (target) { if (target.healthComponent && target.healthComponent.body) { this.outer.SetNextState(new PeoplesElbow()); return; } } }
private static void CharacterMaster_OnBodyDeath(On.RoR2.CharacterMaster.orig_OnBodyDeath orig, CharacterMaster self, CharacterBody body) { orig(self, body); if (self.IsDeadAndOutOfLivesServer() && body.teamComponent.teamIndex == TeamIndex.Monster) { BullseyeSearch search = new BullseyeSearch { searchOrigin = body.corePosition, teamMaskFilter = TeamMask.none, filterByLoS = false, sortMode = BullseyeSearch.SortMode.Distance, searchDirection = Vector3.zero }; search.teamMaskFilter.AddTeam(TeamIndex.Player); search.RefreshCandidates(); foreach (HurtBox hurtBox in search.GetResults()) { //Chat.AddMessage("BaseNameToken: " + hurtBox.healthComponent.body.baseNameToken); //This will show the prefabName if (hurtBox.healthComponent.body.baseNameToken == "MAGE_BODY_NAME") //This should reflect the prefabName { hurtBox.healthComponent.body.AddBuff(ChargeIndex); } } } }
// Token: 0x06002EFC RID: 12028 RVA: 0x000C81F4 File Offset: 0x000C63F4 private void CalculateBlinkDestination() { Vector3 vector = Vector3.zero; Ray aimRay = base.GetAimRay(); BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.maxDistanceFilter = this.blinkDistance; bullseyeSearch.teamMaskFilter = TeamMask.allButNeutral; bullseyeSearch.filterByLoS = false; bullseyeSearch.teamMaskFilter.RemoveTeam(TeamComponent.GetObjectTeam(base.gameObject)); bullseyeSearch.sortMode = BullseyeSearch.SortMode.Angle; bullseyeSearch.RefreshCandidates(); HurtBox hurtBox = bullseyeSearch.GetResults().FirstOrDefault <HurtBox>(); if (hurtBox) { vector = hurtBox.transform.position - base.transform.position; } this.blinkDestination = base.transform.position; this.blinkStart = base.transform.position; NodeGraph groundNodes = SceneInfo.instance.groundNodes; NodeGraph.NodeIndex nodeIndex = groundNodes.FindClosestNode(base.transform.position + vector, base.characterBody.hullClassification); groundNodes.GetNodePosition(nodeIndex, out this.blinkDestination); this.blinkDestination += base.transform.position - base.characterBody.footPosition; base.characterDirection.forward = vector; }
public override void OnExit() { base.OnExit(); if (voidLanceCenter) { bullseyeSearch.RefreshCandidates(); var hurtBox = bullseyeSearch.GetResults().FirstOrDefault(); Quaternion forward; if (hurtBox) { var target = hurtBox.healthComponent.body.corePosition; var aimDirection = target - voidLanceCenter.position; forward = Util.QuaternionSafeLookRotation(aimDirection.normalized); } else { forward = Util.QuaternionSafeLookRotation(GetAimRay().direction); } ProjectileManager.instance.FireProjectile(projectilePrefab, voidLanceCenter.position, forward, gameObject, damageStat * damageCoefficient, 0f, Util.CheckRoll(critStat, characterBody.master), DamageColorIndex.Bleed, null); if (dragPenalty != 0) { rigidbody.drag -= dragPenalty; } } }
internal void findTarget() { float maxDistance = 200.0f; float maxAngle = 90; if (base.characterBody) { float num = 0; Ray ray = CameraRigController.ModifyAimRayIfApplicable(base.GetAimRay(), base.gameObject, out num); BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.searchOrigin = ray.origin; bullseyeSearch.searchDirection = ray.direction; bullseyeSearch.maxDistanceFilter = maxDistance + num; bullseyeSearch.maxAngleFilter = maxAngle; bullseyeSearch.teamMaskFilter = TeamMask.allButNeutral; bullseyeSearch.teamMaskFilter.RemoveTeam(TeamComponent.GetObjectTeam(base.gameObject)); bullseyeSearch.sortMode = BullseyeSearch.SortMode.Angle; bullseyeSearch.RefreshCandidates(); this.targetHurtbox = bullseyeSearch.GetResults().FirstOrDefault <HurtBox>(); } if (this.targetHurtbox) { if (!this.trackingIndicator) { this.trackingIndicator = UnityEngine.Object.Instantiate <GameObject>(ArrowRain.areaIndicatorPrefab); this.trackingIndicator.transform.localScale = new Vector3(aimMaxSize, aimMaxSize, aimMaxSize); } this.trackingIndicator.transform.position = this.targetHurtbox.transform.position; } else if (this.trackingIndicator) { EntityState.Destroy(this.trackingIndicator.gameObject); this.trackingIndicator = null; } }
// Token: 0x060030AD RID: 12461 RVA: 0x000D1B26 File Offset: 0x000CFD26 private int CountTargets(Vector3 origin) { BullseyeSearch bullseyeSearch = this.CreateBullseyeSearch(origin); bullseyeSearch.RefreshCandidates(); return(bullseyeSearch.GetResults().Count <HurtBox>()); }
// Token: 0x060030AC RID: 12460 RVA: 0x000D1AA0 File Offset: 0x000CFCA0 private void FindBetterTarget(Transform initialTarget) { BullseyeSearch bullseyeSearch = this.CreateBullseyeSearch(initialTarget.position); bullseyeSearch.RefreshCandidates(); HurtBox[] array = bullseyeSearch.GetResults().ToArray <HurtBox>(); int num = array.Length; int num2 = -1; int i = 0; int num3 = Math.Min(array.Length, Unburrow.betterTargetSearchLimit); while (i < num3) { HurtBox hurtBox = array[i]; int num4 = this.CountTargets(hurtBox.transform.position); if (num < num4) { num = num4; num2 = i; } i++; } if (num2 != -1) { base.projectileTargetComponent.target = array[num2].transform; } }
// Token: 0x06003322 RID: 13090 RVA: 0x000DDA2C File Offset: 0x000DBC2C private void FireOrbs() { if (!NetworkServer.active) { return; } Transform transform = this.childLocator.FindChild(SpawnWards.muzzleString).transform; BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.searchOrigin = transform.position; bullseyeSearch.searchDirection = transform.forward; bullseyeSearch.maxDistanceFilter = SpawnWards.orbRange; bullseyeSearch.teamMaskFilter = TeamMask.allButNeutral; bullseyeSearch.teamMaskFilter.RemoveTeam(TeamComponent.GetObjectTeam(base.gameObject)); bullseyeSearch.sortMode = BullseyeSearch.SortMode.Distance; bullseyeSearch.RefreshCandidates(); EffectManager.SimpleMuzzleFlash(SpawnWards.muzzleflashEffectPrefab, base.gameObject, SpawnWards.muzzleString, true); List <HurtBox> list = bullseyeSearch.GetResults().ToList <HurtBox>(); for (int i = 0; i < list.Count; i++) { HurtBox target = list[i]; BeetleWardOrb beetleWardOrb = new BeetleWardOrb(); beetleWardOrb.origin = transform.position; beetleWardOrb.target = target; beetleWardOrb.speed = SpawnWards.orbTravelSpeed; OrbManager.instance.AddOrb(beetleWardOrb); } }
// Token: 0x06002FBE RID: 12222 RVA: 0x000CC8C8 File Offset: 0x000CAAC8 private void Fire() { Ray aimRay = base.GetAimRay(); Ray ray = new Ray(aimRay.origin, Vector3.up); BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.filterByLoS = false; bullseyeSearch.teamMaskFilter = TeamMask.allButNeutral; if (base.teamComponent) { bullseyeSearch.teamMaskFilter.RemoveTeam(base.teamComponent.teamIndex); } bullseyeSearch.sortMode = BullseyeSearch.SortMode.Angle; bullseyeSearch.RefreshCandidates(); HurtBox hurtBox = bullseyeSearch.GetResults().FirstOrDefault <HurtBox>(); bool flag = false; Vector3 a = Vector3.zero; RaycastHit raycastHit; if (hurtBox) { a = hurtBox.transform.position; flag = true; } else if (Physics.Raycast(aimRay, out raycastHit, 1000f, LayerIndex.world.mask | LayerIndex.entityPrecise.mask, QueryTriggerInteraction.Ignore)) { a = raycastHit.point; flag = true; } float magnitude = FireMortar.projectileVelocity; if (flag) { Vector3 vector = a - ray.origin; Vector2 a2 = new Vector2(vector.x, vector.z); float magnitude2 = a2.magnitude; Vector2 vector2 = a2 / magnitude2; if (magnitude2 < FireMortar.minimumDistance) { magnitude2 = FireMortar.minimumDistance; } float y = Trajectory.CalculateInitialYSpeed(FireMortar.timeToTarget, vector.y); float num = magnitude2 / FireMortar.timeToTarget; Vector3 direction = new Vector3(vector2.x * num, y, vector2.y * num); magnitude = direction.magnitude; ray.direction = direction; } for (int i = 0; i < FireMortar.mortarCount; i++) { Quaternion rotation = Util.QuaternionSafeLookRotation(ray.direction + ((i != 0) ? (UnityEngine.Random.insideUnitSphere * 0.05f) : Vector3.zero)); ProjectileManager.instance.FireProjectile(FireMortar.mortarProjectilePrefab, ray.origin, rotation, base.gameObject, this.damageStat * FireMortar.mortarDamageCoefficient, 0f, Util.CheckRoll(this.critStat, base.characterBody.master), DamageColorIndex.Default, null, magnitude); } }
// Token: 0x060005CE RID: 1486 RVA: 0x0001A824 File Offset: 0x00018A24 private void Detonate() { Vector3 position = base.transform.position; Util.PlaySound(FireMegaNova.novaSoundString, base.gameObject); if (FireMegaNova.novaEffectPrefab) { EffectManager.instance.SimpleMuzzleFlash(FireMegaNova.novaEffectPrefab, base.gameObject, "NovaCenter", false); } Transform modelTransform = base.GetModelTransform(); if (modelTransform) { TemporaryOverlay temporaryOverlay = modelTransform.gameObject.AddComponent <TemporaryOverlay>(); temporaryOverlay.duration = 3f; temporaryOverlay.animateShaderAlpha = true; temporaryOverlay.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); temporaryOverlay.destroyComponentOnEnd = true; temporaryOverlay.originalMaterial = Resources.Load <Material>("Materials/matVagrantEnergized"); temporaryOverlay.AddToCharacerModel(modelTransform.GetComponent <CharacterModel>()); } if (base.isAuthority) { BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.filterByLoS = true; bullseyeSearch.maxDistanceFilter = this.novaRadius; bullseyeSearch.searchOrigin = position; bullseyeSearch.sortMode = BullseyeSearch.SortMode.Distance; bullseyeSearch.teamMaskFilter = TeamMask.allButNeutral; bullseyeSearch.teamMaskFilter.RemoveTeam(base.teamComponent.teamIndex); bullseyeSearch.RefreshCandidates(); bullseyeSearch.queryTriggerInteraction = QueryTriggerInteraction.Collide; List <HurtBox> list = bullseyeSearch.GetResults().ToList <HurtBox>(); if (list.Count > 0) { DamageInfo damageInfo = new DamageInfo(); damageInfo.damage = this.damageStat * FireMegaNova.novaDamageCoefficient; damageInfo.attacker = base.gameObject; damageInfo.procCoefficient = 1f; damageInfo.crit = Util.CheckRoll(this.critStat, base.characterBody.master); for (int i = 0; i < list.Count; i++) { HurtBox hurtBox = list[i]; HealthComponent healthComponent = hurtBox.healthComponent; if (healthComponent) { damageInfo.force = FireMegaNova.novaForce * (healthComponent.transform.position - position).normalized; damageInfo.position = hurtBox.transform.position; EffectManager.instance.SimpleImpactEffect(FireMegaNova.novaImpactEffectPrefab, hurtBox.transform.position, Vector3.up, true); healthComponent.TakeDamage(damageInfo); } } } } }
private void UpdateLockOn() { if (isAuthority) { enemyFinder.searchOrigin = aimRay.origin; enemyFinder.searchDirection = aimRay.direction; enemyFinder.RefreshCandidates(); HurtBox exists = enemyFinder.GetResults().FirstOrDefault(); lockedOnHurtBox = exists; foundAnyTarget = exists; } }
// Token: 0x06000510 RID: 1296 RVA: 0x00015D7C File Offset: 0x00013F7C private HurtBox SearchForTarget() { BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.searchOrigin = base.transform.position; bullseyeSearch.searchDirection = UnityEngine.Random.onUnitSphere; bullseyeSearch.maxDistanceFilter = Evis.maxRadius; bullseyeSearch.teamMaskFilter = TeamMask.all; bullseyeSearch.teamMaskFilter.RemoveTeam(TeamComponent.GetObjectTeam(base.gameObject)); bullseyeSearch.sortMode = BullseyeSearch.SortMode.Distance; bullseyeSearch.RefreshCandidates(); return(bullseyeSearch.GetResults().FirstOrDefault <HurtBox>()); }
public static List <HurtBox> GetHurtBoxes() { string[] allowedBoxes = { "Golem", "Jellyfish", "Wisp", "Beetle", "Lemurian", "Imp", "HermitCrab", "ClayBruiser", "Bell", "BeetleGuard", "MiniMushroom", "Bison", "GreaterWisp", "LemurianBruiser", "RoboBallMini", "Vulture", /* BOSSES */ "BeetleQueen2", "ClayDunestrider", "Titan", "TitanGold", "TitanBlackBeach", "Grovetender", "Gravekeeper", "Mithrix", "Aurelionite", "Vagrant", "MagmaWorm", "ImpBoss", "ElectricWorm", "RoboBallBoss", "Nullifier", "Parent", "Scav", "ScavLunar1", "ClayBoss", "LunarGolem", "LunarWisp", "Brother", "BrotherHurt" }; var localUser = LocalUserManager.GetFirstLocalUser(); var controller = localUser.cachedMasterController; if (!controller) { return(null); } var body = controller.master.GetBody(); if (!body) { return(null); } var inputBank = body.GetComponent <InputBankTest>(); var aimRay = new Ray(inputBank.aimOrigin, inputBank.aimDirection); var bullseyeSearch = new BullseyeSearch(); var team = body.GetComponent <TeamComponent>(); bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.filterByLoS = false; bullseyeSearch.maxDistanceFilter = 125; bullseyeSearch.maxAngleFilter = 40f; bullseyeSearch.teamMaskFilter = TeamMask.all; bullseyeSearch.teamMaskFilter.RemoveTeam(team.teamIndex); bullseyeSearch.RefreshCandidates(); var hurtBoxList = bullseyeSearch.GetResults().ToList(); List <HurtBox> updatedHurtboxes = new List <HurtBox>(); for (int i = 0; i < hurtBoxList.Count; i++) { HurtBox hurtBox = hurtBoxList[i]; var mobName = HurtBox.FindEntityObject(hurtBox).name.Replace("Body(Clone)", ""); if (allowedBoxes.Contains(mobName)) { updatedHurtboxes.Add(hurtBox); } /*else * { * WriteToLog($"Blocked: {mobName}"); * }*/ } return(updatedHurtboxes); }
// Token: 0x06002CB4 RID: 11444 RVA: 0x000BC980 File Offset: 0x000BAB80 public override void OnEnter() { base.OnEnter(); this.duration = FireDelayKnockup.baseDuration / this.attackSpeedStat; base.PlayCrossfade("Gesture, Additive", "FireDelayKnockup", 0.1f); if (FireDelayKnockup.muzzleEffectPrefab) { EffectManager.SimpleMuzzleFlash(FireDelayKnockup.muzzleEffectPrefab, base.gameObject, "EyeballMuzzle1", false); EffectManager.SimpleMuzzleFlash(FireDelayKnockup.muzzleEffectPrefab, base.gameObject, "EyeballMuzzle2", false); EffectManager.SimpleMuzzleFlash(FireDelayKnockup.muzzleEffectPrefab, base.gameObject, "EyeballMuzzle3", false); } if (NetworkServer.active) { BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.teamMaskFilter = TeamMask.allButNeutral; if (base.teamComponent) { bullseyeSearch.teamMaskFilter.RemoveTeam(base.teamComponent.teamIndex); } bullseyeSearch.maxDistanceFilter = FireDelayKnockup.maxDistance; bullseyeSearch.maxAngleFilter = 360f; Ray aimRay = base.GetAimRay(); bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.filterByLoS = false; bullseyeSearch.sortMode = BullseyeSearch.SortMode.Angle; bullseyeSearch.RefreshCandidates(); List <HurtBox> list = bullseyeSearch.GetResults().ToList <HurtBox>(); int num = 0; for (int i = 0; i < this.knockupCount; i++) { if (num >= list.Count) { num = 0; } HurtBox hurtBox = list[num]; if (hurtBox) { Vector2 vector = UnityEngine.Random.insideUnitCircle * this.randomPositionRadius; Vector3 vector2 = hurtBox.transform.position + new Vector3(vector.x, 0f, vector.y); RaycastHit raycastHit; if (Physics.Raycast(new Ray(vector2 + Vector3.up * 1f, Vector3.down), out raycastHit, 200f, LayerIndex.world.mask, QueryTriggerInteraction.Ignore)) { vector2 = raycastHit.point; } ProjectileManager.instance.FireProjectile(FireDelayKnockup.projectilePrefab, vector2, Quaternion.identity, base.gameObject, this.damageStat, 0f, Util.CheckRoll(this.critStat, base.characterBody.master), DamageColorIndex.Default, null, -1f); } num++; } } }
private Vector3 EvaluatePickupPosition(BulletstormPickupsComponent pickupsComponent, CharacterBody victimBody) { Vector3 PickupPosition = new Vector3(); if (pickupsComponent.wasMapDeath) //If they die from falling off the map { if (pickupsComponent.lastHitAttacker) // get the last attacker { PickupPosition = pickupsComponent.lastHitAttacker.transform.position; //set the position of the pickup to be on the player } else { var playerSearch = new BullseyeSearch() //let's just get the nearest player { viewer = victimBody, sortMode = BullseyeSearch.SortMode.Distance, teamMaskFilter = TeamMask.allButNeutral }; playerSearch.teamMaskFilter.RemoveTeam(TeamIndex.Monster); playerSearch.RefreshCandidates(); playerSearch.FilterOutGameObject(victimBody.gameObject); var list = playerSearch.GetResults().ToList(); bool success = false; if (list.Count > 0) { foreach (var player in list) { var body = player.gameObject.GetComponent <CharacterBody>(); if (body) { if (body.isPlayerControlled) { PickupPosition = body.corePosition; success = true; break; } } } } if (!success) // { PickupPosition = list.FirstOrDefault().transform.position; } } } else // If it wasn't a map death { PickupPosition = victimBody.transform.position; } return(PickupPosition); }
public static void KillAllMobs() { 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 }; List <string> survivor_names = new List <string>(); foreach (SurvivorDef def in SurvivorCatalog.allSurvivorDefs) { survivor_names.Add(def.cachedName); } bullseyeSearch.RefreshCandidates(); var hurtBoxList = bullseyeSearch.GetResults(); foreach (var hurtbox in hurtBoxList) { var mob = HurtBox.FindEntityObject(hurtbox); string mobName = mob.name.Replace("Body(Clone)", ""); if (survivor_names.Contains(mobName)) { continue; } else { var health = mob.GetComponent <HealthComponent>(); health.Suicide(); Chat.AddMessage($"<color=yellow>Killed {mobName} </color>"); } } }
// Clears inventory, duh. public static void ClearInventory() { if (Main.LocalPlayerInv) { // Loops through every item in ItemIndex enum foreach (string itemName in CurrentInventory()) { ItemIndex itemIndex = (ItemIndex)Enum.Parse(typeof(ItemIndex), itemName); //Convert itemName string to and ItemIndex // If an item exists, delete the whole stack of it Main.LocalPlayerInv.itemAcquisitionOrder.Remove(itemIndex); Main.LocalPlayerInv.ResetItem(itemIndex); int itemCount = Main.LocalPlayerInv.GetItemCount(itemIndex); Main.LocalPlayerInv.RemoveItem(itemIndex, itemCount); // Destroys BeetleGuardAllies on inventory clear, other wise they dont get removed until next stage. 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 }; bullseyeSearch.RefreshCandidates(); var hurtBoxList = bullseyeSearch.GetResults(); foreach (var hurtbox in hurtBoxList) { var mob = HurtBox.FindEntityObject(hurtbox); string mobName = mob.name.Replace("Body(Clone)", ""); if (mobName == "BeetleGuardAlly") { var health = mob.GetComponent <HealthComponent>(); health.Suicide(); } } } Main.LocalPlayerInv.SetEquipmentIndex(EquipmentIndex.None); } PlayerMod.RemoveAllBuffs(); }
// Token: 0x060008A9 RID: 2217 RVA: 0x0002B684 File Offset: 0x00029884 private void FireTethers() { Vector3 position = this.muzzleTransform.position; float breakDistanceSqr = Recover.maxTetherDistance * Recover.maxTetherDistance; List <GameObject> list = new List <GameObject>(); this.tetherControllers = new List <TarTetherController>(); BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.searchOrigin = position; bullseyeSearch.maxDistanceFilter = Recover.maxTetherDistance; bullseyeSearch.teamMaskFilter = TeamMask.allButNeutral; bullseyeSearch.sortMode = BullseyeSearch.SortMode.Distance; bullseyeSearch.filterByLoS = true; bullseyeSearch.searchDirection = Vector3.up; bullseyeSearch.RefreshCandidates(); bullseyeSearch.FilterOutGameObject(base.gameObject); List <HurtBox> list2 = bullseyeSearch.GetResults().ToList <HurtBox>(); Debug.Log(list2); for (int i = 0; i < list2.Count; i++) { GameObject gameObject = list2[i].healthComponent.gameObject; if (gameObject) { list.Add(gameObject); } } float tickInterval = 1f / Recover.damageTickFrequency; float damageCoefficientPerTick = Recover.damagePerSecond / Recover.damageTickFrequency; float mulchDistanceSqr = Recover.tetherMulchDistance * Recover.tetherMulchDistance; GameObject original = Resources.Load <GameObject>("Prefabs/NetworkedObjects/TarTether"); for (int j = 0; j < list.Count; j++) { GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(original, position, Quaternion.identity); TarTetherController component = gameObject2.GetComponent <TarTetherController>(); component.NetworkownerRoot = base.gameObject; component.NetworktargetRoot = list[j]; component.breakDistanceSqr = breakDistanceSqr; component.damageCoefficientPerTick = damageCoefficientPerTick; component.tickInterval = tickInterval; component.tickTimer = (float)j * 0.1f; component.mulchDistanceSqr = mulchDistanceSqr; component.mulchDamageScale = Recover.tetherMulchDamageScale; component.mulchTickIntervalScale = Recover.tetherMulchTickIntervalScale; this.tetherControllers.Add(component); NetworkServer.Spawn(gameObject2); } }
// Token: 0x060032E2 RID: 13026 RVA: 0x000DC838 File Offset: 0x000DAA38 public override void OnEnter() { base.OnEnter(); Util.PlaySound(BuffBeam.playBeamSoundString, base.gameObject); Ray aimRay = base.GetAimRay(); BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.teamMaskFilter = TeamMask.none; if (base.teamComponent) { bullseyeSearch.teamMaskFilter.AddTeam(base.teamComponent.teamIndex); } bullseyeSearch.filterByLoS = false; bullseyeSearch.maxDistanceFilter = 50f; bullseyeSearch.maxAngleFilter = 180f; bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.sortMode = BullseyeSearch.SortMode.Angle; bullseyeSearch.RefreshCandidates(); bullseyeSearch.FilterOutGameObject(base.gameObject); this.target = bullseyeSearch.GetResults().FirstOrDefault <HurtBox>(); Debug.LogFormat("Buffing target {0}", new object[] { this.target }); if (this.target) { this.targetBody = this.target.healthComponent.body; this.targetBody.AddBuff(BuffIndex.HiddenInvincibility); } string childName = "Muzzle"; Transform modelTransform = base.GetModelTransform(); if (modelTransform) { ChildLocator component = modelTransform.GetComponent <ChildLocator>(); if (component) { this.muzzleTransform = component.FindChild(childName); this.buffBeamInstance = UnityEngine.Object.Instantiate <GameObject>(BuffBeam.buffBeamPrefab); ChildLocator component2 = this.buffBeamInstance.GetComponent <ChildLocator>(); if (component2) { this.beamTipTransform = component2.FindChild("BeamTip"); } this.healBeamCurve = this.buffBeamInstance.GetComponentInChildren <BezierCurveLine>(); } } }
// Needs improvement. Causes a lot of lag public static void Mobs() { var localUser = LocalUserManager.GetFirstLocalUser(); var controller = localUser.cachedMasterController; if (!controller) { return; } var body = controller.master.GetBody(); if (!body) { return; } var inputBank = body.GetComponent <InputBankTest>(); var aimRay = new Ray(inputBank.aimOrigin, inputBank.aimDirection); var bullseyeSearch = new BullseyeSearch(); var team = body.GetComponent <TeamComponent>(); bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.filterByLoS = false; bullseyeSearch.maxDistanceFilter = 125; bullseyeSearch.maxAngleFilter = 40f; bullseyeSearch.teamMaskFilter = TeamMask.all; bullseyeSearch.teamMaskFilter.RemoveTeam(team.teamIndex); bullseyeSearch.RefreshCandidates(); var hurtBoxList = bullseyeSearch.GetResults(); foreach (var hurtbox in hurtBoxList) { var mob = HurtBox.FindEntityObject(hurtbox); if (mob) { Vector3 MobPosition = Camera.main.WorldToScreenPoint(mob.transform.position); var MobBoundingVector = new Vector3(MobPosition.x, MobPosition.y, MobPosition.z); float distanceToMob = Vector3.Distance(Camera.main.transform.position, mob.transform.position); if (MobBoundingVector.z > 0.01) { string mobName = mob.name.Replace("Body(Clone)", ""); int mobDistance = (int)distanceToMob; string mobBoxText = $"{mobName}\n{mobDistance}m"; GUI.Label(new Rect(MobBoundingVector.x - 50f, (float)Screen.height - MobBoundingVector.y + 30f, 100f, 50f), mobBoxText, Main.renderMobsStyle); } } } }
// Token: 0x0600302B RID: 12331 RVA: 0x000CEB4C File Offset: 0x000CCD4C public override void OnEnter() { base.OnEnter(); this.stopwatch = 0f; if (base.modelLocator) { ChildLocator component = base.modelLocator.modelTransform.GetComponent <ChildLocator>(); this.aimAnimator = base.modelLocator.modelTransform.GetComponent <AimAnimator>(); if (this.aimAnimator) { this.aimAnimator.enabled = true; } if (component) { this.fistTransform = component.FindChild("RightFist"); if (this.fistTransform) { this.chargeEffect = UnityEngine.Object.Instantiate <GameObject>(this.chargeEffectPrefab, this.fistTransform); } } } this.subState = FireFist.SubState.Prep; base.PlayCrossfade("Body", "PrepFist", "PrepFist.playbackRate", FireFist.entryDuration, 0.1f); Util.PlayScaledSound(FireFist.chargeFistAttackSoundString, base.gameObject, this.attackSpeedStat); if (NetworkServer.active) { BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.teamMaskFilter = TeamMask.allButNeutral; if (base.teamComponent) { bullseyeSearch.teamMaskFilter.RemoveTeam(base.teamComponent.teamIndex); } bullseyeSearch.maxDistanceFilter = FireFist.maxDistance; bullseyeSearch.maxAngleFilter = 90f; Ray aimRay = base.GetAimRay(); bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.filterByLoS = false; bullseyeSearch.sortMode = BullseyeSearch.SortMode.Angle; bullseyeSearch.RefreshCandidates(); HurtBox hurtBox = bullseyeSearch.GetResults().FirstOrDefault <HurtBox>(); if (hurtBox) { this.predictor = new FireFist.Predictor(base.transform); this.predictor.SetTargetTransform(hurtBox.transform); } } }
private void UpdateLockOn() { if (base.isAuthority) { //Left leftEnemyFinder.searchOrigin = leftAimRay.origin; leftEnemyFinder.searchDirection = leftAimRay.direction; leftEnemyFinder.RefreshCandidates(); leftFoundAnyTarget = (leftLockedOnHurtBox = leftEnemyFinder.GetResults().FirstOrDefault()); //Right rightEnemyFinder.searchOrigin = rightAimRay.origin; rightEnemyFinder.searchDirection = rightAimRay.direction; rightEnemyFinder.RefreshCandidates(); rightFoundAnyTarget = (rightLockedOnHurtBox = rightEnemyFinder.GetResults().FirstOrDefault()); } }
// Token: 0x060007E9 RID: 2025 RVA: 0x00027338 File Offset: 0x00025538 public override void OnEnter() { base.OnEnter(); Util.PlaySound(HealBeam.playHealSoundString, base.gameObject); base.PlayCrossfade("Gesture", "Heal", 0.2f); this.healInterval = HealBeam.duration / (float)HealBeam.healCount; this.healChunk = HealBeam.healCoefficient / (float)HealBeam.healCount; Ray aimRay = base.GetAimRay(); BullseyeSearch bullseyeSearch = new BullseyeSearch(); bullseyeSearch.teamMaskFilter = TeamMask.none; if (base.teamComponent) { bullseyeSearch.teamMaskFilter.AddTeam(base.teamComponent.teamIndex); } bullseyeSearch.filterByLoS = false; bullseyeSearch.maxDistanceFilter = 50f; bullseyeSearch.maxAngleFilter = 180f; bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.sortMode = BullseyeSearch.SortMode.Angle; bullseyeSearch.RefreshCandidates(); bullseyeSearch.FilterOutGameObject(base.gameObject); this.target = bullseyeSearch.GetResults().FirstOrDefault <HurtBox>(); Debug.LogFormat("Healing target {0}", new object[] { this.target }); if (this.target) { this.targetHealthComponent = this.target.healthComponent; } string childName = "Muzzle"; Transform modelTransform = base.GetModelTransform(); if (modelTransform) { ChildLocator component = modelTransform.GetComponent <ChildLocator>(); if (component) { this.muzzleTransform = component.FindChild(childName); this.healBeam = UnityEngine.Object.Instantiate <GameObject>(HealBeam.healBeamPrefab, this.muzzleTransform); this.healBeamCurve = this.healBeam.GetComponent <BezierCurveLine>(); } } }
public override void Update() { base.Update(); if (!laserEffect || !laserLineComponent) { return; } float num = 1000f; Ray aimRay = GetAimRay(); enemyFinder.RefreshCandidates(); lockedOnHurtBox = enemyFinder.GetResults().FirstOrDefault(); if ((bool)lockedOnHurtBox) { aimRay.direction = lockedOnHurtBox.transform.position - aimRay.origin; } Vector3 position = laserEffect.transform.parent.position; Vector3 point = aimRay.GetPoint(num); if (Physics.Raycast(aimRay, out var hitInfo, num, (int)LayerIndex.world.mask | (int)LayerIndex.defaultLayer.mask)) { point = hitInfo.point; } laserLineComponent.SetPosition(0, position); laserLineComponent.SetPosition(1, point); float num2; if (duration - base.age > 0.5f) { num2 = base.age / duration; } else { flashTimer -= Time.deltaTime; if (flashTimer <= 0f) { laserOn = !laserOn; flashTimer = 71f / (678f * (float)Math.PI); } num2 = (laserOn ? 1f : 0f); } num2 *= laserMaxWidth; laserLineComponent.startWidth = num2; laserLineComponent.endWidth = num2; }