Skip to content

Commit

Permalink
Fix stamina modifier not being applied
Browse files Browse the repository at this point in the history
  • Loading branch information
healiha committed Dec 6, 2022
1 parent 3d9337a commit cf058f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 3 additions & 0 deletions ValheimPlus/GameClasses/Attack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ private static void Postfix(ref Attack __instance, ref float __result)
case Skills.SkillType.Pickaxes:
__result = Helper.applyModifierValue(__result, Configuration.Current.StaminaUsage.pickaxes);
break;
case Skills.SkillType.Bows:
__result = Helper.applyModifierValue(__result, Configuration.Current.StaminaUsage.bows);
break;
default:
break;
}
Expand Down
11 changes: 3 additions & 8 deletions ValheimPlus/GameClasses/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,7 @@ private static void Prefix(ref Player __instance, ref float v)
v = Helper.applyModifierValue(v, Configuration.Current.StaminaUsage.fishing);
}
}

if (methodName.Contains(nameof(Player.UpdatePlacement)) || methodName.Contains(nameof(Player.Repair)) || methodName.Contains(nameof(Player.RemovePiece)))
else if (methodName.Contains(nameof(Player.UpdatePlacement)) || methodName.Contains(nameof(Player.Repair)) || methodName.Contains(nameof(Player.RemovePiece)))
{
string itemName = __instance.GetRightItem()?.m_shared.m_name;
if (itemName == "$item_hammer")
Expand All @@ -398,13 +397,9 @@ private static void Prefix(ref Player __instance, ref float v)
v = Helper.applyModifierValue(v, Configuration.Current.StaminaUsage.cultivator);
}
}
else if (methodName.Equals(nameof(Player.PlayerAttackInput)))
else if (methodName.Equals(nameof(Player.UpdateAttackBowDraw)))
{
ItemDrop.ItemData item = __instance.GetCurrentWeapon();
if (item?.m_shared.m_skillType == Skills.SkillType.Bows)
{
v = Helper.applyModifierValue(v, Configuration.Current.StaminaUsage.bows);
}
v = Helper.applyModifierValue(v, Configuration.Current.StaminaUsage.bows);
}
else if (methodName.Equals(nameof(Player.BlockAttack)))
{
Expand Down

0 comments on commit cf058f9

Please sign in to comment.