public static void DoBlink() { RaycastHit[] hits = Physics.RaycastAll(Camera.main.transform.position, Camera.main.transform.forward, BlinkRange); foreach (RaycastHit hit in hits) { if (BlinkDamage != 0) { if (hit.transform.root.CompareTag("enemyCollide")) { float dmg = BlinkDamage + ModdedPlayer.instance.SpellDamageBonus / 5; dmg *= ModdedPlayer.instance.SpellAMP; int dmgInt = Mathf.RoundToInt(dmg); if (GameSetup.IsMpClient) { BoltEntity enemyEntity = hit.transform.root.GetComponent <BoltEntity>(); if (enemyEntity == null) { enemyEntity = hit.transform.root.GetComponentInChildren <BoltEntity>(); } if (enemyEntity != null) { PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(enemyEntity); playerHitEnemy.hitFallDown = true; playerHitEnemy.Hit = dmgInt; playerHitEnemy.Send(); } } else { hit.transform.SendMessageUpwards("Hit", dmgInt, SendMessageOptions.DontRequireReceiver); } } } if (hit.transform.root != LocalPlayer.Transform.root && Vector3.Distance(hit.point, LocalPlayer.Transform.position) > 4) { int tries = 0; Vector3 hitPoint = hit.point; while (Physics.Raycast(hitPoint, Vector3.up, 2f) && tries < 5) { hitPoint += -Camera.main.transform.forward; tries++; } if (tries < 5) { BlinkTowards(hitPoint); return; } } } Vector3 checkPos = Camera.main.transform.position + new Vector3(Camera.main.transform.forward.x, 0, Camera.main.transform.forward.z).normalized *BlinkRange; if (Physics.Raycast(checkPos + Vector3.up * 2, Vector3.down, out RaycastHit hit1, 10f)) { BlinkTowards(hit1.point + Vector3.up); return; } BlinkTowards(Camera.main.transform.position + Camera.main.transform.forward * (BlinkRange - 1)); }
private void Update() { if (Time.time > this.valideColliderDelay) { this.ValidateWaterCollider(); this.valideColliderDelay = Time.time + 2f; } if (this.inWater) { if (this.currentWaterCollider) { float num = this.currentWaterCollider.bounds.center.y + this.currentWaterCollider.bounds.extents.y; if (!this.netPrefab && num - this.setup.rootTr.position.y > 0.9f && !this.setup.search.fsmInCave.Value) { if (!this.fsmExitWaterBool.Value) { this.setup.pmCombat.SendEvent("goToExitWater"); } this.fsmExitWaterBool.Value = true; } this.waterHeight = num - this.rootTr.position.y; if (this.waterHeight > 4f) { this.underWater = true; if (Time.time > this.inWaterTimer - 1f && !this.drowned) { if (BoltNetwork.isClient) { PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(GlobalTargets.OnlyServer); playerHitEnemy.Target = base.GetComponent <BoltEntity>(); playerHitEnemy.Hit = 1000; playerHitEnemy.Send(); } else { this.setup.health.HitReal(1000); } this.drowned = true; } } else { this.underWater = false; this.inWaterTimer = Time.time + 5f; } } else { this.underWater = false; } } else { this.inWaterTimer = Time.time + 5f; this.underWater = false; } }
private void calculateDamage(GameObject go) { if (this.allowDamage && this.rigidBody.velocity.magnitude > Mathf.Max(this.speedThreshold * 2f, 15f)) { if (go.CompareTag("PlayerNet") && BoltNetwork.isRunning) { BoltEntity componentInParent = go.GetComponentInParent <BoltEntity>(); if (componentInParent) { HitPlayer hitPlayer = HitPlayer.Create(componentInParent, EntityTargets.OnlyOwner); if (this.flintLock) { hitPlayer.damage = 45; } else { hitPlayer.damage = 5; } hitPlayer.Send(); } } if (go.CompareTag("enemyCollide") || go.CompareTag("enemyRoot") || go.tag == "lb_bird" || go.CompareTag("animalCollide") || go.CompareTag("Fish")) { if (BoltNetwork.isClient) { PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Raise(GlobalTargets.OnlyServer); playerHitEnemy.Target = go.GetComponentInParent <BoltEntity>(); playerHitEnemy.getAttackDirection = 3; playerHitEnemy.getAttackerType = 4; if (this.flintLock) { playerHitEnemy.Hit = 100; } else { playerHitEnemy.Hit = 1; } playerHitEnemy.Send(); } else if (!go.CompareTag("MidTree") && !go.CompareTag("Tree") && go.layer != 11) { go.gameObject.SendMessageUpwards("getAttackDirection", 3, SendMessageOptions.DontRequireReceiver); go.gameObject.SendMessageUpwards("getAttackerType", 4, SendMessageOptions.DontRequireReceiver); int num = 1; if (this.flintLock) { num = 100; } go.gameObject.SendMessageUpwards("Hit", num, SendMessageOptions.DontRequireReceiver); go.SendMessage("Hit", num, SendMessageOptions.DontRequireReceiver); } } } }
public IEnumerator SendPlayerHitEnemyCoroutine(PlayerHitEnemy playerHitEnemy, int rep, float delay) { yield return(new WaitForSeconds(delay)); for (int i = 0; i < rep; i++) { playerHitEnemy.Send(); yield return(null); yield return(null); } }
public static void ReduceArmor(BoltEntity target, int amount) { if (GameSetup.IsMultiplayer) { PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(GlobalTargets.OnlyServer); playerHitEnemy.Target = target; playerHitEnemy.Hit = -amount - 50000; playerHitEnemy.Send(); } else { EnemyManager.hostDictionary[target.networkId.PackedValue].ArmorReduction += amount; } }
public void DoGuaranteedAreaDamage(Transform rootTR, float damage) { RaycastHit[] hits = Physics.SphereCastAll(rootTR.position, stats.areaDamageRadius, Vector3.one, stats.areaDamageRadius, -9); var d = damage * stats.areaDamage; if (d > 0) { for (int i = 0; i < hits.Length; i++) { if (hits[i].transform.root != rootTR.root) { if (hits[i].transform.tag == "enemyCollide") { if (GameSetup.IsMpClient) { BoltEntity entity = hits[i].transform.GetComponent <BoltEntity>(); if (entity == null) { entity = hits[i].transform.GetComponentInParent <BoltEntity>(); } if (entity != null) { PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(GlobalTargets.OnlyServer); playerHitEnemy.Hit = DamageMath.GetSendableDamage(d); playerHitEnemy.getAttackerType = DamageMath.SILENTattackerType; //silent hit playerHitEnemy.Target = entity; playerHitEnemy.Send(); } } else { hits[i].transform.root.SendMessage("Hit", d, SendMessageOptions.DontRequireReceiver); } } else if (hits[i].transform.tag == "BreakableWood" || hits[i].transform.tag == "animalCollide") { hits[i].transform.root.SendMessage("Hit", d, SendMessageOptions.DontRequireReceiver); } } } } }
public static void DoBlink() { blinkAim?.Disable(); Transform t = Camera.main.transform; Vector3 blinkPoint = Vector3.zero; var hits1 = Physics.RaycastAll(t.position, t.forward, ModdedPlayer.Stats.spell_blinkRange + 1f); foreach (var hit in hits1) { if (!hit.transform.CompareTag("enemyCollide") && hit.transform.root != LocalPlayer.Transform.root) { blinkPoint = hit.point - t.forward + Vector3.up * 0.25f; break; } } if (blinkPoint == Vector3.zero) { blinkPoint = LocalPlayer.Transform.position + t.forward * ModdedPlayer.Stats.spell_blinkRange; } if (ModdedPlayer.Stats.spell_blinkDamage > 0) { RaycastHit[] hits = Physics.BoxCastAll(t.position, Vector3.one * 1.2f, blinkPoint - t.position, t.rotation, Vector3.Distance(blinkPoint, t.position) + 1); foreach (RaycastHit hit in hits) { if (hit.transform.CompareTag("enemyCollide")) { ModAPI.Console.Write("Hit enemy on layer " + hit.transform.gameObject.layer); float dmg = ModdedPlayer.Stats.spell_blinkDamage + ModdedPlayer.Stats.spellFlatDmg * ModdedPlayer.Stats.spell_blinkDamageScaling; dmg *= ModdedPlayer.Stats.TotalMagicDamageMultiplier; if (GameSetup.IsMpClient) { BoltEntity enemyEntity = hit.transform.GetComponentInParent <BoltEntity>(); if (enemyEntity == null) { enemyEntity = hit.transform.gameObject.GetComponent <BoltEntity>(); } if (enemyEntity != null) { PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(enemyEntity); playerHitEnemy.hitFallDown = true; playerHitEnemy.getAttackerType = DamageMath.CONVERTEDFLOATattackerType; playerHitEnemy.Hit = DamageMath.GetSendableDamage(dmg); playerHitEnemy.Send(); } } else { if (EnemyManager.enemyByTransform.ContainsKey(hit.transform.root)) { EnemyManager.enemyByTransform[hit.transform.root].HitMagic(dmg); } else { hit.transform.SendMessageUpwards("HitMagic", dmg, SendMessageOptions.DontRequireReceiver); } } } } } if (ModdedPlayer.Stats.spell_blinkDoExplosion) { Effects.Sound_Effects.GlobalSFX.Play(Effects.Sound_Effects.GlobalSFX.SFX.Boom); var raycastHitExplosion = Physics.OverlapSphere(blinkPoint, (blinkPoint - t.position).magnitude / 4f); float dmg = ModdedPlayer.Stats.spell_blinkDamage + LocalPlayer.Rigidbody.velocity.magnitude * ModdedPlayer.Stats.spellFlatDmg * ModdedPlayer.Stats.spell_blinkDamageScaling / 7f; dmg *= ModdedPlayer.Stats.TotalMagicDamageMultiplier * ModdedPlayer.Stats.RandomCritDamage; foreach (var hitCollider in raycastHitExplosion) { if (hitCollider.transform.CompareTag("enemyCollide")) { if (GameSetup.IsMpClient) { BoltEntity enemyEntity = hitCollider.transform.GetComponentInParent <BoltEntity>(); if (enemyEntity == null) { enemyEntity = hitCollider.transform.gameObject.GetComponent <BoltEntity>(); } if (enemyEntity != null) { PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(enemyEntity); playerHitEnemy.hitFallDown = true; playerHitEnemy.getAttackerType = DamageMath.CONVERTEDFLOATattackerType; playerHitEnemy.Hit = DamageMath.GetSendableDamage(dmg); playerHitEnemy.Send(); } } else { if (EnemyManager.enemyByTransform.ContainsKey(hitCollider.transform.root)) { EnemyManager.enemyByTransform[hitCollider.transform.root].HitMagic(dmg); } else { hitCollider.transform.SendMessageUpwards("HitMagic", dmg, SendMessageOptions.DontRequireReceiver); } } } } } BlinkTowards(blinkPoint); }
private IEnumerator HitAi(Transform target, bool hitDelay = false, bool headDamage = false) { yield return(null); int sendDamage = this.damage; if (headDamage) { sendDamage *= 20; } if (this.PhysicBody) { this.PhysicBody.velocity = Vector3.zero; } if (this.spearType) { this.PhysicBody.isKinematic = false; this.PhysicBody.useGravity = true; this.disableLive(); if (this.MyPickUp) { this.MyPickUp.SetActive(true); } } if (target) { Vector3 vector = target.transform.root.GetChild(0).InverseTransformPoint(base.transform.position); float targetAngle = Mathf.Atan2(vector.x, vector.z) * 57.29578f; int animalHitDirection = animalHealth.GetAnimalHitDirection(targetAngle); BoltEntity componentInParent = target.GetComponentInParent <BoltEntity>(); if (!componentInParent) { target.GetComponent <BoltEntity>(); } if (BoltNetwork.isClient && componentInParent) { if (hitDelay) { target.transform.SendMessageUpwards("getClientHitDirection", 6, SendMessageOptions.DontRequireReceiver); target.transform.SendMessageUpwards("StartPrediction", SendMessageOptions.DontRequireReceiver); BoltEntity component = this.parent.GetComponent <BoltEntity>(); PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Raise(GlobalTargets.OnlyServer); playerHitEnemy.Target = componentInParent; playerHitEnemy.Weapon = component; playerHitEnemy.getAttacker = 10; if (target.gameObject.CompareTag("animalRoot")) { playerHitEnemy.getAttackDirection = animalHitDirection; } else { playerHitEnemy.getAttackDirection = 3; } playerHitEnemy.getAttackerType = 4; playerHitEnemy.Hit = sendDamage; playerHitEnemy.Send(); } else { target.transform.SendMessageUpwards("getClientHitDirection", 6, SendMessageOptions.DontRequireReceiver); target.transform.SendMessageUpwards("StartPrediction", SendMessageOptions.DontRequireReceiver); PlayerHitEnemy playerHitEnemy2 = PlayerHitEnemy.Raise(GlobalTargets.OnlyServer); playerHitEnemy2.Target = componentInParent; if (target.gameObject.CompareTag("animalRoot")) { playerHitEnemy2.getAttackDirection = animalHitDirection; } else { playerHitEnemy2.getAttackDirection = 3; } playerHitEnemy2.getAttackerType = 4; playerHitEnemy2.Hit = sendDamage; playerHitEnemy2.Send(); } } else { target.gameObject.SendMessageUpwards("getAttackDirection", 3, SendMessageOptions.DontRequireReceiver); target.gameObject.SendMessageUpwards("getAttackerType", 4, SendMessageOptions.DontRequireReceiver); GameObject closestPlayerFromPos = Scene.SceneTracker.GetClosestPlayerFromPos(base.transform.position); target.gameObject.SendMessageUpwards("getAttacker", closestPlayerFromPos, SendMessageOptions.DontRequireReceiver); if (target.gameObject.CompareTag("lb_bird") || target.gameObject.CompareTag("animalRoot") || target.gameObject.CompareTag("enemyRoot") || target.gameObject.CompareTag("PlayerNet")) { if (target.gameObject.CompareTag("enemyRoot")) { EnemyHealth componentInChildren = target.GetComponentInChildren <EnemyHealth>(); if (componentInChildren) { componentInChildren.getAttackDirection(3); componentInChildren.setSkinDamage(2); mutantTargetSwitching componentInChildren2 = target.GetComponentInChildren <mutantTargetSwitching>(); if (componentInChildren2) { componentInChildren2.getAttackerType(4); componentInChildren2.getAttacker(closestPlayerFromPos); } componentInChildren.Hit(sendDamage); } } else { if (target.gameObject.CompareTag("animalRoot")) { target.gameObject.SendMessage("ApplyAnimalSkinDamage", animalHitDirection, SendMessageOptions.DontRequireReceiver); } target.gameObject.SendMessage("Hit", sendDamage, SendMessageOptions.DontRequireReceiver); target.gameObject.SendMessage("getSkinHitPosition", base.transform, SendMessageOptions.DontRequireReceiver); } } else { if (target.gameObject.CompareTag("animalCollide")) { target.gameObject.SendMessageUpwards("ApplyAnimalSkinDamage", animalHitDirection, SendMessageOptions.DontRequireReceiver); } target.gameObject.SendMessageUpwards("Hit", sendDamage, SendMessageOptions.DontRequireReceiver); target.gameObject.SendMessageUpwards("getSkinHitPosition", base.transform, SendMessageOptions.DontRequireReceiver); } } } if (this.MyPickUp) { this.MyPickUp.SetActive(true); } FMODCommon.PlayOneshotNetworked(this.hitAiEvent, base.transform, FMODCommon.NetworkRole.Any); yield return(null); yield break; }
private void LateUpdate() { if (this.Live && this.PhysicBody) { float num = this.PhysicBody.velocity.magnitude * 1.25f * Time.deltaTime; Vector3 vector = base.transform.position + base.transform.forward * -num; if (num > 0f && Physics.Raycast(base.transform.position, base.transform.forward, out this.hit, num, this.layers)) { if (this.hit.transform.CompareTag("Tree") || this.hit.transform.CompareTag("Target") || this.hit.transform.gameObject.layer == 20) { if (this.spearType) { if (this.bodyCollider) { this.bodyCollider.isTrigger = true; } this.PhysicBody.transform.position = this.hit.point - base.transform.forward * 2.1f; } else { this.PhysicBody.transform.position = this.hit.point - base.transform.forward * 0.35f; } this.PhysicBody.velocity = Vector3.zero; this.PhysicBody.isKinematic = true; this.MyPickUp.SetActive(true); this.Live = false; FMODCommon.PlayOneshotNetworked(this.hitTreeEvent, base.transform, FMODCommon.NetworkRole.Any); } else if (this.hit.transform.CompareTag("enemyCollide") || this.hit.transform.tag == "lb_bird" || this.hit.transform.CompareTag("animalCollide") || this.hit.transform.CompareTag("Fish")) { int num2; if (this.spearType) { num2 = Mathf.FloorToInt(40f); } else { num2 = Mathf.FloorToInt(2f * (this.PhysicBody.velocity.magnitude / 7f)); if (num2 > 22) { num2 = 22; } } if (this.spearType) { this.PhysicBody.velocity = Vector3.zero; this.PhysicBody.isKinematic = false; this.PhysicBody.useGravity = true; this.Live = false; this.MyPickUp.SetActive(true); } if (BoltNetwork.isClient) { PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Raise(GlobalTargets.OnlyServer); playerHitEnemy.Target = this.hit.transform.GetComponentInParent <BoltEntity>(); playerHitEnemy.getAttackDirection = 3; playerHitEnemy.getAttackerType = 4; playerHitEnemy.Hit = num2; playerHitEnemy.Send(); } else if (this.hit.transform.CompareTag("enemyRoot")) { this.hit.transform.gameObject.SendMessage("getAttackDirection", 3, SendMessageOptions.DontRequireReceiver); this.hit.transform.gameObject.SendMessage("getAttackerType", 4, SendMessageOptions.DontRequireReceiver); GameObject closestPlayerFromPos = Scene.SceneTracker.GetClosestPlayerFromPos(base.transform.position); this.hit.transform.gameObject.SendMessage("getAttacker", closestPlayerFromPos, SendMessageOptions.DontRequireReceiver); this.hit.transform.gameObject.SendMessage("Hit", num2, SendMessageOptions.DontRequireReceiver); } else { this.hit.transform.gameObject.SendMessageUpwards("getAttackDirection", 3, SendMessageOptions.DontRequireReceiver); this.hit.transform.gameObject.SendMessageUpwards("getAttackerType", 4, SendMessageOptions.DontRequireReceiver); GameObject closestPlayerFromPos2 = Scene.SceneTracker.GetClosestPlayerFromPos(base.transform.position); this.hit.transform.gameObject.SendMessageUpwards("getAttacker", closestPlayerFromPos2, SendMessageOptions.DontRequireReceiver); this.hit.transform.gameObject.SendMessageUpwards("Hit", num2, SendMessageOptions.DontRequireReceiver); } this.MyPickUp.SetActive(true); this.Live = false; } else if (this.hit.transform.CompareTag("PlayerNet")) { if (BoltNetwork.isRunning) { BoltEntity componentInParent = this.hit.transform.GetComponentInParent <BoltEntity>(); if (componentInParent) { HitPlayer.Create(componentInParent, EntityTargets.OnlyOwner).Send(); } } } else if (this.hit.transform.CompareTag("TerrainMain") || this.hit.transform.CompareTag("structure") || this.hit.transform.CompareTag("SLTier1") || this.hit.transform.CompareTag("SLTier2") || this.hit.transform.CompareTag("SLTier3")) { if (this.ignoreTerrain && this.hit.transform.CompareTag("TerrainMain")) { this.ignoreTerrain = false; Physics.IgnoreCollision(base.GetComponent <Collider>(), Terrain.activeTerrain.GetComponent <Collider>(), false); } else { if (this.spearType) { if (this.bodyCollider) { this.bodyCollider.isTrigger = true; } this.PhysicBody.transform.position = this.hit.point - base.transform.forward * 2.1f; } else { this.PhysicBody.transform.position = this.hit.point - base.transform.forward * 0.35f; } this.PhysicBody.velocity = Vector3.zero; this.PhysicBody.isKinematic = true; this.MyPickUp.SetActive(true); if (this.at) { this.at.enabled = false; } this.Live = false; if (this.hit.transform.CompareTag("TerrainMain")) { FMODCommon.PlayOneshotNetworked(this.hitGroundEvent, base.transform, FMODCommon.NetworkRole.Any); } else { FMODCommon.PlayOneshotNetworked(this.hitStructureEvent, base.transform, FMODCommon.NetworkRole.Any); } } } else if (this.hit.transform.CompareTag("CaveDoor")) { this.ignoreTerrain = true; Physics.IgnoreCollision(base.GetComponent <Collider>(), Terrain.activeTerrain.GetComponent <Collider>(), true); } else if (!this.hit.collider.isTrigger && !this.hit.transform.Equals(base.transform.parent) && this.hit.transform.CompareTag("enemyRoot")) { this.PhysicBody.velocity /= 4f; this.MyPickUp.SetActive(true); this.Live = false; } else if (!this.hit.collider.isTrigger && !this.hit.transform.Equals(base.transform.parent)) { this.PhysicBody.velocity /= 2f; this.MyPickUp.SetActive(true); this.Live = false; if (this.at) { this.at.enabled = false; } } if (!this.Live) { this.parent.BroadcastMessage("OnArrowHit", SendMessageOptions.DontRequireReceiver); } } } }
protected override void Update() { if (Time.time > valideColliderDelay) { ValidateWaterCollider(); valideColliderDelay = Time.time + 2f; } if (inWater) { if ((bool)currentWaterCollider) { Vector3 center = currentWaterCollider.bounds.center; float y = center.y; Vector3 extents = currentWaterCollider.bounds.extents; float num = y + extents.y; if (!netPrefab) { float num2 = num; Vector3 position = setup.rootTr.position; if (num2 - position.y > 0.9f && !setup.search.fsmInCave.Value) { if (!fsmExitWaterBool.Value) { setup.pmCombat.SendEvent("goToExitWater"); } fsmExitWaterBool.Value = true; } } float num3 = num; Vector3 position2 = rootTr.position; waterHeight = num3 - position2.y; if (waterHeight > 4f) { underWater = true; if (Time.time > inWaterTimer - 1f && !drowned) { if (BoltNetwork.isClient) { PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(GlobalTargets.OnlyServer); playerHitEnemy.Target = base.GetComponent <BoltEntity>(); playerHitEnemy.Hit = int.MaxValue - 1; playerHitEnemy.Send(); } else { setup.health.HitReal(setup.health.Health); } drowned = true; } } else { underWater = false; inWaterTimer = Time.time + 5f; } } else { underWater = false; } } else { inWaterTimer = Time.time + 5f; underWater = false; } }
protected override void OnTriggerEnter(Collider other) { try { currState = animator.GetCurrentAnimatorStateInfo(0); nextState = animator.GetNextAnimatorStateInfo(0); if (currState.tagHash != damagedHash && currState.tagHash != staggerHash && currState.tagHash != hitStaggerHash && currState.tagHash != deathHash && nextState.tagHash != damagedHash && nextState.tagHash != staggerHash && nextState.tagHash != hitStaggerHash && nextState.tagHash != deathHash) { if (other.gameObject.CompareTag("trapTrigger")) { other.gameObject.SendMessage("CutRope", SendMessageOptions.DontRequireReceiver); } if (!netPrefab && LocalPlayer.Animator && LocalPlayer.Animator.GetBool("deathBool")) { return; } if (other.gameObject.CompareTag("playerHitDetect") && mainTrigger) { if (!Scene.SceneTracker.hasAttackedPlayer) { Scene.SceneTracker.hasAttackedPlayer = true; Scene.SceneTracker.Invoke("resetHasAttackedPlayer", Random.Range(120, 240)); } targetStats component = other.transform.root.GetComponent <targetStats>(); if (component && component.targetDown) { return; } Animator componentInParent = other.gameObject.GetComponentInParent <Animator>(); Vector3 position = rootTr.position; position.y += 3.3f; Vector3 direction = other.transform.position - position; if (!Physics.Raycast(position, direction, out hit, direction.magnitude, enemyHitMask, QueryTriggerInteraction.Ignore)) { bool doParry = SpellActions.ParryAnythingIsTimed; if (doParry || (!creepy_male && !creepy && !creepy_baby && !creepy_fat && events)) { if (componentInParent) { bool flag = InFront(other.gameObject); if (doParry || ((!BoltNetwork.isServer || !netPrefab) && flag && events.parryBool && ((componentInParent.GetNextAnimatorStateInfo(1).tagHash == blockHash || componentInParent.GetCurrentAnimatorStateInfo(1).tagHash == blockHash)))) { SpellActions.DoParry(transform.position); ModAPI.Console.Write("Parrying successful"); if ((!creepy_male && !creepy && !creepy_baby && !creepy_fat && events)) { int parryDir = events != null ? events.parryDir : 1; BoltSetReflectedShim.SetIntegerReflected(animator, "parryDirInt", parryDir); if (BoltNetwork.isClient && netPrefab) { BoltSetReflectedShim.SetTriggerReflected(animator, "ClientParryTrigger"); hitPrediction.StartParryPrediction(); FMODCommon.PlayOneshot(parryEvent, base.transform); parryEnemy parryEnemy = parryEnemy.Create(GlobalTargets.OnlyServer); parryEnemy.Target = transform.root.GetComponent <BoltEntity>(); parryEnemy.Send(); } else { BoltSetReflectedShim.SetTriggerReflected(animator, "parryTrigger"); } events.StartCoroutine("disableAllWeapons"); playerHitReactions componentInParent2 = other.gameObject.GetComponentInParent <playerHitReactions>(); if (componentInParent2 != null) { componentInParent2.enableParryState(); } FMODCommon.PlayOneshotNetworked(parryEvent, base.transform, FMODCommon.NetworkRole.Server); events.parryBool = false; } return; } } } if ((bool)events) { events.parryBool = false; } other.transform.root.SendMessage("getHitDirection", rootTr.position, SendMessageOptions.DontRequireReceiver); float num = 0; if (maleSkinny || femaleSkinny) { if (pale) { num = ((!skinned) ? Mathf.Floor(10f * GameSettings.Ai.skinnyDamageRatio) : Mathf.Floor(10f * GameSettings.Ai.skinnyDamageRatio * GameSettings.Ai.skinMaskDamageRatio)); } else { num = Mathf.Floor(13f * GameSettings.Ai.skinnyDamageRatio); if (maleSkinny && props.regularStick.activeSelf && events.leftHandWeapon) { num = Mathf.Floor(num * 1.35f); } } } else if (male && pale) { num = ((!skinned) ? Mathf.Floor(22f * GameSettings.Ai.largePaleDamageRatio) : Mathf.Floor(22f * GameSettings.Ai.largePaleDamageRatio * GameSettings.Ai.skinMaskDamageRatio)); } else if (male && !firemanMain) { num = ((!painted) ? Mathf.Floor(20f * GameSettings.Ai.regularMaleDamageRatio) : Mathf.Floor(20f * GameSettings.Ai.regularMaleDamageRatio * GameSettings.Ai.paintedDamageRatio)); } else if (female) { num = Mathf.Floor(17f * GameSettings.Ai.regularFemaleDamageRatio); } else if (creepy) { num = ((!pale) ? Mathf.Floor(28f * GameSettings.Ai.creepyDamageRatio) : Mathf.Floor(35f * GameSettings.Ai.creepyDamageRatio)); } else if (creepy_male) { num = ((!pale) ? Mathf.Floor(60f * GameSettings.Ai.creepyDamageRatio) : Mathf.Floor(120f * GameSettings.Ai.creepyDamageRatio)); } else if (creepy_baby) { num = Mathf.Floor(26f * GameSettings.Ai.creepyBabyDamageRatio); } else if (firemanMain) { num = Mathf.Floor(12f * GameSettings.Ai.regularMaleDamageRatio); if (events && !enemyAtStructure && !events.noFireAttack) { if (BoltNetwork.isRunning && netPrefab) { other.gameObject.SendMessageUpwards("Burn", SendMessageOptions.DontRequireReceiver); } else { other.gameObject.SendMessageUpwards("Burn", SendMessageOptions.DontRequireReceiver); } } } if (!female && male) { if (holdingRegularWeapon() && events.leftHandWeapon) { num += 7; } else if (holdingAdvancedWeapon() && events.leftHandWeapon) { num += 15; } } if (setup && setup.health.poisoned) { num = Mathf.Floor(num / 2); } //COTF additional code try { if (GameSetup.IsMpClient) { if (other.transform.root == LocalPlayer.Transform.root) { var x = EnemyManager.clientEnemies[entity.networkId.PackedValue]; num = x.damagemult + num - 20f; if (x.abilities.Contains(EnemyProgression.Abilities.RainEmpowerment)) { if (Scene.WeatherSystem.Raining) { num *= 5; } } hitDamage = num; if (x.abilities.Contains(EnemyProgression.Abilities.Poisonous)) { BuffDB.AddBuff(3, 32, Mathf.Sqrt(num / 10) / 7, poisonDuration); } if (x.abilities.Contains(EnemyProgression.Abilities.Basher)) { ModdedPlayer.instance.Stun(stunDuration); } if (ModdedPlayer.Stats.TotalThornsDamage > 0) { if (ModdedPlayer.Stats.TotalThornsArmorPiercing > 0) { EnemyProgression.ReduceArmor(entity, ModdedPlayer.Stats.TotalThornsArmorPiercing); } PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(GlobalTargets.OnlyServer); playerHitEnemy.Target = entity; //this integer make the attack not stagger the enemy playerHitEnemy.getAttackerType = 2000000; playerHitEnemy.Hit = DamageMath.GetSendableDamage(ModdedPlayer.Stats.TotalThornsDamage); playerHitEnemy.Send(); } } } else { if (other.transform.root == LocalPlayer.Transform.root && EnemyManager.enemyByTransform.ContainsKey(this.rootTr)) { if (EnemyProg == null) { EnemyProg = EnemyManager.enemyByTransform[this.rootTr]; } num = EnemyProg.DamageAmp * EnemyProg.DebuffDmgMult + num - 20f; hitDamage = num; CotfUtils.Log($"Damage dealt to player: d{hitDamage} amp{EnemyProg.DamageAmp} lv{EnemyProg.level} php{hitDamage*100 / ModdedPlayer.Stats.TotalMaxHealth}%", true); //POISON ATTACKS if (EnemyProg.abilities.Contains(EnemyProgression.Abilities.Poisonous)) { BuffDB.AddBuff(3, 32, Mathf.Sqrt(num / 10) / 10, poisonDuration); } //STUN ON HIT if (EnemyProg.abilities.Contains(EnemyProgression.Abilities.Basher)) { ModdedPlayer.instance.Stun(stunDuration); } if (ModdedPlayer.Stats.TotalThornsDamage > 0) { EnemyProg.HitPhysicalSilent(ModdedPlayer.Stats.TotalThornsDamage); if (ModdedPlayer.Stats.TotalThornsArmorPiercing > 0) { EnemyProg.ReduceArmor(ModdedPlayer.Stats.TotalThornsArmorPiercing); } } } } } catch (System.Exception ex) { ModAPI.Log.Write(ex.ToString()); } PlayerStats component2 = other.transform.root.GetComponent <PlayerStats>(); if (male || female || creepy_male || creepy_fat || creepy || creepy_baby) { netId component3 = other.transform.GetComponent <netId>(); if (BoltNetwork.isServer && component3) { other.transform.root.SendMessage("StartPrediction", SendMessageOptions.DontRequireReceiver); return; } if (BoltNetwork.isClient && netPrefab && !(bool)component3) { other.transform.root.SendMessage("setCurrentAttacker", this, SendMessageOptions.DontRequireReceiver); other.transform.root.SendMessage("hitFromEnemy", Mathf.RoundToInt(num), SendMessageOptions.DontRequireReceiver); other.transform.root.SendMessage("StartPrediction", SendMessageOptions.DontRequireReceiver); } else if (BoltNetwork.isServer) { if (!(bool)component3) { other.transform.root.SendMessage("setCurrentAttacker", this, SendMessageOptions.DontRequireReceiver); other.transform.root.SendMessage("hitFromEnemy", Mathf.RoundToInt(num), SendMessageOptions.DontRequireReceiver); } } else if (!BoltNetwork.isRunning && component2) { component2.setCurrentAttacker(this); component2.hitFromEnemy(Mathf.RoundToInt(num)); } } else if (!netPrefab && component2) { component2.setCurrentAttacker(this); component2.hitFromEnemy(Mathf.RoundToInt(num)); } goto IL_092f; } return; } goto IL_092f; } return; IL_092f: if (other.gameObject.CompareTag("enemyCollide") && mainTrigger && bodyCollider && !enemyAtStructure) { setupAttackerType(); if (other.gameObject != bodyCollider) { other.transform.SendMessageUpwards("getAttackDirection", Random.Range(0, 2), SendMessageOptions.DontRequireReceiver); other.transform.SendMessageUpwards("getCombo", Random.Range(1, 4), SendMessageOptions.DontRequireReceiver); other.transform.SendMessage("getAttackerType", attackerType, SendMessageOptions.DontRequireReceiver); other.transform.SendMessage("getAttacker", rootTr.gameObject, SendMessageOptions.DontRequireReceiver); other.transform.SendMessageUpwards("HitPhysical", Random.Range(30f, 50f) * Mathf.Pow(ModdedPlayer.Stats.explosionDamage, 1.25f), SendMessageOptions.DontRequireReceiver); FMODCommon.PlayOneshotNetworked(weaponHitEvent, base.transform, FMODCommon.NetworkRole.Server); } } if (other.gameObject.CompareTag("BreakableWood") || (other.gameObject.CompareTag("BreakableRock") && mainTrigger)) { other.transform.SendMessage("Hit", 50, SendMessageOptions.DontRequireReceiver); other.SendMessage("LocalizedHit", new LocalizedHitData(base.transform.position, 50f), SendMessageOptions.DontRequireReceiver); FMODCommon.PlayOneshotNetworked(weaponHitEvent, base.transform, FMODCommon.NetworkRole.Server); } if (other.gameObject.CompareTag("SmallTree") && !mainTrigger) { other.SendMessage("Hit", 2, SendMessageOptions.DontRequireReceiver); } if (other.gameObject.CompareTag("Fire") && mainTrigger && firemanMain && !events.noFireAttack) { other.SendMessage("Burn", SendMessageOptions.DontRequireReceiver); } if (other.gameObject.CompareTag("Tree") && mainTrigger && creepy_male) { other.SendMessage("Explosion", 5f, SendMessageOptions.DontRequireReceiver); FMODCommon.PlayOneshotNetworked(weaponHitEvent, base.transform, FMODCommon.NetworkRole.Server); } if (!other.gameObject.CompareTag("structure") && !other.gameObject.CompareTag("SLTier1") && !other.gameObject.CompareTag("SLTier2") && !other.gameObject.CompareTag("SLTier3") && !other.gameObject.CompareTag("jumpObject") && !other.gameObject.CompareTag("UnderfootWood")) { return; } if (!mainTrigger) { return; } getStructureStrength component4 = other.gameObject.GetComponent <getStructureStrength>(); bool flag2 = component4 == null; enemyAtStructure = true; int num2; if (!creepy_male && !creepy && !creepy_fat && !creepy_baby) { if (!flag2) { num2 = ((maleSkinny || femaleSkinny) ? ((component4._strength == getStructureStrength.strength.weak) ? Mathf.FloorToInt(8f * GameSettings.Ai.regularStructureDamageRatio) : 0) : ((pale || painted || skinned) ? ((component4._strength != getStructureStrength.strength.veryStrong) ? Mathf.FloorToInt(16f * GameSettings.Ai.regularStructureDamageRatio) : 0) : ((component4._strength != getStructureStrength.strength.veryStrong) ? Mathf.FloorToInt(12f * GameSettings.Ai.regularStructureDamageRatio) : 0))); goto IL_0d63; } return; } num2 = ((!creepy_baby) ? Mathf.FloorToInt(30f * GameSettings.Ai.creepyStructureDamageRatio) : Mathf.FloorToInt(10f * GameSettings.Ai.creepyStructureDamageRatio)); goto IL_0d63; IL_0d63: if (setup && setup.health.poisoned) { num2 /= 2; } other.SendMessage("Hit", num2, SendMessageOptions.DontRequireReceiver); other.SendMessage("LocalizedHit", new LocalizedHitData(base.transform.position, num2), SendMessageOptions.DontRequireReceiver); FMODCommon.PlayOneshotNetworked(weaponHitEvent, base.transform, FMODCommon.NetworkRole.Server); } catch (System.Exception ee) { ModAPI.Log.Write(ee.ToString()); } }
public static void DoBlink() { blinkAim?.Disable(); Transform t = Camera.main.transform; Vector3 blinkPoint = Vector3.zero; var hits1 = Physics.RaycastAll(t.position, t.forward, BlinkRange + 1f); foreach (var hit in hits1) { if (!hit.transform.CompareTag("enemyCollide") && hit.transform.root != LocalPlayer.Transform.root) { blinkPoint = hit.point - t.forward + Vector3.up * 0.25f; break; } } if (blinkPoint == Vector3.zero) { blinkPoint = LocalPlayer.Transform.position + t.forward * BlinkRange; } if (BlinkDamage > 0) { RaycastHit[] hits = Physics.BoxCastAll(t.position, Vector3.one * 1.2f, blinkPoint - t.position, t.rotation, Vector3.Distance(blinkPoint, t.position) + 1); foreach (RaycastHit hit in hits) { if (hit.transform.CompareTag("enemyCollide")) { ModAPI.Console.Write("Hit enemy on layer " + hit.transform.gameObject.layer); float dmg = BlinkDamage + ModdedPlayer.instance.SpellDamageBonus; dmg *= ModdedPlayer.instance.SpellAMP * 3; DamageMath.DamageClamp(dmg, out int dmgInt, out int repetitions); if (GameSetup.IsMpClient) { BoltEntity enemyEntity = hit.transform.GetComponentInParent <BoltEntity>(); if (enemyEntity == null) { enemyEntity = hit.transform.gameObject.GetComponent <BoltEntity>(); } if (enemyEntity != null) { PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(enemyEntity); playerHitEnemy.hitFallDown = true; playerHitEnemy.explosion = true; playerHitEnemy.Hit = dmgInt; for (int i = 0; i < repetitions; i++) { playerHitEnemy.Send(); } } } else { var v = hit.transform.GetComponentInParent <EnemyProgression>(); if (v == null) { v = hit.transform.GetComponent <EnemyProgression>(); } if (v != null) { for (int i = 0; i < repetitions; i++) { v.HitMagic(dmgInt); } } else { hit.transform.SendMessageUpwards("Hit", dmgInt, SendMessageOptions.DontRequireReceiver); } } } } } BlinkTowards(blinkPoint); }
private void NewHitAi(Transform target, bool hitDelay, bool headDamage) { float dmgUnclamped = this.OutputDmg; ModAPI.Console.Write("dmgUnclamped: " + dmgUnclamped); if (ModdedPlayer.Stats.spell_seekingArrow) { float dist = Vector3.Distance(target.position, startposition); dmgUnclamped *= 1 + dist * ModdedPlayer.Stats.spell_seekingArrow_DamagePerDistance; } if (spearType) { if (ModdedPlayer.Stats.perk_thrownSpearhellChance > 0 && Random.value <= ModdedPlayer.Stats.perk_thrownSpearhellChance && OutputDmg > 1) { var obj = Instantiate(PhysicBody, Camera.main.transform.position + Vector3.up * 2f, Quaternion.LookRotation(PhysicBody.position - Camera.main.transform.position)); obj.velocity = PhysicBody.velocity.normalized * 90f * ModdedPlayer.Stats.projectileSpeed; Destroy(obj.gameObject, 18); } } else { if (headDamage) { if (ModdedPlayer.Stats.i_EruptionBow && GreatBow.isEnabled) { //if (GameSetup.IsMultiplayer) //{ BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position, Quaternion.identity); //} } } } if (headDamage || (flintLockAmmoType && Random.value <= ModdedPlayer.Stats.perk_bulletCritChance) || (spearType && Random.value <= ModdedPlayer.Stats.perk_thrownSpearCritChance)) { headDamage = true; dmgUnclamped *= ModdedPlayer.Stats.headShotDamage; dmgUnclamped *= SpellActions.FocusOnHeadShot(); if (ModdedPlayer.Stats.spell_seekingArrow) { dmgUnclamped *= ModdedPlayer.Stats.spell_seekingArrow_HeadDamage; } } else { dmgUnclamped *= SpellActions.FocusOnBodyShot(); } if (target) { Vector3 vector = target.transform.root.GetChild(0).InverseTransformPoint(base.transform.position); float targetAngle = Mathf.Atan2(vector.x, vector.z) * 57.29578f; int animalHitDirection = animalHealth.GetAnimalHitDirection(targetAngle); BoltEntity entity = target.GetComponentInParent <BoltEntity>(); if (!entity) { entity = target.GetComponent <BoltEntity>(); } if (BoltNetwork.isClient && entity) { ModdedPlayer.instance.OnHitEffectsClient(entity, dmgUnclamped); if (ignite) { using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream()) { using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream)) { w.Write(27); w.Write(entity.networkId.PackedValue); w.Write(Effects.BlackFlame.FireDamageBonus); w.Write(20f); w.Write(2200); w.Close(); } AsyncHit.SendCommandDelayed(3, answerStream.ToArray(), NetworkManager.Target.OnlyServer); answerStream.Close(); } } if (ModdedPlayer.Stats.spell_focus && headDamage) { if (ModdedPlayer.Stats.spell_focusBonusDmg == 0) { //slow enemy by 80% using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream()) { using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream)) { w.Write(22); w.Write(entity.networkId.PackedValue); w.Write(ModdedPlayer.Stats.spell_focusSlowAmount); w.Write(ModdedPlayer.Stats.spell_focusSlowDuration); w.Write(90); w.Close(); } AsyncHit.SendCommandDelayed(1, answerStream.ToArray(), Network.NetworkManager.Target.OnlyServer); answerStream.Close(); } //Network.NetworkManager.SendLine(s, Network.NetworkManager.Target.OnlyServer); } } else if (ModdedPlayer.Stats.spell_seekingArrow) { //slow enemy by 80% using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream()) { using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream)) { w.Write(22); w.Write(entity.networkId.PackedValue); w.Write(ModdedPlayer.Stats.spell_seekingArrow_SlowAmount); w.Write(ModdedPlayer.Stats.spell_seekingArrow_SlowDuration); w.Write(91); w.Close(); } AsyncHit.SendCommandDelayed(2, answerStream.ToArray(), Network.NetworkManager.Target.OnlyServer); answerStream.Close(); } } if (ignite) { if (BlackFlame.GiveAfterburn && Random.value < 0.1f) { int id = 120 + ModReferences.Players.IndexOf(LocalPlayer.GameObject); using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream()) { using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream)) { w.Write(34); w.Write(entity.networkId.PackedValue); w.Write(id); w.Write(1.15f); w.Write(25f); w.Close(); } AsyncHit.SendCommandDelayed(1, answerStream.ToArray(), NetworkManager.Target.OnlyServer); answerStream.Close(); } } } if (hitDelay) { target.transform.SendMessageUpwards("getClientHitDirection", 6, SendMessageOptions.DontRequireReceiver); target.transform.SendMessageUpwards("StartPrediction", SendMessageOptions.DontRequireReceiver); BoltEntity component = this.parent.GetComponent <BoltEntity>(); PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(GlobalTargets.OnlyServer); playerHitEnemy.Target = entity; playerHitEnemy.Weapon = component; playerHitEnemy.getAttacker = 10; if (target.gameObject.CompareTag("animalRoot")) { playerHitEnemy.getAttackDirection = animalHitDirection; } else { playerHitEnemy.getAttackDirection = 3; } playerHitEnemy.getAttackerType = 4; playerHitEnemy.Hit = DamageMath.GetSendableDamage(dmgUnclamped); if ((GreatBow.isEnabled && ModdedPlayer.Stats.i_greatBowIgnites) || (ignite && Random.value < 0.5f)) { playerHitEnemy.Burn = true; } playerHitEnemy.getAttackerType += 1000000; playerHitEnemy.Send(); } else { target.transform.SendMessageUpwards("getClientHitDirection", 6, SendMessageOptions.DontRequireReceiver); target.transform.SendMessageUpwards("StartPrediction", SendMessageOptions.DontRequireReceiver); PlayerHitEnemy playerHitEnemy2 = PlayerHitEnemy.Create(GlobalTargets.OnlyServer); playerHitEnemy2.Target = entity; if (target.gameObject.CompareTag("animalRoot")) { playerHitEnemy2.getAttackDirection = animalHitDirection; } else { playerHitEnemy2.getAttackDirection = 3; } playerHitEnemy2.getAttackerType = 4; if ((ignite && Random.value < 0.5f) || GreatBow.isEnabled && ModdedPlayer.Stats.i_greatBowIgnites) { playerHitEnemy2.Burn = true; } playerHitEnemy2.Hit = DamageMath.GetSendableDamage(dmgUnclamped); playerHitEnemy2.getAttackerType += DamageMath.CONVERTEDFLOATattackerType; playerHitEnemy2.Send(); } goto afterdamage; } else { if (target.gameObject.CompareTag("enemyRoot") || target.gameObject.CompareTag("enemyCollide")) { if (EnemyManager.enemyByTransform.ContainsKey(target.root)) { var ep = EnemyManager.enemyByTransform[target.root]; if (ignite) { if ((ignite && Random.value < 0.5f) || GreatBow.isEnabled && ModdedPlayer.Stats.i_greatBowIgnites) { ep.HealthScript.Burn(); } ep.FireDebuff(2200, Effects.BlackFlame.FireDamageBonus, 20); if (BlackFlame.GiveAfterburn && Random.value < 0.1f) { if (ep != null) { int id = 120 + ModReferences.Players.IndexOf(LocalPlayer.GameObject); ep.DmgTakenDebuff(id, 1.15f, 25); } } } ModdedPlayer.instance.OnHitEffectsHost(ep, dmgUnclamped); if (ModdedPlayer.Stats.spell_focus && headDamage) { if (ModdedPlayer.Stats.spell_focusBonusDmg == 0) { //slow enemy by 80% ep.Slow(90, ModdedPlayer.Stats.spell_focusSlowAmount, ModdedPlayer.Stats.spell_focusSlowDuration); } } else if (ModdedPlayer.Stats.spell_seekingArrow) { ep.Slow(91, ModdedPlayer.Stats.spell_seekingArrow_SlowAmount, ModdedPlayer.Stats.spell_seekingArrow_SlowDuration); } ep.HealthScript.getAttackDirection(3); ep.HitPhysical(dmgUnclamped); Debug.Log("HIT PHYSICAL"); goto afterdamage; } } target.gameObject.SendMessageUpwards("getAttackDirection", 3, SendMessageOptions.DontRequireReceiver); target.gameObject.SendMessageUpwards("getAttackerType", 4, SendMessageOptions.DontRequireReceiver); GameObject closestPlayerFromPos = TheForest.Utils.Scene.SceneTracker.GetClosestPlayerFromPos(base.transform.position); target.gameObject.SendMessageUpwards("getAttacker", closestPlayerFromPos, SendMessageOptions.DontRequireReceiver); if (target.gameObject.CompareTag("enemyRoot") || target.gameObject.CompareTag("lb_bird") || target.gameObject.CompareTag("animalRoot")) { Debug.Log("HIT NORMAL"); if (target.gameObject.CompareTag("enemyRoot")) { EnemyHealth targetEnemyHealth = target.GetComponentInChildren <EnemyHealth>(); if (targetEnemyHealth) { targetEnemyHealth.getAttackDirection(3); targetEnemyHealth.setSkinDamage(2); mutantTargetSwitching componentInChildren2 = target.GetComponentInChildren <mutantTargetSwitching>(); if (componentInChildren2) { componentInChildren2.getAttackerType(4); componentInChildren2.getAttacker(closestPlayerFromPos); } targetEnemyHealth.Hit((int)Mathf.Min((float)int.MaxValue, dmgUnclamped)); if ((ignite && Random.value < 0.5f) || GreatBow.isEnabled && ModdedPlayer.Stats.i_greatBowIgnites) { targetEnemyHealth.Burn(); } } } else { if (target.gameObject.CompareTag("animalRoot")) { target.gameObject.SendMessage("ApplyAnimalSkinDamage", animalHitDirection, SendMessageOptions.DontRequireReceiver); } target.SendMessageUpwards("Hit", (int)Mathf.Min(dmgUnclamped, int.MaxValue / 2), SendMessageOptions.DontRequireReceiver); if ((ignite && Random.value < 0.5f) || GreatBow.isEnabled && ModdedPlayer.Stats.i_greatBowIgnites) { target.gameObject.SendMessage("Burn", SendMessageOptions.DontRequireReceiver); } target.gameObject.SendMessage("getSkinHitPosition", base.transform, SendMessageOptions.DontRequireReceiver); } } else { if (target.gameObject.CompareTag("animalCollide")) { target.gameObject.SendMessageUpwards("ApplyAnimalSkinDamage", animalHitDirection, SendMessageOptions.DontRequireReceiver); } target.SendMessageUpwards("Hit", (int)Mathf.Min(dmgUnclamped, int.MaxValue / 2), SendMessageOptions.DontRequireReceiver); if (GreatBow.isEnabled && ModdedPlayer.Stats.i_greatBowIgnites || (ignite && Random.value < 0.5f)) { target.gameObject.SendMessage("Burn", SendMessageOptions.DontRequireReceiver); } target.gameObject.SendMessageUpwards("getSkinHitPosition", base.transform, SendMessageOptions.DontRequireReceiver); } } } afterdamage: if (ModdedPlayer.Stats.perk_projectileNoConsumeChance > 0.35f) { FMODCommon.PlayOneshotNetworked(this.hitAiEvent, base.transform, FMODCommon.NetworkRole.Any); } }