Ejemplo n.º 1
0
 public void OnHit_Melee(Transform hit)
 {
     SpellCaster.InfinityLoopEffect();
     if (stats.spell_furySwipes)
     {
         if (hit == FurySwipesLastHit)
         {
             FurySwipesDmg += 6;
             Stats.rangedFlatDmg.valueAdditive += 6;
             Stats.spellFlatDmg.valueAdditive  += 6;
             Stats.meleeFlatDmg.valueAdditive  += 6;
             BuffDB.AddBuff(27, 98, 6, 60);
         }
         else
         {
             FurySwipesLastHit = hit;
             Stats.rangedFlatDmg.valueAdditive -= FurySwipesDmg;
             Stats.spellFlatDmg.valueAdditive  -= FurySwipesDmg;
             Stats.meleeFlatDmg.valueAdditive  -= FurySwipesDmg;
             FurySwipesDmg = 0;
             if (BuffDB.activeBuffs.ContainsKey(98))
             {
                 BuffDB.activeBuffs[98].amount = 0;
             }
         }
     }
 }
Ejemplo n.º 2
0
        public static void CastBloodInfArr()
        {
            float takenHP = LocalPlayer.Stats.Health * BIA_HealthTakenMult;

            if (takenHP > LocalPlayer.Stats.Health - 5)
            {
                takenHP = LocalPlayer.Stats.Health - 5;
            }
            LocalPlayer.Stats.Health       -= takenHP;
            LocalPlayer.Stats.HealthTarget -= takenHP;
            BIA_bonusDamage = takenHP * BIA_HealthDmMult;
            if (ModdedPlayer.instance.SpellDamageBonus > ModdedPlayer.instance.RangedDamageBonus)
            {
                BIA_bonusDamage += BIA_SpellDmMult * ModdedPlayer.instance.SpellDamageBonus;
                BIA_bonusDamage *= ModdedPlayer.instance.SpellAMP;
            }
            else
            {
                BIA_bonusDamage += BIA_RangedDmMult * ModdedPlayer.instance.RangedDamageBonus;
                BIA_bonusDamage *= ModdedPlayer.instance.RangedAMP;
            }
            if (BIA_TripleDmg)
            {
                BIA_bonusDamage *= 3;
                BuffDB.AddBuff(18, 95, ModdedPlayer.instance.MaxEnergy / 150, 8);
            }
            if (ModdedPlayer.instance.IsHazardCrown)
            {
                ModdedPlayer.instance.HazardCrownBonus = 5;
            }
            Effects.Sound_Effects.GlobalSFX.Play(4);
        }
Ejemplo n.º 3
0
        public static void Bash(ulong enemy, float dmg)
        {
            if (BashEnabled)
            {
                int id = 44 + ModReferences.Players.IndexOf(LocalPlayer.GameObject);

                if (BashLifesteal > 0)
                {
                    LocalPlayer.Stats.HealthTarget += dmg * BashLifesteal;
                    LocalPlayer.Stats.Energy       += dmg * BashLifesteal;
                }

                if (BashDamageBuff > 0)
                {
                    BuffDB.AddBuff(24, 89, BashDamageBuff, 2);
                }
                using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream())
                {
                    using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream))
                    {
                        w.Write(33);
                        w.Write(enemy);
                        w.Write(BashDuration);
                        w.Write(id);
                        w.Write(BashSlowAmount);
                        w.Write(BashExtraDamage);
                        w.Write(((int)(dmg * BashBleedDmg)));
                        w.Write(BashBleedChance);
                        w.Close();
                    }
                    ChampionsOfForest.Network.NetworkManager.SendLine(answerStream.ToArray(), ChampionsOfForest.Network.NetworkManager.Target.OnlyServer);
                    answerStream.Close();
                }
            }
        }
Ejemplo n.º 4
0
        public static void CastCataclysm()
        {
            Vector3 pos = LocalPlayer.Transform.position;

            BuffDB.AddBuff(1, 66, 0.1f, 2.5f);
            float dmg = CataclysmDamage + ModdedPlayer.instance.SpellDamageBonus * 0.9f;

            dmg *= ModdedPlayer.instance.SpellAMP;
            using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream())
            {
                using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream))
                {
                    w.Write(3);
                    w.Write(11);
                    w.Write(pos.x);
                    w.Write(pos.y);
                    w.Write(pos.z);
                    w.Write(CataclysmRadius);
                    w.Write(dmg);
                    w.Write(CataclysmDuration);
                    w.Write(CataclysmArcane);
                    w.Write(false);
                    w.Close();
                }
                ChampionsOfForest.Network.NetworkManager.SendLine(answerStream.ToArray(), ChampionsOfForest.Network.NetworkManager.Target.Everyone);
                answerStream.Close();
            }
        }
Ejemplo n.º 5
0
        private static void BlinkTowards(Vector3 point)
        {
            Vector3 vel = LocalPlayer.Rigidbody.velocity;

            LocalPlayer.Transform.position = point + Vector3.up;
            vel.y /= 6;
            LocalPlayer.Rigidbody.velocity = vel * 1.5f;
            Effects.Sound_Effects.GlobalSFX.Play(Effects.Sound_Effects.GlobalSFX.SFX.Warp);
            BuffDB.AddBuff(4, 97, 1, 0.1f);
        }
Ejemplo n.º 6
0
 private void Update()
 {
     if ((LocalPlayer.Transform.position - transform.position).sqrMagnitude < radius * radius)
     {
         LocalPlayer.Stats.HealthTarget += healing * Time.deltaTime;
         LocalPlayer.Stats.Health       += healing * Time.deltaTime;
         if (GrantImmunity)
         {
             BuffDB.AddBuff(4, 40, 0, 0.1f);
         }
     }
 }
Ejemplo n.º 7
0
 public static float FocusOnBodyShot()
 {
     if (!Focus)
     {
         return(1);
     }
     if (FocusBonusDmg == 0)
     {
         FocusBonusDmg = FocusOnBS;
         BuffDB.AddBuff(14, 61, FocusOnAtkSpeed, FocusOnAtkSpeedDuration);
         return(1);
     }
     else
     {
         var result = 1f + FocusBonusDmg;
         FocusBonusDmg = 0;
         return(result);
     }
 }
Ejemplo n.º 8
0
 public static void OnFrenzyAttack()
 {
     if (Frenzy)
     {
         if (BuffDB.activeBuffs.ContainsKey(60))
         {
             int frenzyStacks = FrenzyStacks;
             BuffDB.activeBuffs[60].OnEnd(FrenzyStacks);
             FrenzyStacks = Mathf.Min(FrenzyMaxStacks, frenzyStacks + 1);
             BuffDB.activeBuffs[60].amount   = FrenzyStacks;
             BuffDB.activeBuffs[60].duration = 4;
             BuffDB.activeBuffs[60].OnStart(FrenzyStacks);
         }
         else
         {
             FrenzyStacks++;
             FrenzyStacks = Mathf.Min(FrenzyMaxStacks, FrenzyStacks);
             BuffDB.AddBuff(19, 60, FrenzyStacks, 4);
         }
     }
 }
