using SlugBase.Features;
using static SlugBase.Features.FeatureTypes;
using SlugBase;

namespace JilloSlug.Features;

internal static class TweakDeathChanceFeature {
    public static readonly PlayerFeature<float> DeathChance = PlayerFloat("jillo/death_chance_mult");

    public static void AddHooks() {
        On.Player.DeathByBiteMultiplier += Player_DeathByBiteMultiplier;
    }

    private static float Player_DeathByBiteMultiplier(On.Player.orig_DeathByBiteMultiplier orig, Player self) {
        if (DeathChance.TryGet(self, out float mult)) {
            return mult;
        }
        return orig(self);
    }
}
