示例#1
0
        public static bool OnStrikeNpc(NPC npc, ref int damage, ref float knockback, ref int hitdirection, ref bool crit, ref bool noEffect, ref double retdamage)
        {
            if (NpcHooks.StrikeNpc == null)
            {
                return(false);
            }
            NpcStrikeEventArgs npcStrikeEventArgs = new NpcStrikeEventArgs
            {
                Npc          = npc,
                Damage       = damage,
                KnockBack    = knockback,
                HitDirection = hitdirection,
                Critical     = crit,
                NoEffect     = noEffect,
                ReturnDamage = retdamage
            };

            NpcHooks.StrikeNpc(npcStrikeEventArgs);
            crit         = npcStrikeEventArgs.Critical;
            damage       = npcStrikeEventArgs.Damage;
            knockback    = npcStrikeEventArgs.KnockBack;
            hitdirection = npcStrikeEventArgs.HitDirection;
            noEffect     = npcStrikeEventArgs.NoEffect;
            retdamage    = npcStrikeEventArgs.ReturnDamage;
            return(npcStrikeEventArgs.Handled);
        }
示例#2
0
文件: TShock.cs 项目: InanZen/TShock
 private void NpcHooks_OnStrikeNpc(NpcStrikeEventArgs e)
 {
     if (Config.InfiniteInvasion)
     {
         IncrementKills();
         if (Main.invasionSize < 10)
         {
             Main.invasionSize = 20000000;
         }
     }
 }
示例#3
0
 public static bool OnStrikeNpc(NPC npc, ref int damage, ref float knockback, ref int hitdirection, ref bool crit, ref bool noEffect, ref double retdamage)
 {
     if (NpcHooks.StrikeNpc == null)
     {
         return false;
     }
     NpcStrikeEventArgs npcStrikeEventArgs = new NpcStrikeEventArgs
     {
         Npc = npc,
         Damage = damage,
         KnockBack = knockback,
         HitDirection = hitdirection,
         Critical = crit,
         NoEffect = noEffect,
         ReturnDamage = retdamage
     };
     NpcHooks.StrikeNpc(npcStrikeEventArgs);
     crit = npcStrikeEventArgs.Critical;
     damage = npcStrikeEventArgs.Damage;
     knockback = npcStrikeEventArgs.KnockBack;
     hitdirection = npcStrikeEventArgs.HitDirection;
     noEffect = npcStrikeEventArgs.NoEffect;
     retdamage = npcStrikeEventArgs.ReturnDamage;
     return npcStrikeEventArgs.Handled;
 }