public override float RecalculateAttackSpeed(float baseValue, CharacterBody character) { float BaseAttackSpeed = character.baseAttackSpeed + character.levelAttackSpeed * (character.level - 1); //Item efect float AttackSpeedBonus = 1f; if (character.inventory) { if (character.inventory.currentEquipmentIndex == EquipmentIndex.AffixYellow) { AttackSpeedBonus += 0.5f; } } //Buffs float AttackSpeedMult = AttackSpeedBonus + character.GetFieldValue <int[]>("buffs")[2] * 0.12f; if (character.HasBuff(BuffIndex.Warbanner)) { AttackSpeedMult += 0.3f; } if (character.HasBuff(BuffIndex.EnrageAncientWisp)) { AttackSpeedMult += 2f; } if (character.HasBuff(BuffIndex.WarCryBuff)) { AttackSpeedMult += 1f; } BaseAttackSpeed += ModItemManager.GetBonusForStat(character, StatIndex.AttackSpeed); AttackSpeedMult += ModItemManager.GetMultiplierForStat(character, StatIndex.AttackSpeed); float AttackSpeed = BaseAttackSpeed * AttackSpeedMult; //Debuff AttackSpeed *= 1 - (0.05f * character.GetBuffCount(BuffIndex.BeetleJuice)); return(AttackSpeed); }
public override float RecalculateShield(float baseValue, CharacterBody character) { float MaxShield = character.baseMaxShield + character.levelMaxShield * (character.level - 1); if (character.inventory) { if (character.inventory.GetItemCount(ItemIndex.ShieldOnly) > 0) { MaxShield += character.maxHealth * (1.25f + (character.inventory.GetItemCount(ItemIndex.ShieldOnly) - 1) * 0.5f); character.SetPropertyValue("maxHealth", 1); } } //Buff if (character.HasBuff(BuffIndex.EngiShield)) { MaxShield += character.maxHealth * 1f; } if (character.HasBuff(BuffIndex.EngiTeamShield)) { MaxShield += character.maxHealth * 0.5f; } //NPC Overload Buff if (character.GetFieldValue <BuffMask>("buffMask").HasBuff(BuffIndex.AffixBlue)) { character.SetPropertyValue("maxHealth", character.maxHealth * 0.5f); MaxShield += character.maxHealth; } if (character.inventory) { MaxShield += ModItemManager.GetBonusForStat(character, StatIndex.MaxShield); MaxShield *= (1 + ModItemManager.GetMultiplierForStat(character, StatIndex.MaxShield)); } return(MaxShield); }
public void Recalulate(On.RoR2.CharacterBody.orig_RecalculateStats orig, CharacterBody character) //Here we go again { character.SetPropertyValue("experience", (float)TeamManager.instance.GetTeamExperience(character.teamComponent.teamIndex)); character.SetPropertyValue("level", (float)TeamManager.instance.GetTeamLevel(character.teamComponent.teamIndex)); int InfusionCount = 0; int HealWhileSafeCount = 0; int PersonalShieldCount = 0; int HoofCount = 0; int RedWimpCount = 0; int FeatherCount = 0; int SyringeCount = 0; int GlassesCount = 0; int AttackSpeedCritCount = 0; int CoolDownCritCount = 0; int HealOnCritCount = 0; int BettleJuiceCount = 0; int ShieldOnlyCount = 0; int AlienHeadCount = 0; int KnurlCount = 0; int BoostHpCount = 0; int CritHealCount = 0; int SodaCount = 0; int newBonusStockFromBody = 0; int BucklerCount = 0; int UtilityMagazineCount = 0; int HealthDecayCount = 0; int DrizzlePlayerHelperCount = 0; float GlassCanonPower = 1f; EquipmentIndex equipmentIndex = EquipmentIndex.None; uint InfusionPower = 0; if ((bool)character.inventory) { character.SetPropertyValue("level", character.level + (float)character.inventory.GetItemCount(ItemIndex.LevelBonus)); InfusionCount = character.inventory.GetItemCount(ItemIndex.Infusion); HealWhileSafeCount = character.inventory.GetItemCount(ItemIndex.HealWhileSafe); PersonalShieldCount = character.inventory.GetItemCount(ItemIndex.PersonalShield); HoofCount = character.inventory.GetItemCount(ItemIndex.Hoof); RedWimpCount = character.inventory.GetItemCount(ItemIndex.SprintOutOfCombat); FeatherCount = character.inventory.GetItemCount(ItemIndex.Feather); SyringeCount = character.inventory.GetItemCount(ItemIndex.Syringe); GlassesCount = character.inventory.GetItemCount(ItemIndex.CritGlasses); AttackSpeedCritCount = character.inventory.GetItemCount(ItemIndex.AttackSpeedOnCrit); CoolDownCritCount = character.inventory.GetItemCount(ItemIndex.CooldownOnCrit); HealOnCritCount = character.inventory.GetItemCount(ItemIndex.HealOnCrit); BettleJuiceCount = character.GetBuffCount(BuffIndex.BeetleJuice); ShieldOnlyCount = character.inventory.GetItemCount(ItemIndex.ShieldOnly); AlienHeadCount = character.inventory.GetItemCount(ItemIndex.AlienHead); KnurlCount = character.inventory.GetItemCount(ItemIndex.Knurl); BoostHpCount = character.inventory.GetItemCount(ItemIndex.BoostHp); CritHealCount = character.inventory.GetItemCount(ItemIndex.CritHeal); SodaCount = character.inventory.GetItemCount(ItemIndex.SprintBonus); newBonusStockFromBody = character.inventory.GetItemCount(ItemIndex.SecondarySkillMagazine); BucklerCount = character.inventory.GetItemCount(ItemIndex.SprintArmor); UtilityMagazineCount = character.inventory.GetItemCount(ItemIndex.UtilitySkillMagazine); HealthDecayCount = character.inventory.GetItemCount(ItemIndex.HealthDecay); GlassCanonPower = character.CalcLunarDaggerPower(); equipmentIndex = character.inventory.currentEquipmentIndex; InfusionPower = character.inventory.infusionBonus; DrizzlePlayerHelperCount = character.inventory.GetItemCount(ItemIndex.DrizzlePlayerHelper); } float Level = character.level - 1f; character.SetPropertyValue("isElite", character.GetFieldValue <BuffMask>("buffMask").containsEliteBuff); float preHealth = character.baseMaxHealth; float preShield = character.baseMaxShield; //Health float MaxHealth = character.baseMaxHealth; float additionalHealth = 0; if (character.inventory.GetItemCount(ItemIndex.Infusion) > 0) { additionalHealth += character.inventory.infusionBonus; } additionalHealth += character.inventory.GetItemCount(ItemIndex.Knurl) * 40; float hpbooster = 1 + character.inventory.GetItemCount(ItemIndex.BoostHp) * 0.1f; MaxHealth = Utils.exponentialFormula(MaxHealth, character.levelMaxHealth, HExpo, character.level, 0) * hpbooster / character.CalcLunarDaggerPower(); character.SetPropertyValue("maxHealth", MaxHealth); //regen float BaseRegen = (character.baseRegen + character.levelRegen * Level) * 2.5f; if (character.outOfDanger && HealWhileSafeCount > 0) { BaseRegen *= (float)(2.5 + (double)(HealWhileSafeCount - 1) * 1.5); } float LifeRegen = BaseRegen + (float)KnurlCount * 1.6f; if (HealthDecayCount > 0) { LifeRegen -= character.maxHealth / (float)HealthDecayCount; } character.SetPropertyValue("regen", LifeRegen); //Shield float MaxShield = character.baseMaxShield + character.levelMaxShield * (character.level - 1); if (character.inventory.GetItemCount(ItemIndex.ShieldOnly) > 0) { MaxShield += character.maxHealth * (1.5f + (character.inventory.GetItemCount(ItemIndex.ShieldOnly) - 1) * 0.25f); character.SetPropertyValue("maxHealth", 1); } if (character.HasBuff(BuffIndex.EngiShield)) { MaxShield += character.maxHealth * 1f; } if (character.HasBuff(BuffIndex.EngiTeamShield)) { MaxShield += character.maxHealth * 0.5f; } MaxShield += character.inventory.GetItemCount(ItemIndex.PersonalShield) * (25 + ShieldBoost * (character.level - 1)); if (character.GetFieldValue <BuffMask>("buffMask").HasBuff(BuffIndex.AffixBlue)) { character.SetPropertyValue("maxHealth", character.maxHealth * 0.5f); MaxShield += character.maxHealth; } character.SetPropertyValue("maxShield", MaxShield); //moveSpeed float BaseMoveSpeed = character.baseMoveSpeed + character.levelMoveSpeed * Level; float RedWinpBOnus = 1f; if (Run.instance.enabledArtifacts.HasArtifact(ArtifactIndex.Spirit)) { float num33 = 1f; if ((bool)character.healthComponent) { num33 = character.healthComponent.combinedHealthFraction; } RedWinpBOnus += 1f - num33; } if (equipmentIndex == EquipmentIndex.AffixYellow) { BaseMoveSpeed += 2f; } if (character.isSprinting) { BaseMoveSpeed *= character.GetFieldValue <float>("sprintingSpeedMultiplier"); } if (character.outOfCombat && character.outOfDanger && RedWimpCount > 0) { RedWinpBOnus += (float)RedWimpCount * 0.3f; } float SpeedBonus = RedWinpBOnus + (float)HoofCount * 0.14f; if (character.isSprinting && SodaCount > 0) { SpeedBonus += (float)(0.100000001490116 + 0.200000002980232 * (double)SodaCount) / character.GetFieldValue <float>("sprintingSpeedMultiplier"); } if (character.HasBuff(BuffIndex.BugWings)) { SpeedBonus += 0.2f; } if (character.HasBuff(BuffIndex.Warbanner)) { SpeedBonus += 0.3f; } if (character.HasBuff(BuffIndex.EnrageAncientWisp)) { SpeedBonus += 0.4f; } if (character.HasBuff(BuffIndex.CloakSpeed)) { SpeedBonus += 0.4f; } if (character.HasBuff(BuffIndex.TempestSpeed)) { ++SpeedBonus; } if (character.HasBuff(BuffIndex.WarCryBuff)) { SpeedBonus += 0.5f; } if (character.HasBuff(BuffIndex.EngiTeamShield)) { SpeedBonus += 0.3f; } float SpeedMalus = 1f; if (character.HasBuff(BuffIndex.Slow50)) { SpeedMalus += 0.5f; } if (character.HasBuff(BuffIndex.Slow60)) { SpeedMalus += 0.6f; } if (character.HasBuff(BuffIndex.Slow80)) { SpeedMalus += 0.8f; } if (character.HasBuff(BuffIndex.ClayGoo)) { SpeedMalus += 0.5f; } if (character.HasBuff(BuffIndex.Slow30)) { SpeedMalus += 0.3f; } if (character.HasBuff(BuffIndex.Cripple)) { ++SpeedMalus; } float MoveSpeed = BaseMoveSpeed * (SpeedBonus / SpeedMalus); if (BettleJuiceCount > 0) { MoveSpeed *= (float)(1.0 - 0.0500000007450581 * (double)BettleJuiceCount); } character.SetPropertyValue("moveSpeed", MoveSpeed); //OtherMovement Bonus character.SetPropertyValue("acceleration", character.moveSpeed / character.baseMoveSpeed * character.baseAcceleration); character.SetPropertyValue("jumpPower", character.baseJumpPower + character.levelJumpPower * Level); character.SetPropertyValue("maxJumpHeight", Trajectory.CalculateApex(character.jumpPower)); character.SetPropertyValue("maxJumpCount", character.baseJumpCount + FeatherCount); //Damage float BaseDamage = character.baseDamage + character.levelDamage * Level; float DamageBoost = 1f; int DamageBoostCount = character.inventory ? character.inventory.GetItemCount(ItemIndex.BoostDamage) : 0; if (DamageBoostCount > 0) { DamageBoost += DamageBoostCount * 0.1f; } if (BettleJuiceCount > 0) { DamageBoost -= 0.05f * BettleJuiceCount; } if (character.HasBuff(BuffIndex.GoldEmpowered)) { ++DamageBoost; } float DamageMult = DamageBoost + (GlassCanonPower - 1f); character.SetPropertyValue("damage", BaseDamage * DamageMult); //Attack Speed float BaseAttackSpeed = character.baseAttackSpeed + character.levelAttackSpeed * Level; float AttackSpeedBonus = 1f + SyringeCount * 0.15f; if (equipmentIndex == EquipmentIndex.AffixYellow) { AttackSpeedBonus += 0.5f; } float AttackSpeedMult = AttackSpeedBonus + character.GetFieldValue <int[]>("buffs")[2] * 0.12f; if (character.HasBuff(BuffIndex.Warbanner)) { AttackSpeedMult += 0.3f; } if (character.HasBuff(BuffIndex.EnrageAncientWisp)) { AttackSpeedMult += 2f; } if (character.HasBuff(BuffIndex.WarCryBuff)) { ++AttackSpeedMult; } float AttackSpeed = BaseAttackSpeed * AttackSpeedMult; if (BettleJuiceCount > 0) { AttackSpeed *= (float)(1.0 - 0.05 * BettleJuiceCount); } character.SetPropertyValue("attackSpeed", AttackSpeed); //Crit float CriticalChance = character.baseCrit + character.levelCrit * Level + GlassesCount * 10f; if (AttackSpeedCritCount > 0) { CriticalChance += 5f; } if (CoolDownCritCount > 0) { CriticalChance += 5f; } if (HealOnCritCount > 0) { CriticalChance += 5f; } if (CritHealCount > 0) { CriticalChance += 5f; } if (character.HasBuff(BuffIndex.FullCrit)) { CriticalChance += 100f; } character.SetPropertyValue("crit", CriticalChance); //Armor character.SetPropertyValue("armor", value: (float)(character.baseArmor + character.levelArmor * (double)Level + (character.HasBuff(BuffIndex.ArmorBoost) ? 200.0 : 0.0))); character.SetPropertyValue("armor", character.armor + DrizzlePlayerHelperCount * 70f); if (character.HasBuff(BuffIndex.Cripple)) { character.SetPropertyValue("armor", character.armor - 20f); } if (character.isSprinting && BucklerCount > 0) { character.SetPropertyValue("armor", character.armor + BucklerCount * 30); } //CoolDown float CoolDownMultiplier = 1f; if (character.HasBuff(BuffIndex.GoldEmpowered)) { CoolDownMultiplier *= 0.25f; } for (int index = 0; index < AlienHeadCount; ++index) { CoolDownMultiplier *= 0.75f; } if (character.HasBuff(BuffIndex.NoCooldowns)) { CoolDownMultiplier = 0.0f; } if ((bool)character.GetFieldValue <SkillLocator>("skillLocator").primary) { character.GetFieldValue <SkillLocator>("skillLocator").primary.cooldownScale = CoolDownMultiplier; } if ((bool)character.GetFieldValue <SkillLocator>("skillLocator").secondary) { character.GetFieldValue <SkillLocator>("skillLocator").secondary.cooldownScale = CoolDownMultiplier; character.GetFieldValue <SkillLocator>("skillLocator").secondary.SetBonusStockFromBody(newBonusStockFromBody); } if ((bool)character.GetFieldValue <SkillLocator>("skillLocator").utility) { float num33 = CoolDownMultiplier; if (UtilityMagazineCount > 0) { num33 *= 0.6666667f; } character.GetFieldValue <SkillLocator>("skillLocator").utility.cooldownScale = num33; character.GetFieldValue <SkillLocator>("skillLocator").utility.SetBonusStockFromBody(UtilityMagazineCount * 2); } if ((bool)character.GetFieldValue <SkillLocator>("skillLocator").special) { character.GetFieldValue <SkillLocator>("skillLocator").special.cooldownScale = CoolDownMultiplier; } //CriticalHeal character.SetPropertyValue("critHeal", 0.0f); if (CritHealCount > 0) { float crit = character.crit; character.SetPropertyValue("crit", character.crit / (CritHealCount + 1)); character.SetPropertyValue("critHeal", crit - character.crit); } //UpdateHealth/Shield Value if (NetworkServer.active) { float HealthOffset = character.maxHealth - preHealth; float ShieldOffset = character.maxShield - preShield; if (HealthOffset > 0) { double num47 = character.healthComponent.Heal(HealthOffset, new ProcChainMask(), false); } else if (character.healthComponent.health > character.maxHealth) { character.healthComponent.Networkhealth = character.maxHealth; } if (ShieldOffset > 0) { character.healthComponent.RechargeShield(ShieldOffset); } } character.SetFieldValue("statsDirty", false); }
static public void ModdedRecalculate(On.RoR2.CharacterBody.orig_RecalculateStats orig, CharacterBody character) { if (character == null) { return; } //ModifyItem(character); //Will ahve to tinker if we leave the modder completly free to update item whenever they want or add a hook for that :shrug: character.SetPropertyValue("experience", (float)TeamManager.instance.GetTeamExperience(character.teamComponent.teamIndex)); float l = TeamManager.instance.GetTeamLevel(character.teamComponent.teamIndex); if (character.inventory) { l += character.inventory.GetItemCount(ItemIndex.LevelBonus); } character.SetPropertyValue("level", l); float Level = character.level - 1f; character.SetPropertyValue("isElite", character.GetFieldValue <BuffMask>("buffMask").containsEliteBuff); float preHealth = character.maxHealth; float preShield = character.maxShield; character.SetPropertyValue("maxHealth", StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateHealth), character)); character.SetPropertyValue("maxShield", StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateShield), character)); character.SetPropertyValue("regen", StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateRegen), character)); character.SetPropertyValue("moveSpeed", StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateMoveSpeed), character)); character.SetPropertyValue("acceleration", character.moveSpeed / character.baseMoveSpeed * character.baseAcceleration); character.SetPropertyValue("jumpPower", StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateJumpPower), character)); character.SetPropertyValue("maxJumpHeight", Trajectory.CalculateApex(character.jumpPower)); character.SetPropertyValue("maxJumpCount", (int)StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateJumpCount), character)); character.SetPropertyValue("damage", StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateDamage), character)); character.SetPropertyValue("attackSpeed", StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateAttackSpeed), character)); character.SetPropertyValue("crit", StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateCrit), character)); character.SetPropertyValue("armor", StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateArmor), character)); //CoolDown float CoolDownMultiplier = StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateGeneralCooldown), character); if ((bool)character.GetFieldValue <SkillLocator>("skillLocator").primary) { character.GetFieldValue <SkillLocator>("skillLocator").primary.cooldownScale = StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculatePrimaryCoolDown), character) * CoolDownMultiplier; if (character.GetFieldValue <SkillLocator>("skillLocator").primary.baseMaxStock > 1) { character.GetFieldValue <SkillLocator>("skillLocator").primary.SetBonusStockFromBody((int)StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculatePrimaryCount), character)); } } if ((bool)character.GetFieldValue <SkillLocator>("skillLocator").secondary) { character.GetFieldValue <SkillLocator>("skillLocator").secondary.cooldownScale = StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateSecondaryCooldown), character) * CoolDownMultiplier; character.GetFieldValue <SkillLocator>("skillLocator").secondary.SetBonusStockFromBody((int)StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateSecondaryCount), character)); } if ((bool)character.GetFieldValue <SkillLocator>("skillLocator").utility) { character.GetFieldValue <SkillLocator>("skillLocator").utility.cooldownScale = StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateUtilityCooldown), character) * CoolDownMultiplier; character.GetFieldValue <SkillLocator>("skillLocator").utility.SetBonusStockFromBody((int)StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateUtilityCount), character)); } if ((bool)character.GetFieldValue <SkillLocator>("skillLocator").special) { character.GetFieldValue <SkillLocator>("skillLocator").special.cooldownScale = StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateSpecialCooldown), character) * CoolDownMultiplier; if (character.GetFieldValue <SkillLocator>("skillLocator").special.baseMaxStock > 1) { character.GetFieldValue <SkillLocator>("skillLocator").special.SetBonusStockFromBody((int)StatHandler(GetMethodInfo(new DefaultRecalculate().RecalculateSpecialCount), character)); } } //Since it's not yet used in game, I leave that here for now character.SetPropertyValue("critHeal", 0.0f); if (character.inventory) { if (character.inventory.GetItemCount(ItemIndex.CritHeal) > 0) { float crit = character.crit; character.SetPropertyValue("crit", character.crit / (character.inventory.GetItemCount(ItemIndex.CritHeal) + 1)); character.SetPropertyValue("critHeal", crit - character.crit); } } //Health and Shield update if (NetworkServer.active) { float HealthOffset = character.maxHealth - preHealth; float ShieldOffset = character.maxShield - preShield; if (HealthOffset > 0) { double num47 = character.healthComponent.Heal(HealthOffset, new ProcChainMask(), false); } else if (character.healthComponent.health > character.maxHealth) { character.healthComponent.Networkhealth = character.maxHealth; } if (ShieldOffset > 0) { character.healthComponent.RechargeShield(ShieldOffset); } } character.SetFieldValue("statsDirty", false); }
public override float RecalculateMoveSpeed(float baseValue, CharacterBody character) { float BaseMoveSpeed = character.baseMoveSpeed + character.levelMoveSpeed * (character.level - 1); float SpeedBonus = 1; //More weird stuff if ((bool)character.inventory) { if (character.inventory.currentEquipmentIndex == EquipmentIndex.AffixYellow) { BaseMoveSpeed += 2; } } if (character.isSprinting) { BaseMoveSpeed *= character.GetFieldValue <float>("sprintingSpeedMultiplier"); } //SpeedBonus if (character.HasBuff(BuffIndex.BugWings)) { SpeedBonus += 0.2f; } if (character.HasBuff(BuffIndex.Warbanner)) { SpeedBonus += 0.3f; } if (character.HasBuff(BuffIndex.EnrageAncientWisp)) { SpeedBonus += 0.4f; } if (character.HasBuff(BuffIndex.CloakSpeed)) { SpeedBonus += 0.4f; } if (character.HasBuff(BuffIndex.TempestSpeed)) { SpeedBonus += 1; } if (character.HasBuff(BuffIndex.WarCryBuff)) { SpeedBonus += .5f; } if (character.HasBuff(BuffIndex.EngiTeamShield)) { SpeedBonus += 0.3f; } SpeedBonus += ModItemManager.GetMultiplierForStat(character, StatIndex.MoveSpeed); if (character.isSprinting) { SpeedBonus += ModItemManager.GetMultiplierForStat(character, StatIndex.RunningMoveSpeed); } if (character.outOfCombat && character.outOfDanger) { SpeedBonus += ModItemManager.GetMultiplierForStat(character, StatIndex.SafeMoveSpeed); if (character.isSprinting) { SpeedBonus += ModItemManager.GetMultiplierForStat(character, StatIndex.SafeRunningMoveSpeed); } } //Debuff Speed float SpeedMalus = 1f; if (character.HasBuff(BuffIndex.Slow50)) { SpeedMalus += 0.5f; } if (character.HasBuff(BuffIndex.Slow60)) { SpeedMalus += 0.6f; } if (character.HasBuff(BuffIndex.Slow80)) { SpeedMalus += 0.8f; } if (character.HasBuff(BuffIndex.ClayGoo)) { SpeedMalus += 0.5f; } if (character.HasBuff(BuffIndex.Slow30)) { SpeedMalus += 0.3f; } if (character.HasBuff(BuffIndex.Cripple)) { ++SpeedMalus; } BaseMoveSpeed += ModItemManager.GetBonusForStat(character, StatIndex.MoveSpeed); if (character.isSprinting) { BaseMoveSpeed += ModItemManager.GetBonusForStat(character, StatIndex.RunningMoveSpeed); } if (character.outOfCombat && character.outOfDanger) { BaseMoveSpeed += ModItemManager.GetBonusForStat(character, StatIndex.SafeMoveSpeed); if (character.isSprinting) { BaseMoveSpeed += ModItemManager.GetBonusForStat(character, StatIndex.SafeRunningMoveSpeed); } } float MoveSpeed = BaseMoveSpeed * (SpeedBonus / SpeedMalus); if ((bool)character.inventory) { MoveSpeed *= 1.0f - 0.05f * character.GetBuffCount(BuffIndex.BeetleJuice); } return(MoveSpeed); }