//This block of code allows us to change the reload sounds. protected void Update() { if (gun.CurrentOwner) { if (!gun.PreventNormalFireAudio) { this.gun.PreventNormalFireAudio = true; } if (!gun.IsReloading && !HasReloaded) { this.HasReloaded = true; } if (gun.IsReloading) { count++; if (count == 10) { foreach (var projectile in GetBullets()) { float radius = 3; Vector2 Standing = this.gun.CurrentOwner.CenterPosition; if (Vector2.Distance(projectile.LastPosition, Standing) <= radius) { PassiveReflectItem.ReflectBullet(projectile, true, this.gun.CurrentOwner, 15f, 1f, 1f, 0f); } } count = 0; } } } }
public void reflect() { foreach (var projectile in GetBullets()) { PassiveReflectItem.ReflectBullet(projectile, true, this.Owner, 15f, 1f, 1.5f, 0f); } }
private IEnumerator HandleSwing(PlayerController user, Vector2 aimVec, float rayDamage, float rayLength) { float elapsed = 0f; while (elapsed < 1) { elapsed += BraveTime.DeltaTime; SpeculativeRigidbody hitRigidbody = this.IterativeRaycast(user.CenterPosition, aimVec, rayLength, int.MaxValue, user.specRigidbody); if (hitRigidbody && hitRigidbody.aiActor && hitRigidbody.aiActor.IsNormalEnemy) { if (user.IsPrimaryPlayer) { hitRigidbody.aiActor.healthHaver.ApplyDamage(rayDamage, aimVec, "primaryplayer", CoreDamageTypes.None, DamageCategory.Normal, false, null, false); hitRigidbody.aiActor.knockbackDoer.ApplyKnockback(aimVec, 5); } else { hitRigidbody.aiActor.healthHaver.ApplyDamage(rayDamage, aimVec, "secondaryplayer", CoreDamageTypes.None, DamageCategory.Normal, false, null, false); hitRigidbody.aiActor.knockbackDoer.ApplyKnockback(aimVec, 5); } } SpeculativeRigidbody hitRigidbody2 = this.IterativeRaycast(user.CenterPosition, aimVec, rayLength, int.MaxValue, user.specRigidbody); if (hitRigidbody2 && hitRigidbody2.projectile && hitRigidbody2.projectile.Owner != this.gun.CurrentOwner) { PassiveReflectItem.ReflectBullet(hitRigidbody2.projectile, true, this.gun.CurrentOwner, 15f, 1f, 1f, 0f); } yield return(null); } yield break; }
protected override void DoEffect(PlayerController user) { base.DoEffect(user); foreach (var projectile in GetBullets()) { PassiveReflectItem.ReflectBullet(projectile, true, user, 10f, 1f, 1f, 0f); } }
private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherCollider) { Projectile component = otherRigidbody.GetComponent <Projectile>(); if (component != null && !(component.Owner is PlayerController)) { PassiveReflectItem.ReflectBullet(component, true, Owner.specRigidbody.gameActor, 10f, 1f, 1f, 0f); PhysicsEngine.SkipCollision = true; } }
public override void OnFinishAttack(PlayerController player, Gun gun) { if (player.IsInCombat) { AkSoundEngine.PostEvent("Stop_WPN_All", base.gameObject); if (effects_controller == 1) { RadialSlowInterface the_big_slow = new RadialSlowInterface(); the_big_slow.RadialSlowHoldTime = .75f; the_big_slow.RadialSlowOutTime = .25f; the_big_slow.RadialSlowTimeModifier = 0f; the_big_slow.DoesSepia = true; the_big_slow.UpdatesForNewEnemies = true; the_big_slow.RadialSlowInTime = 0f; the_big_slow.DoRadialSlow(this.Owner.CenterPosition, this.gun.CurrentOwner.GetAbsoluteParentRoom()); RoomHandler room = player.CurrentRoom; foreach (var enemy in room.GetActiveEnemies(RoomHandler.ActiveEnemyType.All)) { if (multiplier > 1500) { enemy.healthHaver.ApplyDamage(80, Vector2.zero, "bracer", CoreDamageTypes.Magic, DamageCategory.Unstoppable, true, null, true); this.DoSafeExplosion(enemy.specRigidbody.UnitCenter); } else { enemy.healthHaver.ApplyDamage(2 * multiplier / 40, Vector2.zero, "bracer", CoreDamageTypes.Magic, DamageCategory.Unstoppable, true, null, true); this.DoSafeExplosion(enemy.specRigidbody.UnitCenter); } if (enemy.healthHaver.IsBoss) { enemy.healthHaver.ApplyDamage(45, Vector2.zero, "bracer", CoreDamageTypes.Magic, DamageCategory.Unstoppable, true, null, true); this.DoSafeExplosion(enemy.specRigidbody.UnitCenter); this.DoSafeExplosion(enemy.specRigidbody.UnitCenter); } } foreach (var projectile in GetBullets()) { if (projectile.Owner.healthHaver.IsBoss) { PassiveReflectItem.ReflectBullet(projectile, true, this.Owner, 15f, 1f, 15f, 0f); } else { PassiveReflectItem.ReflectBullet(projectile, true, this.Owner, 15f, 1f, 3f, 0f); } } effects_controller = 0; multiplier = 0; } base.OnFinishAttack(player, gun); } }
private void HandleMirrorEffect(TableTechChaosEffectIdentifier identifier, FlippableCover obj) { if (identifier == TableTechChaosEffectIdentifier.MIRROR) { AkSoundEngine.PostEvent("Play_WPN_kthulu_soul_01", obj.gameObject); obj.sprite.usesOverrideMaterial = true; tk2dSprite tk2dSprite = obj.sprite as tk2dSprite; tk2dSprite.GenerateUV2 = true; Material material = Instantiate <Material>(obj.sprite.renderer.material); material.DisableKeyword("TINTING_OFF"); material.EnableKeyword("TINTING_ON"); material.SetColor("_OverrideColor", new Color(0f, 1f, 1f)); material.DisableKeyword("EMISSIVE_OFF"); material.EnableKeyword("EMISSIVE_ON"); material.SetFloat("_EmissivePower", 1.75f); material.SetFloat("_EmissiveColorPower", 1f); obj.sprite.renderer.material = material; Shader shader = Shader.Find("Brave/ItemSpecific/MetalSkinLayerShader"); MeshRenderer component = obj.sprite.GetComponent <MeshRenderer>(); Material[] sharedMaterials = component.sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { if (sharedMaterials[i].shader == shader) { return; } } Array.Resize <Material>(ref sharedMaterials, sharedMaterials.Length + 1); Material material2 = new Material(shader); material2.SetTexture("_MainTex", sharedMaterials[0].GetTexture("_MainTex")); sharedMaterials[sharedMaterials.Length - 1] = material2; component.sharedMaterials = sharedMaterials; tk2dSprite.ForceBuild(); obj.specRigidbody.OnPreRigidbodyCollision += new SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate( delegate(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (otherRigidbody.projectile != null && !(otherRigidbody.projectile.Owner is PlayerController) && base.Owner != null) { PassiveReflectItem.ReflectBullet(otherRigidbody.projectile, true, base.Owner, 10f, 1f, 1f, 0f); otherRigidbody.RegisterSpecificCollisionException(obj.specRigidbody); PhysicsEngine.SkipCollision = true; } } ); if (base.Owner.PlayerHasActiveSynergy("#HIDDEN_TECH_SUPER_CHAOS")) { obj.gameObject.AddComponent <MirrorBreakSynergyProcessor>().Initialize(); } } }
private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (base.specRigidbody && base.aiActor && base.healthHaver && base.healthHaver.IsAlive && Owner && base.sprite) { if (otherRigidbody.projectile && !(otherRigidbody.projectile.Owner is PlayerController)) { if (Owner.PlayerHasActiveSynergy("Deviled Gregs")) { if (UnityEngine.Random.value <= 0.15f) { float spawnAngle = 0f; for (int i = 0; i < 8; i++) { GameObject gameObject = SpawnManager.SpawnProjectile((PickupObjectDatabase.GetById(336) as Gun).DefaultModule.projectiles[0].gameObject, base.sprite.WorldCenter, Quaternion.Euler(0f, 0f, spawnAngle), true); Projectile component = gameObject.GetComponent <Projectile>(); if (component) { component.SpawnedFromOtherPlayerProjectile = false; if (Owner != null) { //COMPANION SHIT component.TreatedAsNonProjectileForChallenge = true; component.baseData.damage *= Owner.stats.GetStatValue(PlayerStats.StatType.Damage); component.baseData.speed *= Owner.stats.GetStatValue(PlayerStats.StatType.ProjectileSpeed); component.baseData.force *= Owner.stats.GetStatValue(PlayerStats.StatType.KnockbackMultiplier); component.AdditionalScaleMultiplier *= Owner.stats.GetStatValue(PlayerStats.StatType.PlayerBulletScale); component.UpdateSpeed(); base.HandleCompanionPostProcessProjectile(component); } } spawnAngle += 45; } } } if (Owner.PlayerHasActiveSynergy("Hard Boiled Gregs")) { PassiveReflectItem.ReflectBullet(otherRigidbody.projectile, true, Owner.specRigidbody.gameActor, 10f, 1f, 1f, 0f); if (base.healthHaver) { base.healthHaver.ApplyDamage(13, Vector2.zero, "Greggo"); } PhysicsEngine.SkipCollision = true; } } } }
private void MaybeReflect(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherCollider) { if (otherRigidbody.projectile != null) { Projectile proj = otherRigidbody.projectile; if (!proj.IsBlackBullet) { PassiveReflectItem.ReflectBullet(proj, true, this.m_owner, 20f, 1, 1.25f, 0); } else if (this.m_advancedSynergyUpgradeActive) { PassiveReflectItem.ReflectBullet(proj, true, this.m_owner, 10f, 1f, 1f, 0f); } PhysicsEngine.SkipCollision = true; } }
private void ReflectProjectile(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { Projectile component = otherRigidbody.GetComponent <Projectile>(); if (component != null && !(component.Owner is PlayerController)) { if (UnityEngine.Random.value < .16f) { PassiveReflectItem.ReflectBullet(component, true, Owner.specRigidbody.gameActor, 40f, 1f, .5f, 0f); PhysicsEngine.SkipCollision = true; Material outlineMaterial = SpriteOutlineManager.GetOutlineMaterial(component.sprite); Color specialPink = new Color(254, 126, 229, 50f); outlineMaterial.SetColor("_OverrideColor", specialPink); } } }
private static void HandleHeroSwordSlash(List <SpeculativeRigidbody> alreadyHit, Vector2 arcOrigin, float slashAngle, int slashId, PlayerController owner, ProjInteractMode intmode, float damageToDeal, float enemyKnockback, List <GameActorEffect> statusEffects, float jammedDMGMult, float bossDMGMult, float slashRange, float slashDimensions) { ReadOnlyCollection <Projectile> allProjectiles2 = StaticReferenceManager.AllProjectiles; for (int j = allProjectiles2.Count - 1; j >= 0; j--) { Projectile projectile2 = allProjectiles2[j]; if (ProjectileIsValid(projectile2)) { Vector2 projectileCenter = projectile2.sprite.WorldCenter; if (ObjectWasHitBySlash(projectileCenter, arcOrigin, slashAngle, slashRange, slashDimensions)) { if (intmode != ProjInteractMode.IGNORE || projectile2.collidesWithProjectiles) { if (intmode == ProjInteractMode.DESTROY || intmode == ProjInteractMode.IGNORE) { projectile2.DieInAir(false, true, true, true); } else if (intmode == ProjInteractMode.REFLECT) { if (projectile2.LastReflectedSlashId != slashId) { PassiveReflectItem.ReflectBullet(projectile2, true, owner, 2f, 1f, 1f, 0f); projectile2.LastReflectedSlashId = slashId; } } } } } } DealDamageToEnemiesInArc(owner, arcOrigin, slashAngle, slashRange, damageToDeal, enemyKnockback, statusEffects, jammedDMGMult, bossDMGMult, slashDimensions, alreadyHit); List <MinorBreakable> allMinorBreakables = StaticReferenceManager.AllMinorBreakables; for (int k = allMinorBreakables.Count - 1; k >= 0; k--) { MinorBreakable minorBreakable = allMinorBreakables[k]; if (minorBreakable && minorBreakable.specRigidbody) { if (!minorBreakable.IsBroken && minorBreakable.sprite) { if (ObjectWasHitBySlash(minorBreakable.sprite.WorldCenter, arcOrigin, slashAngle, slashRange, slashDimensions)) { minorBreakable.Break(); } } } } List <MajorBreakable> allMajorBreakables = StaticReferenceManager.AllMajorBreakables; for (int l = allMajorBreakables.Count - 1; l >= 0; l--) { MajorBreakable majorBreakable = allMajorBreakables[l]; if (majorBreakable && majorBreakable.specRigidbody) { if (!alreadyHit.Contains(majorBreakable.specRigidbody)) { if (!majorBreakable.IsSecretDoor && !majorBreakable.IsDestroyed) { if (ObjectWasHitBySlash(majorBreakable.specRigidbody.UnitCenter, arcOrigin, slashAngle, slashRange, slashDimensions)) { float num9 = damageToDeal; if (majorBreakable.healthHaver) { num9 *= 0.2f; } majorBreakable.ApplyDamage(num9, majorBreakable.specRigidbody.UnitCenter - arcOrigin, false, false, false); alreadyHit.Add(majorBreakable.specRigidbody); } } } } } }