Ejemplo n.º 9
0
 public static void Bash(EnemyProgression ep, float dmg)
 {
     if (BashEnabled)
     {
         int id = 43;
         ep.Slow(id, BashSlowAmount, BashDuration);
         ep.DmgTakenDebuff(id, BashExtraDamage, BashDuration);
         if (BashBleedChance > 0 && UnityEngine.Random.value < BashBleedChance)
         {
             ep.DoDoT((int)(dmg * BashBleedDmg), BashDuration);
         }
         if (BashLifesteal > 0)
         {
             LocalPlayer.Stats.HealthTarget += dmg * BashLifesteal;
             LocalPlayer.Stats.Energy       += dmg * BashLifesteal;
         }
         if (BashDamageBuff > 0)
         {
             BuffDB.AddBuff(24, 89, BashDamageBuff, 2);
         }
     }
 }
Ejemplo n.º 10
0
        private void Update()
        {
            if (ModAPI.Input.GetButtonDown("EquipWeapon"))
            {
                if (Inventory.Instance.ItemSlots[-12] != null && Inventory.Instance.ItemSlots[-12].Equipped)
                {
                    PlayerInventoryMod.ToEquipWeaponType = Inventory.Instance.ItemSlots[-12].weaponModel;
                    switch (Inventory.Instance.ItemSlots[-12].weaponModel)
                    {
                    case BaseItem.WeaponModelType.Polearm:
                        LocalPlayer.Inventory.StashEquipedWeapon(false);
                        LocalPlayer.Inventory.Equip(56, false);
                        break;

                    case BaseItem.WeaponModelType.Greatbow:
                        LocalPlayer.Inventory.StashEquipedWeapon(false);
                        if (CustomBowBase.baseBow == null)
                        {
                            PlayerInventoryMod.ToEquipWeaponType = BaseItem.WeaponModelType.None;
                            LocalPlayer.Inventory.Equip(79, false);
                        }
                        else if (LocalPlayer.Inventory.Equip(79, false))
                        {
                            CustomBowBase.baseBow.SetActive(false);
                            if (GreatBow.instance != null)
                            {
                                GreatBow.instance.SetActive(true);
                            }
#if Debugging_Enabled
                            else
                            {
                                ModAPI.Console.Write("No Greatbow instance");
                            }
#endif
                        }
#if Debugging_Enabled
                        else
                        {
                            ModAPI.Log.Write("Trying to equip a greatbow but no crafted bow in inventory");
                        }
#endif
                        break;

                    default:
                        LocalPlayer.Inventory.StashEquipedWeapon(false);
                        LocalPlayer.Inventory.Equip(80, false);
                        break;
                    }

                    PlayerInventoryMod.ToEquipWeaponType = BaseItem.WeaponModelType.None;
                }
            }
            try
            {
                float dmgPerSecond = 0;
                int   poisonCount  = 0;
                lostArmor = 0;
                int[] keys = new List <int>(BuffDB.activeBuffs.Keys).ToArray();
                for (int i = 0; i < keys.Length; i++)
                {
                    Buff buff = BuffDB.activeBuffs[keys[i]];
                    if (stats.debuffImmunity > 0 && buff.isNegative && buff.DispellAmount <= 2)
                    {
                        BuffDB.activeBuffs[keys[i]].ForceEndBuff(keys[i]);
                        continue;
                    }
                    else if (stats.debuffResistance > 0 && buff.isNegative && buff.DispellAmount <= 1)
                    {
                        BuffDB.activeBuffs[keys[i]].ForceEndBuff(keys[i]);
                        continue;
                    }
                    else
                    {
                        BuffDB.activeBuffs[keys[i]].UpdateBuff(keys[i]);
                        if (buff._ID == 3)
                        {
                            poisonCount++;
                            dmgPerSecond += buff.amount;
                        }
                        else if (buff._ID == 21)
                        {
                            lostArmor -= buff.amount;
                        }
                    }
                }
                if (dmgPerSecond != 0)
                {
                    dmgPerSecond                   *= stats.magicDamageTaken;
                    dmgPerSecond                   *= Stats.allDamageTaken;
                    LocalPlayer.Stats.Health       -= dmgPerSecond * Time.deltaTime;
                    LocalPlayer.Stats.HealthTarget -= dmgPerSecond * Time.deltaTime * 2;

                    if (poisonCount > 1)
                    {
                        BuffDB.AddBuff(1, 33, 0.7f, 1);
                    }
                }
                if (LocalPlayer.Stats.Health <= 0 && !LocalPlayer.Stats.Dead)
                {
                    LocalPlayer.Stats.Hit(10, true, PlayerStats.DamageType.Drowning);
                }
            }
            catch (Exception e)
            {
                //ModAPI.Log.Write("Poisoning player error" + e.ToString());
            }

            if (LocalPlayer.Stats != null)
            {
                if (Stats.perk_danceOfFiregod && Effects.BlackFlame.IsOn)
                {
                    LocalPlayer.Animator.speed = 1.0f;
                    return;
                }
                float ats = stats.attackSpeed;
                if (GreatBow.isEnabled)
                {
                    ats /= 2f;
                }

                if (LocalPlayer.Stats.Stamina > 4)
                {
                    LocalPlayer.Animator.speed = ats;
                }
                else
                {
                    LocalPlayer.Animator.speed = Mathf.Min(0.5f, ats / 2);
                }

                if (LocalPlayer.Stats.Health < stats.TotalMaxHealth)
                {
                    if (LocalPlayer.Stats.Health < LocalPlayer.Stats.HealthTarget)
                    {
                        LocalPlayer.Stats.Health += stats.healthRecoveryPerSecond * (stats.healthPerSecRate) * stats.allRecoveryMult;
                    }
                    else
                    {
                        LocalPlayer.Stats.Health += stats.healthRecoveryPerSecond * (stats.healthPerSecRate) * stats.allRecoveryMult / 10;
                    }
                }

                if (Clock.Day > LastDayOfGeneration)
                {
                    for (int i = 0; i < Clock.Day - LastDayOfGeneration; i++)
                    {
                        foreach (KeyValuePair <int, int> pair in GeneratedResources)
                        {
                            LocalPlayer.Inventory.AddItem(pair.Key, pair.Value);
                        }
                    }
                    LastDayOfGeneration = Clock.Day;
                }
            }

            if (TimeUntillMassacreReset > 0)
            {
                TimeUntillMassacreReset -= Time.unscaledDeltaTime;
                if (TimeUntillMassacreReset <= 0)
                {
                    AddFinalExperience(Convert.ToInt64((double)NewlyGainedExp * MassacreMultipier));
                    NewlyGainedExp          = 0;
                    TimeUntillMassacreReset = 0;
                    MassacreKills           = 0;
                    CountMassacre();
                }
            }

            if (Effects.Multishot.IsOn)
            {
                if (!SpellCaster.RemoveStamina(3 * Time.deltaTime) || LocalPlayer.Stats.Stamina < 7)
                {
                    Effects.Multishot.IsOn = false;
                    Effects.Multishot.localPlayerInstance.SetActive(false);
                }
            }
            Berserker.Effect();

            if (stats.rooted)
            {
                if (stats.stunImmunity > 0 || stats.rootImmunity > 0)
                {
                    stats.rooted.Reset();
                    if (!stats.stunned)
                    {
                        LocalPlayer.FpCharacter.MovementLocked = false;
                        LocalPlayer.FpCharacter.CanJump        = true;
                        LocalPlayer.Rigidbody.isKinematic      = false;
                        LocalPlayer.Rigidbody.useGravity       = true;
                        LocalPlayer.Rigidbody.WakeUp();
                    }
                }

                RootDuration -= Time.deltaTime;
                if (RootDuration < 0)
                {
                    Stats.rooted.Reset();
                    if (!Stats.stunned)
                    {
                        LocalPlayer.Rigidbody.isKinematic = false;
                        LocalPlayer.Rigidbody.useGravity  = true;
                        LocalPlayer.Rigidbody.WakeUp();
                        LocalPlayer.FpCharacter.MovementLocked = false;
                        LocalPlayer.FpCharacter.CanJump        = true;
                    }
                }
            }
            if (Stats.stunned)
            {
                if (stats.stunImmunity > 0)
                {
                    Stats.stunned.Reset();
                    LocalPlayer.FpCharacter.Locked = false;
                    if (!Stats.rooted)
                    {
                        LocalPlayer.FpCharacter.MovementLocked = false;
                        LocalPlayer.FpCharacter.CanJump        = true;
                        LocalPlayer.Rigidbody.isKinematic      = false;
                        LocalPlayer.Rigidbody.useGravity       = true;
                        LocalPlayer.Rigidbody.WakeUp();
                    }
                }
                StunDuration -= Time.deltaTime;
                if (StunDuration < 0)
                {
                    Stats.stunned.Reset();
                    LocalPlayer.FpCharacter.Locked = false;
                    if (!Stats.rooted)
                    {
                        LocalPlayer.FpCharacter.MovementLocked = false;
                        LocalPlayer.FpCharacter.CanJump        = true;
                        LocalPlayer.Rigidbody.isKinematic      = false;
                        LocalPlayer.Rigidbody.useGravity       = true;
                        LocalPlayer.Rigidbody.WakeUp();
                    }
                }
            }
            if (stats.i_HexedPantsOfMrM_Enabled)
            {
                if (LocalPlayer.FpCharacter.velocity.sqrMagnitude < 0.1)                //if standing still
                {
                    _HexedPantsOfMrM_StandTime = Mathf.Clamp(_HexedPantsOfMrM_StandTime - Time.deltaTime, -1.1f, 1.1f);
                    if (_HexedPantsOfMrM_StandTime <= 1)
                    {
                        if (LocalPlayer.Stats.Health > 5)
                        {
                            LocalPlayer.Stats.Health -= Time.deltaTime * stats.TotalMaxHealth * 0.015f;
                        }
                    }
                }
                else                 //if moving
                {
                    _HexedPantsOfMrM_StandTime = Mathf.Clamp(_HexedPantsOfMrM_StandTime + Time.deltaTime, -1.1f, 1.1f);
                    if (_HexedPantsOfMrM_StandTime >= 1)
                    {
                        AddBuff(9, 41, 1.4f, 1f);
                        AddBuff(11, 42, 1.4f, 1f);
                    }
                }
            }
            if (stats.i_DeathPact_Enabled)
            {
                Stats.allDamage.Divide(_DeathPact_Amount);

                _DeathPact_Amount = 1 + Mathf.RoundToInt((1 - (LocalPlayer.Stats.Health / Stats.TotalMaxHealth)) * 100) * 0.03f;
                AddBuff(12, 43, _DeathPact_Amount, 1f);

                Stats.allDamage.Multiply(_DeathPact_Amount);
            }
            else if (_DeathPact_Amount != 1)
            {
                Stats.allDamage.Divide(_DeathPact_Amount);
                _DeathPact_Amount = 1;
            }
            if (stats.i_isGreed)
            {
                _greedCooldown -= Time.deltaTime;
                if (_greedCooldown < 0)
                {
                    AutoPickupItems.DoPickup();
                    _greedCooldown = 1f;
                }
            }
            if (stats.perk_isShieldAutocast)
            {
                float mx = stats.TotalMaxEnergy * 0.90f;
                if (LocalPlayer.Stats.Energy >= mx)
                {
                    if (LocalPlayer.Stats.Stamina >= mx)
                    {
                        var spell = SpellDataBase.spellDictionary[5];
                        if (spell.IsEquipped)
                        {
                            if (SpellCaster.RemoveStamina(10 * Time.deltaTime))
                            {
                                spell.active();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        public override void HandleLanded()
        {
            TheForest.Utils.LocalPlayer.CamFollowHead.stopAllCameraShake();
            this.fallShakeBlock = false;
            base.StopCoroutine("startJumpTimer");
            this.jumpTimerStarted = false;
            float num  = 28f;
            bool  flag = false;

            if (ModdedPlayer.instance.BunnyHop)
            {
                if (ModdedPlayer.instance.BunnyHopUpgrade)
                {
                    BuffDB.AddBuff(5, 87, 1.5f, 0.75f * ModdedPlayer.instance.JumpPower);
                }
                else
                {
                    BuffDB.AddBuff(5, 87, 1.25f, 0.5f * ModdedPlayer.instance.JumpPower);
                }
            }
            if ((TheForest.Utils.LocalPlayer.AnimControl.doShellRideMode || TheForest.Utils.LocalPlayer.AnimControl.flyingGlider) && this.prevVelocityXZ.magnitude > 32f)
            {
                flag = true;
            }
            if (this.prevVelocity > num && !flag && this.allowFallDamage && this.jumpingTimer > 0.75f)
            {
                if (!this.jumpLand && !global::Clock.planecrash)
                {
                    this.jumpCoolDown = true;
                    this.jumpLand     = true;
                    float num2   = this.prevVelocity * 0.9f * (this.prevVelocity / 27.5f);
                    int   damage = (int)num2 + (int)(ModdedPlayer.instance.MaxHealth * 0.008f * num2);
                    float num3   = 3.8f;
                    if (TheForest.Utils.LocalPlayer.AnimControl.doShellRideMode)
                    {
                        num3 = 5f;
                    }
                    bool flag2 = false;
                    if (this.jumpingTimer > num3 && !TheForest.Utils.LocalPlayer.AnimControl.flyingGlider)
                    {
                        damage = (int)(1000f + ModdedPlayer.instance.MaxHealth);
                        flag2  = true;
                    }
                    if (TheForest.Utils.LocalPlayer.AnimControl.doShellRideMode && !flag2)
                    {
                        damage = 17 + (int)(ModdedPlayer.instance.MaxHealth * 0.13f);
                    }
                    if (TheForest.Utils.LocalPlayer.AnimControl.disconnectFromGlider)
                    {
                        damage = 12 + (int)(ModdedPlayer.instance.MaxHealth * 0.08f);
                        TheForest.Utils.LocalPlayer.SpecialActions.SendMessage("DropGlider", true);
                        this.enforceHighDrag = true;
                        base.Invoke("disableHighDrag", 0.65f);
                    }
                    this.Stats.Hit(damage, true, global::PlayerStats.DamageType.Physical);
                    TheForest.Utils.LocalPlayer.Animator.SetBoolReflected("jumpBool", false);
                    if (this.Stats.Health > 0f)
                    {
                        if (!TheForest.Utils.LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("doingJumpAttack").Value&& !TheForest.Utils.LocalPlayer.AnimControl.doShellRideMode)
                        {
                            TheForest.Utils.LocalPlayer.Animator.SetIntegerReflected("jumpType", 1);
                            TheForest.Utils.LocalPlayer.Animator.SetTrigger("landHeavyTrigger");
                            TheForest.Utils.LocalPlayer.Animator.SetBoolReflected("jumpBool", false);
                            this.CanJump = false;
                            TheForest.Utils.LocalPlayer.HitReactions.StartCoroutine("doHardfallRoutine");
                            this.prevMouseXSpeed = TheForest.Utils.LocalPlayer.MainRotator.rotationSpeed;
                            TheForest.Utils.LocalPlayer.MainRotator.rotationSpeed = 0.55f;
                            TheForest.Utils.LocalPlayer.Animator.SetLayerWeightReflected(4, 0f);
                            TheForest.Utils.LocalPlayer.Animator.SetLayerWeightReflected(0, 1f);
                            TheForest.Utils.LocalPlayer.Animator.SetLayerWeightReflected(1, 0f);
                            TheForest.Utils.LocalPlayer.Animator.SetLayerWeightReflected(2, 0f);
                            TheForest.Utils.LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                            base.Invoke("resetAnimSpine", 1f);
                        }
                        else
                        {
                            this.jumpLand     = false;
                            this.jumpCoolDown = false;
                        }
                    }
                    else
                    {
                        this.jumpCoolDown = false;
                        this.jumpLand     = false;
                    }
                }
                this.blockJumpAttack();
            }
            this.jumping = false;
            base.CancelInvoke("setAnimatorJump");
            if (!this.jumpCoolDown)
            {
                TheForest.Utils.LocalPlayer.Animator.SetIntegerReflected("jumpType", 0);
                TheForest.Utils.LocalPlayer.Animator.SetBoolReflected("jumpBool", false);
                TheForest.Utils.LocalPlayer.ScriptSetup.pmControl.SendEvent("toWait");
                this.blockJumpAttack();
            }
            base.CancelInvoke("fallDamageTimer");
            this.allowFallDamage = false;
        }
Ejemplo n.º 12
0
        public static void FillSpells()
        {
            Spell bh = new Spell(iD: 1, TextureID: 119, levelrequirement: 20, energyCost: 100, baseCooldown: 120, name: "Black Hole", () => $"Creates a black hole that pulls enemies in and damages over {ModdedPlayer.Stats.spell_blackhole_duration} seconds.\nScaling: {ModdedPlayer.Stats.spell_blackhole_damageScaling} spell damage")
            {
                active        = SpellActions.CreatePlayerBlackHole,
                CastOnRelease = true,
                aim           = SpellActions.BlackHoleAim,
                aimEnd        = SpellActions.BlackHoleAimEnd
            };
            Spell healingDome = new Spell(iD: 2, TextureID: 122, levelrequirement: 6, energyCost: 80, baseCooldown: 70, name: "Healing Dome", () => $"Creates a sphere of vaporized aloe that heals all allies inside.")
            {
                active        = SpellActions.CreateHealingDome,
                CastOnRelease = true,
                aim           = SpellActions.HealingDomeAim,
                aimEnd        = SpellActions.HealingDomeAimEnd
            };

            new Spell(iD: 3, TextureID: 121, levelrequirement: 3, energyCost: 25, baseCooldown: 14, name: "Blink", () => $"instantaneous short distance teleportation. Upgrades allow dealing damage to enemies that you pass through.\nScaling: {ModdedPlayer.Stats.spell_blinkDamageScaling}")
            {
                active        = SpellActions.DoBlink,
                CastOnRelease = true,
                aim           = SpellActions.DoBlinkAim,
            };
            new Spell(iD: 4, TextureID: 120, levelrequirement: 10, energyCost: 100, baseCooldown: 55, name: "Sun Flare", () => $"Intense light focuses onto a single spot. Heals allies, reduces all damage taken by 50% and gives movement speed. Slows down and damages enemies")
            {
                active = SpellActions.CastFlare,
            };
            new Spell(iD: 5, TextureID: 118, levelrequirement: 8, energyCost: 50, name: "Sustain Shield", () => $"Channeling this spell consumes energy but grants you a protective, absorbing shield, similiar to additional health. The shield's power increases every second untill reaching max value. The shield persists for {ModdedPlayer.Stats.spell_shieldPersistanceLifetime} seconds after channeling stops, and after that it rapidly disperses.")
            {
                active             = SpellActions.CastSustainShieldActive,
                passive            = SpellActions.CastSustainShielPassive,
                usePassiveOnUpdate = true,
            };
            new Spell(iD: 6, TextureID: 117, levelrequirement: 2, energyCost: 10, baseCooldown: 0.4f, name: "Wide Reach", () => "Picks up all items, including equipment, in a small radius around you.")
            {
                active        = AutoPickupItems.DoPickup,
                CastOnRelease = false,
            };
            new Spell(iD: 7, TextureID: 115, levelrequirement: 21, energyCost: 25, baseCooldown: 2.5f, name: "Black Flame", () => $"Ignites your melee weapon or your ranged projectile with a dark flame that burns enemies for a large amount of damage. Scaling: {ModdedPlayer.Stats.spell_blackFlameDamageScaling} spell damage")
            {
                active = BlackFlame.Toggle,
            };
            new Spell(iD: 8, TextureID: 123, levelrequirement: 14, energyCost: 85, baseCooldown: 180, name: "War Cry", () => "Empowers you and nearby allies for 2 minutes.")
            {
                active = SpellActions.CastWarCry,
            };
            new Spell(iD: 9, TextureID: 114, levelrequirement: 12, energyCost: 90, baseCooldown: 60, name: "Portal", () => "Creates a wormhole, that links 2 locations. Allows the player and items to pass through.")
            {
                CastOnRelease = true,
                aim           = SpellActions.DoPortalAim,
                active        = SpellActions.CastPortal,
            };
            new Spell(iD: 10, TextureID: 125, levelrequirement: 27, energyCost: 100, baseCooldown: 20, name: "Magic Arrow", () => $"A large spectral arrow is shot where you're looking at. The arrow pierces everything, slows any enemies hit and deals big damage. Scaling: {ModdedPlayer.Stats.spell_magicArrowDamageScaling} spell damage")
            {
                active        = SpellActions.CastMagicArrow,
                CastOnRelease = true,
                aim           = SpellActions.MagicArrowAim,
                aimEnd        = SpellActions.MagicArrowAimEnd
            };
            new Spell(iD: 11, TextureID: 127, levelrequirement: 40, energyCost: 30, baseCooldown: 12, name: "Multishot Enchantment", () => "Enchants your ranged weapons with a magic formation of copying. Every shot causes multipe projectiles to be created with a downside of heavy energy toll. Energy is consumed upon firing and depends on the amount of projectiles fired")
            {
                active = SpellActions.ToggleMultishot,
            };
            new Spell(iD: 12, TextureID: 133, levelrequirement: 35, energyCost: 65, baseCooldown: 160, name: "Golden Skin", () => "For 40 seconds you turn into solid gold, turning completely immune to stuns and your attacks are 20% faster")
            {
                active = GoldenSkin.Cast,
            };
            new Spell(iD: 13, TextureID: 132, levelrequirement: 7, energyCost: 40, baseCooldown: 16, name: "Purge", () => "Everyone in your surroudings gets cleansed of their negative debuffs. Negates poison.")
            {
                active = SpellActions.CastPurge,
            };
            new Spell(iD: 14, TextureID: 128, levelrequirement: 20, energyCost: 220, baseCooldown: 40, name: "Snap Freeze", () => $"Enemies around you get slowed for 12 seconds by 90% you deal magic damage to them.\nScaling{ModdedPlayer.Stats.spell_snapDamageScaling} spell damage")
            {
                active        = SpellActions.CastSnapFreeze,
                CastOnRelease = true,
                aim           = SpellActions.SnapFreezeAim,
                aimEnd        = SpellActions.SnapFreezeAimEnd
            };
            new Spell(iD: 15, TextureID: 131, levelrequirement: 25, energyCost: 10, baseCooldown: 200, name: "Berserk", () => "For short amount of time, gain increased damage dealt, attack speed and movement speed and have unlimited stamina, hovewer, you take increased damage.")
            {
                active = Berserker.Cast,
            };
            new Spell(iD: 16, TextureID: 130, levelrequirement: 44, energyCost: 350, baseCooldown: 100, name: "Ball Lightning", () => $"A slow moving, bouncing ball of lightning travels forward, dealing damage to hit enemies, and upon contact or when it lasts too long, it explodes. Scales with 320% spell damage.\nScaling: {ModdedPlayer.Stats.spell_ballLightning_DamageScaling} spell damage")
            {
                active = SpellActions.CastBallLightning,
            };
            new Spell(iD: 17, TextureID: 134, levelrequirement: 17, energyCost: 25, baseCooldown: 25, name: "Bash",
                      () => $"Passive: Every attack slows enemies for {ModdedPlayer.Stats.spell_bashDuration} seconds, and increases their damage taken by {ModdedPlayer.Stats.spell_bashExtraDamage}\nActive: Melee damage is increased for {ModdedPlayer.Stats.spell_bashDuration} seconds by {(ModdedPlayer.Stats.spell_bashExtraDamage-1):P}")
            {
                passive = SpellActions.BashPassiveEnabled,
                active  = SpellActions.BashActive
            };
            new Spell(18, 136, 1, 0, 60, "Frenzy", () => $"Passive: Every attack enrages you, increasing damage all damage by {ModdedPlayer.Stats.spell_frenzyDmg}. Up to {ModdedPlayer.Stats.spell_frenzyMaxStacks} stacks.\nActive: Consume all of your frenzy stacks and regenerate 5% of your max energy for every stack consumed.")
            {
                passive = x => ModdedPlayer.Stats.spell_frenzy.value = x,
                active  = () =>
                {
                    float f = ModdedPlayer.Stats.spell_frenzyStacks.valueAdditive;
                    LocalPlayer.Stats.Energy += ModdedPlayer.Stats.TotalMaxEnergy * f * 0.05f;
                    ModdedPlayer.Stats.attackSpeed.valueMultiplicative /= 1 + f * ModdedPlayer.Stats.spell_frenzyAtkSpeed;
                    ModdedPlayer.Stats.allDamage.valueMultiplicative   /= 1 + f * ModdedPlayer.Stats.spell_frenzyDmg;
                    if (ModdedPlayer.Stats.spell_frenzyMS)
                    {
                        ModdedPlayer.Stats.movementSpeed.valueMultiplicative /= 1 + f * 0.05f;
                    }

                    ModdedPlayer.Stats.spell_frenzyStacks.valueAdditive = 0;
                }
            };
            new Spell(19, 135, 27, 40, 10, "Seeking Arrow", () => "Casting spell empowers arrow, causing all arrows to head in the same direction for 10 seconds. While active, arrows deal more damage, the further target they hit, headshots deal double damage and bodyshots slow enemies by 20% for 4 seconds.")
            {
                active = SpellActions.SeekingArrow_Active,
            };
            new Spell(20, 137, 4, 50, 30, "Focus", () => "Passive: When landing a headshot, next projectile will deal 100% more damage and slow the enemy by 20%. When landing a body shot, next projectile will deal only 20% more damage, but attack speed is increased.\nActive: Gain 15% critical hit chance for 5 seconds")
            {
                passive = x => ModdedPlayer.Stats.spell_focus.value = x,
                active  = () => BuffDB.AddBuff(28, 102, 1.15f, 5f)
            };
            new Spell(21, 140, 8, 35, 60, "Parry", () => "Passive: When parrying an enemy, deal magic damage to enemies around the target. Additionally, gain energy, heal yourself for a small amount and get stun immunity for 10 seconds after parrying.\nActive: Gain 50% damage reduction for 10 seconds")
            {
                passive = x => ModdedPlayer.Stats.spell_parry.value = x,
                active  = () => BuffDB.AddBuff(26, 103, 0.5f, 10f)
            };
            new Spell(22, 141, 50, 500, 300, "Cataclysm", () => $"Creates a fire tornado that ignites enemies, slows them and deals damage. \nScaling{ModdedPlayer.Stats.spell_cataclysmDamageScaling} spell damage")
            {
                active        = () => SpellActions.CastCataclysm(),
                CastOnRelease = true,
                aim           = SpellActions.CataclysmAim,
                aimEnd        = SpellActions.CataclysmAimEnd
            };
            new Spell(23, 165, 11, 75, 8, "Blood Infused Arrow", () => "Sacrifice your own vitals to empower your next arrow. Drains your health and adds lost health as damage to the next projectile.")
            {
                active = () => SpellActions.CastBloodInfArr(),
            };
            new Spell(24, 182, 55, 400, 360, "Roaring Cheeks", () => "Release a powerful gust of toxic gas that poisons and knocks enemies back, or cast it mid air to perform a secondary jump, the damage and area of effect will be lower but 2/3 of the cooldown will be refunded")
            {
                active = () => SpellActions.RipAFatOne(),
            };
            new Spell(25, 189, 9, 40, 45, "Taunt", () => "Makes enemies hyper agressive and forces them to attack you. Taunted enemies move twice attack twice as fast and take 50% increased damage")
            {
                active        = Taunt.OnSpellUsed,
                CastOnRelease = true,
                aim           = Taunt.Aim,
                aimEnd        = Taunt.AimEnd
            };
            //new Spell(24, 165, 1, 1, 2, "Corpse Explosion", "")
            //{
            //    active = () => SpellActions.CastCorpseExplosion(),
            //};
            //new Spell(25, 165, 1, 1, "Devour", "...")
            //{
            //    active = () =>
            //};
        }
Ejemplo n.º 13
0
 public static void CleaveActive()
 {
     BuffDB.AddBuff(3, 111112, 1 * ModdedPlayer.instance.SpellAMP, 3 * ModdedPlayer.instance.SpellAMP);
 }
Ejemplo n.º 14
0
        public static void DoParry(Vector3 parryPos)
        {
            if (Parry)
            {
                BuffDB.AddBuff(6, 61, 1, ParryBuffDuration);
                float dmg = ParryDamage + ModdedPlayer.instance.SpellDamageBonus + ModdedPlayer.instance.MeleeDamageBonus;
                dmg *= ModdedPlayer.instance.SpellDamageAmplifier * 1.2f;

                float heal = ParryHeal + ModdedPlayer.instance.SpellDamageBonus / 6 + ModdedPlayer.instance.LifeRegen + ModdedPlayer.instance.LifeOnHit * 2;
                heal *= ModdedPlayer.instance.HealingMultipier * (1 + ModdedPlayer.instance.HealthRegenPercent);
                LocalPlayer.Stats.HealthTarget += heal;
                ParrySound.Play(parryPos);
                float energy = ParryEnergy * ModdedPlayer.instance.StaminaAndEnergyRegenAmp + ModdedPlayer.instance.EnergyOnHit * 2 + ModdedPlayer.instance.MaxEnergy / 12.5f;
                LocalPlayer.Stats.Energy  += energy;
                LocalPlayer.Stats.Stamina += energy;
                if (ParryDmgBonus > 0)
                {
                    float f = dmg * ParryDmgBonus;
                    ModdedPlayer.instance.ParryCounterStrikeDamage += f;
                    BuffDB.AddBuff(23, 88, f, 20);
                }

                if (GameSetup.IsMpClient)
                {
                    if (BoltNetwork.isRunning)
                    {
                        using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream())
                        {
                            using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream))
                            {
                                w.Write(3);
                                w.Write(13);
                                w.Write(parryPos.x);
                                w.Write(parryPos.y);
                                w.Write(parryPos.z);
                                w.Write(ParryRadius);
                                w.Write(ParryIgnites);
                                w.Write(dmg);
                                w.Close();
                            }
                            ChampionsOfForest.Network.NetworkManager.SendLine(answerStream.ToArray(), ChampionsOfForest.Network.NetworkManager.Target.OnlyServer);
                            answerStream.Close();
                        }
                    }
                }
                else
                {
                    DamageMath.DamageClamp(dmg, out int d, out int r);
                    var hits = Physics.SphereCastAll(parryPos, ParryRadius, Vector3.one);
                    for (int i = 0; i < hits.Length; i++)
                    {
                        if (hits[i].transform.CompareTag("enemyCollide"))
                        {
                            for (int a = 0; a < r; a++)
                            {
                                hits[i].transform.SendMessageUpwards("Hit", d, SendMessageOptions.DontRequireReceiver);
                                if (ParryIgnites)
                                {
                                    hits[i].transform.SendMessageUpwards("Burn", SendMessageOptions.DontRequireReceiver);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 15
0
        public override void CheckHit(Vector3 position, Transform target, bool isTrigger, Collider targetCollider)
        {
            if (ignoreCollisionEvents(targetCollider) && !target.CompareTag("enemyRoot"))
            {
                return;
            }
            if (!isTrigger)
            {
                Molotov componentInParent = transform.GetComponentInParent <Molotov>();
                if ((bool)componentInParent)
                {
                    componentInParent.IncendiaryBreak();
                    return;
                }
            }
            bool headDamage = false;

            if (target.gameObject.layer == LayerMask.NameToLayer("Water"))
            {
                FMODCommon.PlayOneshotNetworked(hitWaterEvent, base.transform, FMODCommon.NetworkRole.Any);
                return;
            }
            else if (target.CompareTag("SmallTree"))
            {
                FMODCommon.PlayOneshotNetworked(hitBushEvent, base.transform, FMODCommon.NetworkRole.Any);
                return;
            }
            else if (target.CompareTag("PlaneHull"))
            {
                FMODCommon.PlayOneshotNetworked(hitMetalEvent, base.transform, FMODCommon.NetworkRole.Any);
                return;
            }
            else if (target.CompareTag("Tree") || target.root.CompareTag("Tree") || target.CompareTag("Target"))
            {
                if (spearType)
                {
                    base.StartCoroutine(HitTree(hit.point - base.transform.forward * 2.1f));
                }
                else if (hitPointUpdated)
                {
                    base.StartCoroutine(HitTree(hit.point - base.transform.forward * 0.35f));
                }
                else
                {
                    base.StartCoroutine(HitTree(base.transform.position - base.transform.forward * 0.35f));
                }
                disableLive();
                if (target.CompareTag("Tree") || target.root.CompareTag("Tree"))
                {
                    TreeHealth component = target.GetComponent <TreeHealth>();
                    if (!(bool)component)
                    {
                        component = target.root.GetComponent <TreeHealth>();
                    }
                    if ((bool)component)
                    {
                        component.LodTree.AddTreeCutDownTarget(base.gameObject);
                    }
                }
                return;
            }
            else if (target.CompareTag("enemyCollide") || target.tag == "lb_bird" || target.CompareTag("animalCollide") || target.CompareTag("Fish") || target.CompareTag("enemyRoot") || target.CompareTag("animalRoot"))
            {
                if (lastPierced != null)
                {
                    if (target.root == lastPierced)
                    {
                        Physics.IgnoreCollision(base.GetComponent <Collider>(), targetCollider);
                        return;
                    }
                }
                bool  pierce       = false;
                float pierceChance = ModdedPlayer.Stats.projectilePierceChance - pierceCount;
                if (pierceChance > 0)
                {
                    if (pierceChance >= 1 || pierceChance < Random.value)
                    {
                        Physics.IgnoreCollision(base.GetComponent <Collider>(), targetCollider);
                        pierceCount++;
                        lastPierced = target.root;
                        Invoke("ForgetLastPierced", 0.125f);
                        pierce = true;
                    }
                }
                if (crossbowBoltType)
                {
                }
                else if (flintLockAmmoType)
                {
                }
                else if (spearType)
                {
                }
                else
                {
                    if (ModdedPlayer.Stats.i_CrossfireQuiver.value)
                    {
                        if (Time.time - ModdedPlayer.instance._lastCrossfireTime > 10 * ModdedPlayer.Stats.cooldown)
                        {
                            ModdedPlayer.instance._lastCrossfireTime = Time.time;
                            Vector3 pos = Camera.main.transform.position + Camera.main.transform.right * 5;
                            Vector3 dir = transform.position - pos;
                            dir.Normalize();
                            SpellActions.CastMagicArrow(pos, dir);
                        }
                    }
                }

                arrowStickToTarget arrowStickToTarget = target.GetComponent <arrowStickToTarget>();
                if (!(bool)arrowStickToTarget)
                {
                    arrowStickToTarget = target.root.GetComponentInChildren <arrowStickToTarget>();
                }

                bool isbird   = target.tag == "lb_bird" || target.CompareTag("lb_bird");
                bool isfish   = target.CompareTag("Fish");
                bool isanimal = target.CompareTag("animalCollide") || target.CompareTag("animalRoot");
                if (!spearType && !flintLockAmmoType && !isfish)
                {
                    if (arrowStickToTarget && arrowStickToTarget.enabled)
                    {
                        if (isbird)
                        {
                            EventRegistry.Achievements.Publish(TfEvent.Achievements.BirdArrowKill, null);
                        }
                        arrowStickToTarget.CreatureType(isanimal, isbird, isfish);
                        if (SpellActions.SeekingArrow_ChangeTargetOnHit)
                        {
                            startposition = transform.position;
                        }

                        if (BoltNetwork.isRunning)
                        {
                            if (at && at._boltEntity && at._boltEntity.isAttached && at._boltEntity.isOwner)
                            {
                                if (pierce)
                                {
                                    headDamage = ((XArrowStickToTargetMod)arrowStickToTarget).checkHeadDamage(transform);
                                }
                                else
                                {
                                    headDamage = arrowStickToTarget.stickArrowToNearestBone(base.transform);
                                }
                            }
                        }
                        else
                        {
                            if (pierce)
                            {
                                headDamage = ((XArrowStickToTargetMod)arrowStickToTarget).checkHeadDamage(transform);
                            }
                            headDamage = arrowStickToTarget.stickArrowToNearestBone(base.transform);
                        }
                    }
                    if ((bool)arrowStickToTarget && !pierce)
                    {
                        Destroy(parent.gameObject);
                    }
                }
                else
                {
                    if (SpellActions.SeekingArrow_ChangeTargetOnHit)
                    {
                        ModdedPlayer.Stats.spell_seekingArrow.value = true;
                        SpellActions.SeekingArrow_Target.gameObject.SetActive(true);
                        SpellActions.SeekingArrow_Target.parent   = target.transform;
                        SpellActions.SeekingArrow_Target.position = new Vector3(target.transform.position.x, transform.position.y - 0.075f, target.transform.position.z);
                        SpellActions.SeekingArrow_TimeStamp       = Time.time;
                        startposition = transform.position;
                        SpellActions.SeekingArrow_ChangeTargetOnHit = false;
                    }
                }
                if (headDamage && !flintLockAmmoType && ModdedPlayer.Stats.perk_trueAim && ModdedPlayer.Stats.spell_seekingArrow)
                {
                    //True aim ability
                    float dist = (startposition - transform.position).sqrMagnitude;
                    if (dist >= 3600f)
                    {
                        OutputDmg *= 4;
                        NewHitAi(target, isbird || isanimal, headDamage);
                        ModdedPlayer.instance.DoAreaDamage(target.root, OutputDmg);
                        ModdedPlayer.instance.OnHit();
                        ModdedPlayer.instance.OnHit_Ranged(target);
                        BuffDB.AddBuff(28, 104, 1.20f, 5);                              //crit chance
                        if (ModdedPlayer.Stats.perk_trueAimUpgrade && dist >= 14400f)
                        {
                            OutputDmg *= 10;

                            NewHitAi(target, isbird || isanimal, headDamage);
                            NewHitAi(target, isbird || isanimal, headDamage);
                            ModdedPlayer.instance.DoAreaDamage(target.root, OutputDmg);
                            ModdedPlayer.instance.OnHit();
                            ModdedPlayer.instance.OnHit_Ranged(target);
                            ModdedPlayer.instance.DoAreaDamage(target.root, OutputDmg);
                            ModdedPlayer.instance.OnHit();
                            ModdedPlayer.instance.OnHit_Ranged(target);
                        }
                    }
                }



                NewHitAi(target, isbird || isanimal, headDamage);
                ModdedPlayer.instance.DoAreaDamage(target.root, OutputDmg);
                ModdedPlayer.instance.OnHit();
                ModdedPlayer.instance.OnHit_Ranged(target);
                BoltEntity be = target.GetComponentInParent <BoltEntity>();
                if (be == null)
                {
                    be = target.GetComponent <BoltEntity>();
                }

                if (ModdedPlayer.Stats.perk_fireDmgIncreaseOnHit)
                {
                    int   myID = 1000 + ModReferences.Players.IndexOf(LocalPlayer.GameObject);
                    float dmg  = 1 + ModdedPlayer.Stats.spellFlatDmg / 3;
                    dmg *= ModdedPlayer.Stats.TotalMagicDamageMultiplier;
                    dmg *= ModdedPlayer.Stats.fireDamage + 1;
                    dmg *= 0.3f;
                    if (GameSetup.IsSinglePlayer || GameSetup.IsMpServer)
                    {
                        target.GetComponentInParent <EnemyProgression>()?.FireDebuff(myID, dmg, 14);
                    }
                    else
                    {
                        if (be != null)
                        {
                            using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream())
                            {
                                using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream))
                                {
                                    w.Write(27);
                                    w.Write(be.networkId.PackedValue);
                                    w.Write(dmg);
                                    w.Write(14.5f);
                                    w.Write(1);
                                    w.Close();
                                }
                                ChampionsOfForest.Network.NetworkManager.SendLine(answerStream.ToArray(), ChampionsOfForest.Network.NetworkManager.Target.OnlyServer);
                                answerStream.Close();
                            }
                        }
                    }
                }
                if (ModdedPlayer.Stats.TotalRangedArmorPiercing > 0 && target.gameObject.CompareTag("enemyCollide"))
                {
                    if (ModdedPlayer.Stats.perk_thrownSpearExtraArmorReduction && spearType)
                    {
                        if (BoltNetwork.isClient)
                        {
                            if (be != null)
                            {
                                EnemyProgression.ReduceArmor(be, ModdedPlayer.Stats.TotalRangedArmorPiercing * 2 + ModdedPlayer.Stats.TotalMeleeArmorPiercing);
                            }
                        }
                        else if (EnemyManager.enemyByTransform.ContainsKey(target.root))
                        {
                            var prog = EnemyManager.enemyByTransform[target.root];
                            prog.ReduceArmor(ModdedPlayer.Stats.TotalRangedArmorPiercing * 2 + ModdedPlayer.Stats.TotalMeleeArmorPiercing);
                        }
                    }
                    else
                    {
                        if (BoltNetwork.isClient)
                        {
                            if (be != null)
                            {
                                EnemyProgression.ReduceArmor(be, ModdedPlayer.Stats.TotalRangedArmorPiercing);
                            }
                        }
                        else if (EnemyManager.enemyByTransform.ContainsKey(target.root))
                        {
                            var prog = EnemyManager.enemyByTransform[target.root];
                            prog.ReduceArmor(ModdedPlayer.Stats.TotalRangedArmorPiercing);
                        }
                    }
                }
                if (isfish)
                {
                    base.StartCoroutine(HitFish(target, hit.point - base.transform.forward * 0.35f));
                }
                //check piercing

                if (pierce)
                {
                    return;
                }
                Live = false;
                disableLive();
                DisableFlight();
            }
            else if (target.CompareTag("PlayerNet"))
            {
                if (BoltNetwork.isRunning)
                {
                    BoltEntity be = target.GetComponentInParent <BoltEntity>();
                    if (!(bool)be)
                    {
                        be = target.GetComponent <BoltEntity>();
                    }

                    if (be)
                    {
                        if (ModdedPlayer.Stats.i_ArchangelBow && GreatBow.isEnabled)
                        {
                            float lifePerSecond = (ModdedPlayer.Stats.healthRecoveryPerSecond) * ModdedPlayer.Stats.allRecoveryMult * (ModdedPlayer.Stats.healthPerSecRate) * 2;
                            using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream())
                            {
                                using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream))
                                {
                                    w.Write(39);
                                    w.Write(be.GetState <IPlayerState>().name);
                                    w.Write(lifePerSecond);
                                    w.Write(ModdedPlayer.Stats.TotalMaxHealth * 0.2f);
                                    w.Close();
                                }
                                AsyncHit.SendCommandDelayed(1, answerStream.ToArray(), Network.NetworkManager.Target.OnlyServer);
                                answerStream.Close();
                            }
                            BuffDB.AddBuff(25, 91, lifePerSecond, 10);
                        }
                        else if (ModSettings.FriendlyFire)
                        {
                            float dmgUnclamped = this.OutputDmg;
                            if (ModdedPlayer.Stats.spell_seekingArrow)
                            {
                                float dist = Vector3.Distance(target.position, startposition);
                                dmgUnclamped *= 1 + dist * ModdedPlayer.Stats.spell_seekingArrow_DamagePerDistance;
                            }
                            if (spearType)
                            {
                                if (ModdedPlayer.Stats.perk_thrownSpearhellChance > 0 && Random.value <= ModdedPlayer.Stats.perk_thrownSpearhellChance && OutputDmg > 1)
                                {
                                    var obj = Instantiate(PhysicBody, Camera.main.transform.position + Vector3.up * 2f, Quaternion.LookRotation(PhysicBody.position - Camera.main.transform.position));
                                    obj.velocity = PhysicBody.velocity.normalized * 90f * ModdedPlayer.Stats.projectileSpeed;
                                    Destroy(obj.gameObject, 18);
                                }
                            }

                            if (headDamage || (flintLockAmmoType && Random.value <= ModdedPlayer.Stats.perk_bulletCritChance) || (spearType && Random.value <= ModdedPlayer.Stats.perk_thrownSpearhellChance))
                            {
                                headDamage    = true;
                                dmgUnclamped *= ModdedPlayer.Stats.headShotDamage;
                                dmgUnclamped *= SpellActions.FocusOnHeadShot();
                                if (ModdedPlayer.Stats.spell_seekingArrow)
                                {
                                    dmgUnclamped *= ModdedPlayer.Stats.spell_seekingArrow_HeadDamage;
                                }
                            }
                            else
                            {
                                dmgUnclamped *= SpellActions.FocusOnBodyShot();
                            }

                            DamageMath.ReduceDamageToSendOverNet(dmgUnclamped, out int sendDamage, out int reps);

                            HitPlayer HP = HitPlayer.Create(be, EntityTargets.Everyone);
                            HP.damage = sendDamage;
                            for (int i = 0; i < reps; i++)
                            {
                                HP.Send();
                            }
                            //check piercing
                            float pierceChance = ModdedPlayer.Stats.projectilePierceChance - pierceCount;
                            if (pierceChance > 0)
                            {
                                if (pierceChance >= 1 || pierceChance < Random.value)
                                {
                                    Physics.IgnoreCollision(base.GetComponent <Collider>(), targetCollider);
                                    pierceCount++;
                                    return;
                                }
                            }
                            disableLive();
                            DisableFlight();
                        }
                    }
                }
            }
            else if (target.CompareTag("TerrainMain") && !LocalPlayer.IsInCaves)
            {
                if (ignoreTerrain)
                {
                    ignoreTerrain = false;
                    base.StartCoroutine(RevokeIgnoreTerrain());
                }
                else
                {
                    if (spearType)
                    {
                        if ((bool)bodyCollider)
                        {
                            bodyCollider.isTrigger = true;
                        }
                        base.StartCoroutine(HitStructure(base.transform.position - base.transform.forward * 2.1f, false));
                    }
                    else
                    {
                        Vector3 position2 = base.transform.position - base.transform.forward * -0.8f;
                        float   num       = Terrain.activeTerrain.SampleHeight(base.transform.position);
                        Vector3 position3 = Terrain.activeTerrain.transform.position;
                        float   num2      = num + position3.y;
                        Vector3 position4 = base.transform.position;
                        if (position4.y < num2)
                        {
                            position2.y = num2 + 0.5f;
                        }
                        base.StartCoroutine(HitStructure(position2, false));
                    }
                    disableLive();
                    FMODCommon.PlayOneshotNetworked(hitGroundEvent, base.transform, FMODCommon.NetworkRole.Any);
                }
            }
            else if (target.CompareTag("structure") || target.CompareTag("jumpObject") || target.CompareTag("SLTier1") || target.CompareTag("SLTier2") || target.CompareTag("SLTier3") || target.CompareTag("UnderfootWood"))
            {
                if ((bool)target.transform.parent)
                {
                    if ((bool)target.transform.parent.GetComponent <StickFenceChunkArchitect>())
                    {
                        return;
                    }
                    if ((bool)target.transform.parent.GetComponent <BoneFenceChunkArchitect>())
                    {
                        return;
                    }
                }
                if (!isTrigger)
                {
                    if (spearType)
                    {
                        base.StartCoroutine(HitStructure(hit.point - base.transform.forward * 2.1f, true));
                    }
                    else
                    {
                        base.StartCoroutine(HitStructure(hit.point - base.transform.forward * 0.35f, true));
                    }
                    disableLive();
                }
            }
            else if (target.CompareTag("CaveDoor"))
            {
                ignoreTerrain = true;
                Physics.IgnoreCollision(base.GetComponent <Collider>(), Terrain.activeTerrain.GetComponent <Collider>(), true);
            }
            else if (flintLockAmmoType && (target.CompareTag("BreakableWood") || target.CompareTag("BreakableRock")))
            {
                target.SendMessage("Hit", 40, SendMessageOptions.DontRequireReceiver);
            }
            if (!Live)
            {
                destroyThisAmmo();
                parent.BroadcastMessage("OnArrowHit", SendMessageOptions.DontRequireReceiver);
            }
        }