XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

DeathMod

【Terraria】DeathMod (now aka Soul Harvest)

公开
关注 0 Fork 0 Star 0
UTF-8
using Terraria;
using Terraria.ID;

namespace SoulHarvest.Common;

internal static class ReaperTargeting
{
    internal static bool IsTrainingDummy(NPC npc)
        => npc.type == NPCID.TargetDummy;

    /// <summary>
    /// Weapon-created attacks are allowed to acquire and repeatedly strike the
    /// vanilla training dummy. Passive world/domain scans deliberately use their
    /// own stricter filter and must never call this helper for inclusion.
    /// </summary>
    internal static bool IsValidWeaponTarget(NPC npc)
    {
        if (!npc.active || npc.life <= 0 || npc.dontTakeDamage)
            return false;
        if (IsTrainingDummy(npc))
            return true;
        return !npc.friendly && !npc.immortal && npc.lifeMax > 5;
    }
}