Beispiel #1
0
        protected override void Update()
        {
            try
            {
                if (!(Scene.Atmosphere == null) && !SteamDSConfig.isDedicatedServer)
                {
                    float num = Convert.ToSingle(LocalPlayer.Stats.DaySurvived + TheForest.Utils.Scene.Atmosphere.DeltaTimeOfDay);
                    if (Mathf.FloorToInt(num) != Mathf.FloorToInt(LocalPlayer.Stats.DaySurvived))
                    {
                        LocalPlayer.Stats.DaySurvived = num;
                        EventRegistry.Player.Publish(TfEvent.SurvivedDay, null);
                    }
                    else
                    {
                        LocalPlayer.Stats.DaySurvived = num;
                    }
                    LocalPlayer.ScriptSetup.targetInfo.isRed = IsRed;
                    float num2 = 0f;
                    num2           = ((!coldSwitch || LocalPlayer.AnimControl.coldOffsetBool) ? 0f : 1f);
                    coldFloatBlend = Mathf.Lerp(coldFloatBlend, num2, Time.deltaTime * 10f);
                    if (coldFloatBlend > 0.01f)
                    {
                        BoltSetReflectedShim.SetFloatReflected(animator, "coldFloat", coldFloatBlend);
                    }
                    else
                    {
                        BoltSetReflectedShim.SetFloatReflected(animator, "coldFloat", 0f);
                    }
                    if (Run && HeartRate < 170)
                    {
                        HeartRate++;
                    }
                    else if (!Run && HeartRate > 70)
                    {
                        HeartRate--;
                    }
                    if (Sitted)
                    {
                        Energy += 0.02f * ModdedPlayer.instance.MaxEnergy * Time.deltaTime + ModdedPlayer.instance.StaminaAndEnergyRegenAmp * 6 * Time.deltaTime;
                    }
                    if (!Clock.Dark && IsCold && !LocalPlayer.IsInCaves && !IsInNorthColdArea())
                    {
                        goto IL_01cb;
                    }
                    if (LocalPlayer.IsInEndgame)
                    {
                        goto IL_01cb;
                    }
                    goto IL_01e2;
                }
                return;

IL_01e2:
                if (IsInNorthColdArea() && !Warm)
                {
                    SetCold(true);
                }
                if (ShouldDoWetColdRoll && !IsCold && (LocalPlayer.IsInCaves || Clock.Dark))
                {
                    if (!LocalPlayer.Buoyancy.InWater)
                    {
                        ShouldDoWetColdRoll = false;
                    }
                    else if (LocalPlayer.IsInCaves)
                    {
                        if (LocalPlayer.AnimControl.swimming)
                        {
                            if (Time.time - CaveStartSwimmingTime > 12f)
                            {
                                SetCold(true);
                                ShouldDoWetColdRoll = false;
                            }
                        }
                        else
                        {
                            CaveStartSwimmingTime = Time.time;
                        }
                    }
                    else
                    {
                        Vector3 position = LocalPlayer.Transform.position;
                        if (position.y - LocalPlayer.Buoyancy.WaterLevel < 1f)
                        {
                            if (UnityEngine.Random.Range(0, 100) < 30)
                            {
                                SetCold(true);
                            }
                            ShouldDoWetColdRoll = false;
                        }
                    }
                }
                if (ShouldDoGotCleanCheck)
                {
                    if (!LocalPlayer.Buoyancy.InWater)
                    {
                        ShouldDoGotCleanCheck = false;
                    }
                    else
                    {
                        Vector3 position2 = LocalPlayer.ScriptSetup.hipsJnt.position;
                        if (position2.y - LocalPlayer.Buoyancy.WaterLevel < -0.5f)
                        {
                            ShouldDoGotCleanCheck = false;
                            GotCleanReal();
                        }
                    }
                }
                if (Health <= GreyZoneThreshold && AudioListener.volume > 0.2f)
                {
                    AudioListener.volume -= 0.1f * Time.deltaTime;
                }
                else if (AudioListener.volume < 1f)
                {
                    AudioListener.volume += 0.1f * Time.deltaTime;
                }
                if (IsHealthInGreyZone)
                {
                    Tuts.LowHealthTutorial();
                }
                else
                {
                    Tuts.CloseLowHealthTutorial();
                }
                if (Energy < 15f)
                {
                    Tuts.LowEnergyTutorial();
                }
                else
                {
                    Tuts.CloseLowEnergyTutorial();
                }
                if (Stamina <= 5 && !IsTired)
                {
                    base.SendMessage("PlayStaminaBreath");
                    IsTired = true;
                    Run     = false;
                }

                HealthTarget      = Mathf.Clamp(HealthTarget, 0, ChampionsOfForest.ModdedPlayer.instance.MaxHealth);
                GreyZoneThreshold = Mathf.RoundToInt(ModdedPlayer.instance.MaxHealth * 0.05f);
                //if (HealthTarget > ChampionsOfForest.ModdedPlayer.instance.MaxHealth)
                //{
                //    HealthTarget = ChampionsOfForest.ModdedPlayer.instance.MaxHealth;
                //}
                if (Stamina > 5 && IsTired)
                {
                    IsTired = false;
                }
                fsmStamina.Value    = 100 * Stamina / ModdedPlayer.instance.MaxEnergy;
                fsmMaxStamina.Value = 100 * Energy / ModdedPlayer.instance.MaxEnergy;
                HealthResult        = Health / ChampionsOfForest.ModdedPlayer.instance.MaxHealth + (ChampionsOfForest.ModdedPlayer.instance.MaxHealth - Health) / ChampionsOfForest.ModdedPlayer.instance.MaxHealth * 0.5f;
                float num3 = HealthTarget / ChampionsOfForest.ModdedPlayer.instance.MaxHealth + (ChampionsOfForest.ModdedPlayer.instance.MaxHealth - HealthTarget) / ChampionsOfForest.ModdedPlayer.instance.MaxHealth * 0.5f;
                if (HealthTargetResult < num3)
                {
                    HealthTargetResult = Mathf.MoveTowards(HealthTargetResult, num3, 1f * Time.fixedDeltaTime);
                }
                else
                {
                    HealthTargetResult = num3;
                }
                StaminaResult = Stamina / ChampionsOfForest.ModdedPlayer.instance.MaxEnergy + (ChampionsOfForest.ModdedPlayer.instance.MaxEnergy - Stamina) / ChampionsOfForest.ModdedPlayer.instance.MaxEnergy * 0.5f;
                EnergyResult  = Energy / ChampionsOfForest.ModdedPlayer.instance.MaxEnergy + (ChampionsOfForest.ModdedPlayer.instance.MaxEnergy - Energy) / ChampionsOfForest.ModdedPlayer.instance.MaxEnergy * 0.5f;
                int num4 = 0;
                int num5 = 0;
                for (int i = 0; i < CurrentArmorTypes.Length; i++)
                {
                    switch (CurrentArmorTypes[i])
                    {
                    case ArmorTypes.DeerSkin:
                    case ArmorTypes.Warmsuit:
                        num5++;
                        break;

                    case ArmorTypes.LizardSkin:
                    case ArmorTypes.Leaves:
                    case ArmorTypes.Bone:
                        num4++;
                        break;

                    case ArmorTypes.Creepy:
                        num4++;
                        break;
                    }
                }
                ColdArmorResult                = num5 / 10f / 2f + 0.5f;
                ArmorResult                    = num4 / 10f / 2f + ColdArmorResult;
                Hud.ColdArmorBar.fillAmount    = ColdArmorResult;
                Hud.ArmorBar.fillAmount        = ArmorResult;
                Hud.StaminaBar.fillAmount      = StaminaResult;
                Hud.HealthBar.fillAmount       = HealthResult;
                Hud.HealthBarTarget.fillAmount = HealthTargetResult;
                Hud.EnergyBar.fillAmount       = EnergyResult;
                float num6 = (Fullness - 0.2f) / 0.8f;
                TheForest.Utils.Scene.HudGui.Stomach.fillAmount = Mathf.Lerp(0.21f, 0.81f, num6);
                if (num6 < 0.5)
                {
                    Hud.StomachOutline.SetActive(true);
                    if (!Hud.Tut_Hungry.activeSelf)
                    {
                        Tuts.HungryTutorial();
                    }
                }
                else
                {
                    if (Hud.Tut_Hungry.activeSelf)
                    {
                        Tuts.CloseHungryTutorial();
                    }
                    Hud.StomachOutline.SetActive(false);
                }
                if (!TheForest.Utils.Scene.Atmosphere.Sleeping || Fullness > StarvationSettings.SleepingFullnessThreshold)
                {
                    Fullness -= Convert.ToSingle(TheForest.Utils.Scene.Atmosphere.DeltaTimeOfDay * 1.6500000238418579 * 0.4f * ModdedPlayer.instance.HungerRate);
                }
                if (!Cheats.NoSurvival)
                {
                    if (Fullness < 0.2f)
                    {
                        if (Fullness < 0.19f)
                        {
                            Fullness = 0.19f;
                        }
                        if (DaySurvived >= StarvationSettings.StartDay && !Dead && !TheForest.Utils.Scene.Atmosphere.Sleeping && LocalPlayer.Inventory.enabled)
                        {
                            if (!TheForest.Utils.Scene.HudGui.StomachStarvation.gameObject.activeSelf)
                            {
                                if (Starvation == 0f)
                                {
                                    StarvationCurrentDuration = StarvationSettings.Duration;
                                }
                                TheForest.Utils.Scene.HudGui.StomachStarvation.gameObject.SetActive(true);
                            }
                            Starvation += Convert.ToSingle(TheForest.Utils.Scene.Atmosphere.DeltaTimeOfDay / StarvationCurrentDuration);
                            if (Starvation >= 1f)
                            {
                                if (!StarvationSettings.TakingDamage)
                                {
                                    StarvationSettings.TakingDamage = true;
                                    LocalPlayer.Tuts.ShowStarvationTut();
                                }
                                Hit(StarvationSettings.Damage, true, DamageType.Physical);
                                TheForest.Utils.Scene.HudGui.StomachStarvationTween.ResetToBeginning();
                                TheForest.Utils.Scene.HudGui.StomachStarvationTween.PlayForward();
                                Starvation = 0f;
                                StarvationCurrentDuration *= StarvationSettings.DurationDecay;
                            }
                            TheForest.Utils.Scene.HudGui.StomachStarvation.fillAmount = Mathf.Lerp(0.21f, 0.81f, Starvation);
                        }
                    }
                    else if (Starvation > 0f || TheForest.Utils.Scene.HudGui.StomachStarvation.gameObject.activeSelf)
                    {
                        Starvation = 0f;
                        StarvationCurrentDuration       = StarvationSettings.Duration;
                        StarvationSettings.TakingDamage = false;
                        LocalPlayer.Tuts.StarvationTutOff();
                        TheForest.Utils.Scene.HudGui.StomachStarvation.gameObject.SetActive(false);
                    }
                }
                else
                {
                    Fullness = 1f;
                    if (Starvation > 0f || TheForest.Utils.Scene.HudGui.StomachStarvation.gameObject.activeSelf)
                    {
                        Starvation = 0f;
                        StarvationCurrentDuration       = StarvationSettings.Duration;
                        StarvationSettings.TakingDamage = false;
                        TheForest.Utils.Scene.HudGui.StomachStarvation.gameObject.SetActive(false);
                    }
                }
                if (Fullness > 1f)
                {
                    Fullness = 1f;
                }
                if (!Cheats.NoSurvival)
                {
                    if (DaySurvived >= ThirstSettings.StartDay && !Dead && LocalPlayer.Inventory.enabled)
                    {
                        if (Thirst >= 1f)
                        {
                            if (!TheForest.Utils.Scene.HudGui.ThirstDamageTimer.gameObject.activeSelf)
                            {
                                TheForest.Utils.Scene.HudGui.ThirstDamageTimer.gameObject.SetActive(true);
                            }
                            if (ThirstCurrentDuration <= 0f)
                            {
                                ThirstCurrentDuration = ThirstSettings.DamageDelay;
                                if (!ThirstSettings.TakingDamage)
                                {
                                    ThirstSettings.TakingDamage = true;
                                    LocalPlayer.Tuts.ShowThirstTut();
                                }
                                Hit(Mathf.CeilToInt(ModdedPlayer.instance.MaxHealth * 0.2f * GameSettings.Survival.ThirstDamageRatio), true, DamageType.Physical);
                                BleedBehavior.BloodAmount += 0.6f;
                                TheForest.Utils.Scene.HudGui.ThirstDamageTimerTween.ResetToBeginning();
                                TheForest.Utils.Scene.HudGui.ThirstDamageTimerTween.PlayForward();
                            }
                            else
                            {
                                ThirstCurrentDuration -= Time.deltaTime;
                                TheForest.Utils.Scene.HudGui.ThirstDamageTimer.fillAmount = 1f - ThirstCurrentDuration / ThirstSettings.DamageDelay;
                            }
                        }
                        else if (Thirst < 0f)
                        {
                            Thirst = 0f;
                        }
                        else
                        {
                            if (!TheForest.Utils.Scene.Atmosphere.Sleeping || Thirst < ThirstSettings.SleepingThirstThreshold)
                            {
                                Thirst += Convert.ToSingle((TheForest.Utils.Scene.Atmosphere.DeltaTimeOfDay / ThirstSettings.Duration) * 1.1f * GameSettings.Survival.ThirstRatio * ModdedPlayer.instance.ThirstRate * 0.4f);
                            }
                            if (Thirst > ThirstSettings.TutorialThreshold)
                            {
                                //LocalPlayer.Tuts.ShowThirstyTut();
                                TheForest.Utils.Scene.HudGui.ThirstOutline.SetActive(true);
                            }
                            else
                            {
                                LocalPlayer.Tuts.HideThirstyTut();
                                TheForest.Utils.Scene.HudGui.ThirstOutline.SetActive(false);
                            }
                            if (ThirstSettings.TakingDamage)
                            {
                                ThirstSettings.TakingDamage = false;
                                LocalPlayer.Tuts.ThirstTutOff();
                            }
                            if (TheForest.Utils.Scene.HudGui.ThirstDamageTimer.gameObject.activeSelf)
                            {
                                TheForest.Utils.Scene.HudGui.ThirstDamageTimer.gameObject.SetActive(false);
                            }
                        }
                        TheForest.Utils.Scene.HudGui.Hydration.fillAmount = 1f - Thirst;
                    }
                }
                else if (TheForest.Utils.Scene.HudGui.Hydration.fillAmount != 1f)
                {
                    TheForest.Utils.Scene.HudGui.Hydration.fillAmount = 1f;
                }
                bool flag  = false;
                bool flag2 = false;
                if (LocalPlayer.WaterViz.ScreenCoverage > AirBreathing.ScreenCoverageThreshold && !Dead)
                {
                    if (!TheForest.Utils.Scene.HudGui.AirReserve.gameObject.activeSelf)
                    {
                        TheForest.Utils.Scene.HudGui.AirReserve.gameObject.SetActive(true);
                    }
                    if (!AirBreathing.UseRebreather && AirBreathing.RebreatherIsEquipped && AirBreathing.CurrentRebreatherAir > 0f)
                    {
                        AirBreathing.UseRebreather = true;
                    }
                    if (AirBreathing.UseRebreather)
                    {
                        flag = true;
                        AirBreathing.CurrentRebreatherAir -= Time.deltaTime;
                        TheForest.Utils.Scene.HudGui.AirReserve.fillAmount = AirBreathing.CurrentRebreatherAir / AirBreathing.MaxRebreatherAirCapacity;
                        if (AirBreathing.CurrentRebreatherAir < 0f)
                        {
                            AirBreathing.CurrentLungAir = 0f;
                            AirBreathing.UseRebreather  = false;
                        }
                        else if (AirBreathing.CurrentRebreatherAir < AirBreathing.OutOfAirWarningThreshold)
                        {
                            if (!TheForest.Utils.Scene.HudGui.AirReserveOutline.activeSelf)
                            {
                                TheForest.Utils.Scene.HudGui.AirReserveOutline.SetActive(true);
                            }
                        }
                        else if (TheForest.Utils.Scene.HudGui.AirReserveOutline.activeSelf)
                        {
                            TheForest.Utils.Scene.HudGui.AirReserveOutline.SetActive(false);
                        }
                    }
                    else
                    {
                        if (Time.timeScale > 0f)
                        {
                            if (!AirBreathing.CurrentLungAirTimer.IsRunning)
                            {
                                AirBreathing.CurrentLungAirTimer.Start();
                            }
                        }
                        else if (AirBreathing.CurrentLungAirTimer.IsRunning)
                        {
                            AirBreathing.CurrentLungAirTimer.Stop();
                        }
                        if (AirBreathing.CurrentLungAir > AirBreathing.MaxLungAirCapacityFinal)
                        {
                            AirBreathing.CurrentLungAir = AirBreathing.MaxLungAirCapacityFinal;
                        }
                        if (AirBreathing.CurrentLungAir > AirBreathing.CurrentLungAirTimer.Elapsed.TotalSeconds * Skills.LungBreathingRatio)
                        {
                            Skills.TotalLungBreathingDuration += Time.deltaTime;
                            TheForest.Utils.Scene.HudGui.AirReserve.fillAmount = Mathf.Lerp(TheForest.Utils.Scene.HudGui.AirReserve.fillAmount, AirBreathing.CurrentAirPercent, Mathf.Clamp01((Time.time - Time.fixedTime) / Time.fixedDeltaTime));
                            if (!TheForest.Utils.Scene.HudGui.AirReserveOutline.activeSelf)
                            {
                                TheForest.Utils.Scene.HudGui.AirReserveOutline.SetActive(true);
                            }
                        }
                        else if (!Cheats.NoSurvival)
                        {
                            flag2 = true;
                            AirBreathing.DamageCounter += AirBreathing.Damage * Time.deltaTime;
                            if (AirBreathing.DamageCounter >= 1f)
                            {
                                int dmg = 3 + (int)(ModdedPlayer.instance.MaxHealth * 0.1f);
                                Hit(dmg, true, DamageType.Drowning);
                                AirBreathing.DamageCounter -= (int)AirBreathing.DamageCounter;
                            }
                            if (Dead)
                            {
                                AirBreathing.DamageCounter = 0f;
                                DeadTimes++;
                                TheForest.Utils.Scene.HudGui.AirReserve.gameObject.SetActive(false);
                                TheForest.Utils.Scene.HudGui.AirReserveOutline.SetActive(false);
                            }
                            else if (!TheForest.Utils.Scene.HudGui.AirReserveOutline.activeSelf)
                            {
                                TheForest.Utils.Scene.HudGui.AirReserveOutline.SetActive(true);
                            }
                        }
                    }
                }
                else if (AirBreathing.CurrentLungAir < AirBreathing.MaxLungAirCapacityFinal || TheForest.Utils.Scene.HudGui.AirReserve.gameObject.activeSelf)
                {
                    if (GaspForAirEvent.Length > 0 && FMOD_StudioSystem.instance && !Dead)
                    {
                        FMOD_StudioSystem.instance.PlayOneShot(GaspForAirEvent, base.transform.position, delegate(FMOD.Studio.EventInstance instance)
                        {
                            float value = 85f;
                            if (!AirBreathing.UseRebreather)
                            {
                                value = (AirBreathing.CurrentLungAir - (float)AirBreathing.CurrentLungAirTimer.Elapsed.TotalSeconds) / AirBreathing.MaxLungAirCapacity * 100f;
                            }
                            UnityUtil.ERRCHECK(instance.setParameterValue("oxygen", value));
                            return(true);
                        });
                    }
                    AirBreathing.DamageCounter = 0f;
                    AirBreathing.CurrentLungAirTimer.Stop();
                    AirBreathing.CurrentLungAirTimer.Reset();
                    AirBreathing.CurrentLungAir = AirBreathing.MaxLungAirCapacityFinal;
                    TheForest.Utils.Scene.HudGui.AirReserve.gameObject.SetActive(false);
                    TheForest.Utils.Scene.HudGui.AirReserveOutline.SetActive(false);
                }
                if (flag)
                {
                    UpdateRebreatherEvent();
                }
                else
                {
                    StopIfPlaying(RebreatherEventInstance);
                }
                if (flag2)
                {
                    UpdateDrowningEvent();
                }
                else
                {
                    StopIfPlaying(DrowningEventInstance);
                }
                if (Energy > ChampionsOfForest.ModdedPlayer.instance.MaxEnergy)
                {
                    Energy = ChampionsOfForest.ModdedPlayer.instance.MaxEnergy;
                }
                if (Energy < 5)
                {
                    Energy = 5;
                }
                if (Health < 0f)
                {
                    Health = 0f;
                }
                if (Health > ChampionsOfForest.ModdedPlayer.instance.MaxHealth)
                {
                    Health = ChampionsOfForest.ModdedPlayer.instance.MaxHealth;
                }
                if (Health < HealthTarget)
                {
                    Health = Mathf.MoveTowards(Health, HealthTarget, (GameSettings.Survival.HealthRegenPerSecond + ModdedPlayer.instance.MaxHealth * 0.0025f + ModdedPlayer.instance.LifeRegen) * (ModdedPlayer.instance.HealthRegenPercent + 1) * ModdedPlayer.instance.HealingMultipier * Time.deltaTime);

                    TheForest.Utils.Scene.HudGui.HealthBarTarget.enabled = true;
                }
                else
                {
                    TheForest.Utils.Scene.HudGui.HealthBarTarget.enabled = false;
                }
                if (Health < 20f)
                {
                    Hud.HealthBarOutline.SetActive(true);
                }
                else
                {
                    Hud.HealthBarOutline.SetActive(false);
                }
                if (Energy < 15f || IsCold)
                {
                    Hud.EnergyBarOutline.SetActive(true);
                }
                else
                {
                    Hud.EnergyBarOutline.SetActive(false);
                }
                if (Stamina < 10f)
                {
                    Hud.StaminaBarOutline.SetActive(true);
                }
                else
                {
                    Hud.StaminaBarOutline.SetActive(false);
                }
                if (Stamina < 0f)
                {
                    Stamina = 0f;
                }
                if (Stamina < Energy)
                {
                    if (!LocalPlayer.FpCharacter.running && !(LocalPlayer.FpCharacter.recoveringFromRun > 0f))
                    {
                        Stamina += ModdedPlayer.instance.StaminaRecover * Time.deltaTime * ModdedPlayer.instance.StaminaAndEnergyRegenAmp * (1 + ModdedPlayer.instance.StaminaRegenPercent);
                        Energy  += ModdedPlayer.instance.EnergyPerSecond * ModdedPlayer.instance.StaminaAndEnergyRegenAmp * Time.deltaTime;
                    }
                    else if (LocalPlayer.FpCharacter.recoveringFromRun > 0f && Thirst < 1)
                    {
                        LocalPlayer.FpCharacter.recoveringFromRun -= Time.deltaTime;
                    }
                }
                else
                {
                    Stamina = Energy;
                    Energy += ModdedPlayer.instance.EnergyPerSecond * ModdedPlayer.instance.StaminaAndEnergyRegenAmp * Time.deltaTime;
                }
                if (CheckingBlood && TheForest.Utils.Scene.SceneTracker.proxyAttackers.arrayList.Count > 0)
                {
                    StopBloodCheck();
                }
                if (IsCold && !Warm && LocalPlayer.Inventory.enabled)
                {
                    if (BodyTemp > 14f)
                    {
                        BodyTemp -= 1f * (1f - Mathf.Clamp01(ColdArmor));
                    }
                    if (FrostDamageSettings.DoDeFrost)
                    {
                        if (FrostScript.coverage > FrostDamageSettings.DeFrostThreshold)
                        {
                            FrostScript.coverage -= 0.0159999728f * Time.deltaTime / FrostDamageSettings.DeFrostDuration;
                        }
                        else
                        {
                            FrostDamageSettings.DoDeFrost = false;
                        }
                    }
                    else if (FrostScript.coverage < 0.49f || ColdArmor >= 1f)
                    {
                        if (FrostScript.coverage < 0f)
                        {
                            FrostScript.coverage = 0f;
                        }
                        FrostScript.coverage += 0.01f * Time.deltaTime * (1f - Mathf.Clamp01(ColdArmor)) * GameSettings.Survival.FrostSpeedRatio;
                        if (FrostScript.coverage > 0.492f)
                        {
                            FrostScript.coverage = 0.491f;
                        }
                    }
                    else if (!Cheats.NoSurvival && TheForest.Utils.Scene.Clock.ElapsedGameTime >= FrostDamageSettings.StartDay && LocalPlayer.Inventory.CurrentView != PlayerInventory.PlayerViews.Book && LocalPlayer.Inventory.CurrentView != PlayerInventory.PlayerViews.Inventory && !LocalPlayer.AnimControl.doShellRideMode)
                    {
                        if (!LocalPlayer.FpCharacter.jumping && (!LocalPlayer.AnimControl.onRope || !LocalPlayer.AnimControl.VerticalMovement) && !IsLit && LocalPlayer.Rigidbody.velocity.sqrMagnitude < 0.3f && !Dead)
                        {
                            if (FrostDamageSettings.CurrentTimer >= FrostDamageSettings.Duration)
                            {
                                if (FrostDamageSettings.DamageChance == 0)
                                {
                                    Hit((int)((ModdedPlayer.instance.MaxHealth * 0.015f + FrostDamageSettings.Damage) * GameSettings.Survival.FrostDamageRatio), true, DamageType.Frost);
                                    FrostScript.coverage             = 0.506f;
                                    FrostDamageSettings.DoDeFrost    = true;
                                    FrostDamageSettings.CurrentTimer = 0f;
                                }
                            }
                            else
                            {
                                FrostDamageSettings.CurrentTimer += Time.deltaTime * ((1f - Mathf.Clamp01(ColdArmor)) * 1f);
                            }
                        }
                        else
                        {
                            FrostDamageSettings.CurrentTimer = 0f;
                        }
                    }
                }
                if (Warm)
                {
                    if (BodyTemp < 37f)
                    {
                        BodyTemp += 1f * (1f + Mathf.Clamp01(ColdArmor));
                    }
                    if (FrostScript.coverage > 0f)
                    {
                        FrostScript.coverage -= 0.01f * Time.deltaTime * (1f + Mathf.Clamp01(ColdArmor)) * GameSettings.Survival.DefrostSpeedRatio;
                        if (FrostScript.coverage < 0f)
                        {
                            FrostScript.coverage = 0f;
                        }
                    }
                    else
                    {
                        FrostDamageSettings.TakingDamage = false;
                    }
                    FrostDamageSettings.CurrentTimer = 0f;
                }
                if (LocalPlayer.IsInCaves)
                {
                    Sanity.InCave();
                }
                if (PlayerSfx.MusicPlaying)
                {
                    Sanity.ListeningToMusic();
                }
                if (Sitted)
                {
                    Sanity.SittingOnBench();
                }
                Calories.Refresh();
                if (DyingEventInstance != null && !flag2 && !Dead)
                {
                    UnityUtil.ERRCHECK(DyingEventInstance.set3DAttributes(UnityUtil.to3DAttributes(base.gameObject, null)));
                    UnityUtil.ERRCHECK(DyingHealthParameter.setValue(Health));
                }
                if (FireExtinguishEventInstance != null)
                {
                    UnityUtil.ERRCHECK(FireExtinguishEventInstance.set3DAttributes(UnityUtil.to3DAttributes(base.gameObject, null)));
                }
                if (Cheats.InfiniteEnergy)
                {
                    Energy  = ChampionsOfForest.ModdedPlayer.instance.MaxEnergy;
                    Stamina = ChampionsOfForest.ModdedPlayer.instance.MaxEnergy;
                }
                if (Cheats.GodMode)
                {
                    Health       = ChampionsOfForest.ModdedPlayer.instance.MaxHealth;
                    HealthTarget = ChampionsOfForest.ModdedPlayer.instance.MaxHealth;
                }
                return;

IL_01cb:
                SetCold(false);
                FrostScript.coverage = 0f;
                goto IL_01e2;
            }
            catch (Exception E)
            {
                ModAPI.Log.Write(E.ToString());
            }
        }
        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 override void HandleLanded()
        {
            LocalPlayer.CamFollowHead.stopAllCameraShake();
            fallShakeBlock = false;
            base.StopCoroutine("startJumpTimer");
            jumpTimerStarted = false;
            float num  = 28f;
            bool  flag = false;

            if (LocalPlayer.AnimControl.doShellRideMode && prevVelocityXZ.magnitude > 32f)
            {
                flag = true;
            }
            if (prevVelocity > num && !flag && allowFallDamage && jumpingTimer > 0.75f)
            {
                if (!jumpLand && !Clock.planecrash)
                {
                    jumpCoolDown = true;
                    jumpLand     = true;
                    float num2   = prevVelocity * 0.9f * (prevVelocity / 27.5f);
                    int   damage = (int)num2;
                    float num3   = 3.8f;
                    if (LocalPlayer.AnimControl.doShellRideMode)
                    {
                        num3 = 5f;
                    }
                    bool flag2 = false;
                    if (jumpingTimer > num3)
                    {
                        damage = 1000;
                        flag2  = true;
                    }
                    if (LocalPlayer.AnimControl.doShellRideMode && !flag2)
                    {
                        damage = 17;
                    }
                    Stats.Hit(Mathf.RoundToInt(damage * UpgradePointsMod.instance.falldamage), true, PlayerStats.DamageType.Physical);
                    BoltSetReflectedShim.SetBoolReflected(LocalPlayer.Animator, "jumpBool", false);
                    if (Stats.Health > 0f)
                    {
                        if (!LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("doingJumpAttack").Value&& !LocalPlayer.AnimControl.doShellRideMode)
                        {
                            BoltSetReflectedShim.SetIntegerReflected(LocalPlayer.Animator, "jumpType", 1);
                            LocalPlayer.Animator.SetTrigger("landHeavyTrigger");
                            BoltSetReflectedShim.SetBoolReflected(LocalPlayer.Animator, "jumpBool", false);
                            CanJump = false;
                            LocalPlayer.HitReactions.StartCoroutine("doHardfallRoutine");
                            prevMouseXSpeed = LocalPlayer.MainRotator.rotationSpeed;
                            LocalPlayer.MainRotator.rotationSpeed = 0.55f;
                            BoltSetReflectedShim.SetLayerWeightReflected(LocalPlayer.Animator, 4, 0f);
                            BoltSetReflectedShim.SetLayerWeightReflected(LocalPlayer.Animator, 0, 1f);
                            BoltSetReflectedShim.SetLayerWeightReflected(LocalPlayer.Animator, 1, 0f);
                            BoltSetReflectedShim.SetLayerWeightReflected(LocalPlayer.Animator, 2, 0f);
                            BoltSetReflectedShim.SetLayerWeightReflected(LocalPlayer.Animator, 3, 0f);
                            base.Invoke("resetAnimSpine", 1f);
                        }
                        else
                        {
                            jumpLand     = false;
                            jumpCoolDown = false;
                        }
                    }
                    else
                    {
                        jumpCoolDown = false;
                        jumpLand     = false;
                    }
                }
                blockJumpAttack();
            }
            jumping = false;
            base.CancelInvoke("setAnimatorJump");
            if (!jumpCoolDown)
            {
                BoltSetReflectedShim.SetIntegerReflected(LocalPlayer.Animator, "jumpType", 0);
                BoltSetReflectedShim.SetBoolReflected(LocalPlayer.Animator, "jumpBool", false);
                LocalPlayer.ScriptSetup.pmControl.SendEvent("toWait");
                blockJumpAttack();
            }
            base.CancelInvoke("fallDamageTimer");
            allowFallDamage = 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))
                        {
                            if (!creepy_male && !creepy && !creepy_baby && !creepy_fat && events && componentInParent)
                            {
                                bool flag = InFront(other.gameObject);
                                if ((!BoltNetwork.isServer || !netPrefab) && flag && events.parryBool && (componentInParent.GetNextAnimatorStateInfo(1).tagHash == blockHash || componentInParent.GetCurrentAnimatorStateInfo(1).tagHash == blockHash))
                                {
                                    int parryDir = events.parryDir;
                                    BoltSetReflectedShim.SetIntegerReflected(animator, "parryDirInt", parryDir);
                                    if (BoltNetwork.isClient && netPrefab)
                                    {
                                        BoltSetReflectedShim.SetTriggerReflected(animator, "ClientParryTrigger");
                                        hitPrediction.StartParryPrediction();
                                        parryEnemy parryEnemy = parryEnemy.Create(GlobalTargets.OnlyServer);
                                        parryEnemy.Target = transform.root.GetComponent <BoltEntity>();
                                        parryEnemy.Send();
                                        FMODCommon.PlayOneshot(parryEvent, base.transform);
                                    }
                                    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);
                            int num = 0;
                            if (maleSkinny || femaleSkinny)
                            {
                                if (pale)
                                {
                                    num = ((!skinned) ? Mathf.FloorToInt(10f * GameSettings.Ai.skinnyDamageRatio) : Mathf.FloorToInt(10f * GameSettings.Ai.skinnyDamageRatio * GameSettings.Ai.skinMaskDamageRatio));
                                }
                                else
                                {
                                    num = Mathf.FloorToInt(13f * GameSettings.Ai.skinnyDamageRatio);
                                    if (maleSkinny && props.regularStick.activeSelf && events.leftHandWeapon)
                                    {
                                        num = Mathf.FloorToInt(num * 1.35f);
                                    }
                                }
                            }
                            else if (male && pale)
                            {
                                num = ((!skinned) ? Mathf.FloorToInt(22f * GameSettings.Ai.largePaleDamageRatio) : Mathf.FloorToInt(22f * GameSettings.Ai.largePaleDamageRatio * GameSettings.Ai.skinMaskDamageRatio));
                            }
                            else if (male && !firemanMain)
                            {
                                num = ((!painted) ? Mathf.FloorToInt(20f * GameSettings.Ai.regularMaleDamageRatio) : Mathf.FloorToInt(20f * GameSettings.Ai.regularMaleDamageRatio * GameSettings.Ai.paintedDamageRatio));
                            }
                            else if (female)
                            {
                                num = Mathf.FloorToInt(17f * GameSettings.Ai.regularFemaleDamageRatio);
                            }
                            else if (creepy)
                            {
                                num = ((!pale) ? Mathf.FloorToInt(28f * GameSettings.Ai.creepyDamageRatio) : Mathf.FloorToInt(35f * GameSettings.Ai.creepyDamageRatio));
                            }
                            else if (creepy_male)
                            {
                                num = ((!pale) ? Mathf.FloorToInt(30f * GameSettings.Ai.creepyDamageRatio) : Mathf.FloorToInt(40f * GameSettings.Ai.creepyDamageRatio));
                            }
                            else if (creepy_baby)
                            {
                                num = Mathf.FloorToInt(26f * GameSettings.Ai.creepyBabyDamageRatio);
                            }
                            else if (firemanMain)
                            {
                                num = Mathf.FloorToInt(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.FloorToInt(num / 1.6f);
                            }

                            //My additional code
                            try
                            {
                                if (EnemyProg == null)
                                {
                                    EnemyProg = setup.health.gameObject.GetComponent <EnemyProgression>();
                                }
                                num = Mathf.RoundToInt(num * EnemyProg.DamageAmp);
                                BoltEntity bo = other.transform.root.GetComponent <BoltEntity>();
                                if (bo == null)
                                {
                                    bo = other.transform.root.GetComponentInChildren <BoltEntity>();
                                }


                                //POISON ATTACKS
                                if (EnemyProg.abilities.Contains(EnemyProgression.Abilities.Poisonous))
                                {
                                    if (BoltNetwork.isRunning)
                                    {
                                        if (BoltNetwork.isServer)
                                        {
                                            if (other.transform.root == LocalPlayer.Transform.root)
                                            {
                                                BuffDB.AddBuff(3, 32, num / 20, poisonDuration);
                                            }
                                            else
                                            {
                                                if (bo != null)
                                                {
                                                    Network.NetworkManager.SendLine("PO" + bo.networkId.PackedValue + ";32;" + num / 20 + ";" + poisonDuration, bo.controller);
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        BuffDB.AddBuff(3, 32, num / 20, poisonDuration);
                                    }
                                }

                                //STUN ON HIT
                                if (EnemyProg.abilities.Contains(EnemyProgression.Abilities.Basher))
                                {
                                    if (BoltNetwork.isRunning)
                                    {
                                        if (BoltNetwork.isServer)
                                        {
                                            if (other.transform.root == LocalPlayer.Transform.root)
                                            {
                                                ModdedPlayer.instance.Stun(stunDuration);
                                            }
                                            else
                                            {
                                                if (bo != null)
                                                {
                                                    Network.NetworkManager.SendLine("ST" + bo.networkId.PackedValue + ";" + stunDuration + ";", bo.controller);
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        ModdedPlayer.instance.Stun(stunDuration);
                                    }
                                }
                            }
                            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", 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", num, SendMessageOptions.DontRequireReceiver);
                                    }
                                }
                                else if (!BoltNetwork.isRunning && component2)
                                {
                                    component2.setCurrentAttacker(this);
                                    component2.hitFromEnemy(num);
                                }
                            }
                            else if (!netPrefab && component2)
                            {
                                component2.setCurrentAttacker(this);
                                component2.hitFromEnemy(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("Hit", 6, 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 = false;
                if (component4 == null)
                {
                    flag2 = true;
                }
                enemyAtStructure = true;
                int num2 = 0;
                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());
            }
        }
Beispiel #5
0
        protected override void OnTriggerEnter(Collider other)
        {
            try
            {
                if (GameSetup.IsMpClient)
                {
                    if (entity == null && !EnemyManager.clientEnemies.ContainsKey(entity.networkId.PackedValue))
                    {
                        return;
                    }
                    else if (EnemyManager.clientEnemies[entity.networkId.PackedValue].Outdated)
                    {
                        LastReqTime = Time.time;
                        using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream())
                        {
                            using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream))
                            {
                                w.Write(29);
                                w.Write(entity.networkId.PackedValue);
                                w.Close();
                            }
                            ChampionsOfForest.Network.NetworkManager.SendLine(answerStream.ToArray(), ChampionsOfForest.Network.NetworkManager.Target.OnlyServer);
                            answerStream.Close();
                        }
                    }
                }

                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))
                        {
                            ModAPI.Console.Write("Starting to get hit");
                            if (((!creepy_male && !creepy && !creepy_baby && !creepy_fat) || ModdedPlayer.instance.ParryAnything) && events)
                            {
                                ModAPI.Console.Write("events exists");

                                if (componentInParent)
                                {
                                    ModAPI.Console.Write("componentInParent exists");

                                    bool flag = InFront(other.gameObject);
                                    ModAPI.Console.Write("in front: " + flag +
                                                         "\nevents.parryBool: " + events.parryBool +
                                                         "\nnext tagHash: " + (componentInParent.GetNextAnimatorStateInfo(1).tagHash == blockHash) +
                                                         "\ncurrent tagHash" + (componentInParent.GetCurrentAnimatorStateInfo(1).tagHash == blockHash) +
                                                         "\nfirst condition" + (!BoltNetwork.isServer || !netPrefab));
                                    if ((!BoltNetwork.isServer || !netPrefab) && flag && events.parryBool && ((componentInParent.GetNextAnimatorStateInfo(1).tagHash == blockHash || componentInParent.GetCurrentAnimatorStateInfo(1).tagHash == blockHash) || ModdedPlayer.instance.ParryAnything))
                                    {
                                        ModAPI.Console.Write("Parrying successful");
                                        int parryDir = events.parryDir;
                                        BoltSetReflectedShim.SetIntegerReflected(animator, "parryDirInt", parryDir);
                                        if (BoltNetwork.isClient && netPrefab)
                                        {
                                            BoltSetReflectedShim.SetTriggerReflected(animator, "ClientParryTrigger");
                                            hitPrediction.StartParryPrediction();
                                            parryEnemy parryEnemy = parryEnemy.Create(GlobalTargets.OnlyServer);
                                            parryEnemy.Target = transform.root.GetComponent <BoltEntity>();
                                            parryEnemy.Send();
                                            FMODCommon.PlayOneshot(parryEvent, base.transform);
                                        }
                                        else
                                        {
                                            BoltSetReflectedShim.SetTriggerReflected(animator, "parryTrigger");
                                        }
                                        SpellActions.DoParry(transform.position);
                                        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);
                            int num = 0;
                            if (maleSkinny || femaleSkinny)
                            {
                                if (pale)
                                {
                                    num = ((!skinned) ? Mathf.FloorToInt(10f * GameSettings.Ai.skinnyDamageRatio) : Mathf.FloorToInt(10f * GameSettings.Ai.skinnyDamageRatio * GameSettings.Ai.skinMaskDamageRatio));
                                }
                                else
                                {
                                    num = Mathf.FloorToInt(13f * GameSettings.Ai.skinnyDamageRatio);
                                    if (maleSkinny && props.regularStick.activeSelf && events.leftHandWeapon)
                                    {
                                        num = Mathf.FloorToInt(num * 1.35f);
                                    }
                                }
                            }
                            else if (male && pale)
                            {
                                num = ((!skinned) ? Mathf.FloorToInt(22f * GameSettings.Ai.largePaleDamageRatio) : Mathf.FloorToInt(22f * GameSettings.Ai.largePaleDamageRatio * GameSettings.Ai.skinMaskDamageRatio));
                            }
                            else if (male && !firemanMain)
                            {
                                num = ((!painted) ? Mathf.FloorToInt(20f * GameSettings.Ai.regularMaleDamageRatio) : Mathf.FloorToInt(20f * GameSettings.Ai.regularMaleDamageRatio * GameSettings.Ai.paintedDamageRatio));
                            }
                            else if (female)
                            {
                                num = Mathf.FloorToInt(17f * GameSettings.Ai.regularFemaleDamageRatio);
                            }
                            else if (creepy)
                            {
                                num = ((!pale) ? Mathf.FloorToInt(28f * GameSettings.Ai.creepyDamageRatio) : Mathf.FloorToInt(35f * GameSettings.Ai.creepyDamageRatio));
                            }
                            else if (creepy_male)
                            {
                                num = ((!pale) ? Mathf.FloorToInt(60f * GameSettings.Ai.creepyDamageRatio) : Mathf.FloorToInt(120f * GameSettings.Ai.creepyDamageRatio));
                            }
                            else if (creepy_baby)
                            {
                                num = Mathf.FloorToInt(26f * GameSettings.Ai.creepyBabyDamageRatio);
                            }
                            else if (firemanMain)
                            {
                                num = Mathf.FloorToInt(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.FloorToInt(num / 1.6f);
                            }

                            //My additional code
                            try
                            {
                                if (GameSetup.IsMpClient)
                                {
                                    if (other.transform.root == LocalPlayer.Transform.root)
                                    {
                                        var x = EnemyManager.clientEnemies[entity.networkId.PackedValue];
                                        num = Mathf.RoundToInt(num * x.damagemult);
                                        if (x.abilities.Contains(EnemyProgression.Abilities.RainEmpowerement))
                                        {
                                            if (TheForest.Utils.Scene.WeatherSystem.Raining)
                                            {
                                                num *= 5;
                                            }
                                        }
                                        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.instance.thornsDamage > 0)
                                        {
                                            DamageMath.DamageClamp(ModdedPlayer.instance.thornsDamage, out int dmg, out int reps);
                                            PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(GlobalTargets.OnlyServer);
                                            playerHitEnemy.Target = entity;
                                            playerHitEnemy.Hit    = dmg;
                                            AsyncHit.SendPlayerHitEnemy(playerHitEnemy, reps, 0.1f);
                                        }
                                    }
                                }
                                else
                                {
                                    if (other.transform.root == LocalPlayer.Transform.root)
                                    {
                                        if (EnemyProg == null)
                                        {
                                            EnemyProg = setup.health.gameObject.GetComponent <EnemyProgression>();
                                        }
                                        num = Mathf.RoundToInt(num * EnemyProg.DamageAmp * EnemyProg.DebuffDmgMult);
                                        BoltEntity bo = other.transform.root.GetComponent <BoltEntity>();
                                        if (bo == null)
                                        {
                                            bo = other.transform.root.GetComponentInChildren <BoltEntity>();
                                        }


                                        //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.instance.thornsDamage > 0)
                                        {
                                            Invoke("HitEnemeyDelayed", 0.1f);
                                        }
                                    }
                                }
                            }
                            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", 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", num, SendMessageOptions.DontRequireReceiver);
                                    }
                                }
                                else if (!BoltNetwork.isRunning && component2)
                                {
                                    component2.setCurrentAttacker(this);
                                    component2.hitFromEnemy(num);
                                }
                            }
                            else if (!netPrefab && component2)
                            {
                                component2.setCurrentAttacker(this);
                                component2.hitFromEnemy(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("Hit", 6, 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 = false;
                if (component4 == null)
                {
                    flag2 = true;
                }
                enemyAtStructure = true;
                int num2 = 0;
                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());
            }
        }