CanHitNPC() public static method

public static CanHitNPC ( Item item, Player player, Terraria.NPC target ) : bool?
item Item
player Terraria.Player
target Terraria.NPC
return bool?
Esempio n. 1
0
        public static bool?CanPlayerHitNPCWithItem(Player player, Item item, NPC npc)
        {
            bool?result = null;

            bool ModifyResult(bool?nbool)
            {
                if (nbool.HasValue)
                {
                    result = nbool.Value;
                }

                return(result != false);
            }

            if (!ModifyResult(PlayerHooks.CanHitNPC(player, item, npc)))
            {
                return(false);
            }

            if (!ModifyResult(ItemLoader.CanHitNPC(item, player, npc)))
            {
                return(false);
            }

            if (!ModifyResult(NPCLoader.CanBeHitByItem(npc, player, item)))
            {
                return(false);
            }

            return(result);
        }