示例#1
0
 public override bool PreAI()
 {
     NPCs.NPCAI.ExtraNPCAction action = delegate()
     {
         if ((npc.velocity.Y == 0 && Math.Abs((float)(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)))) < 160 && Math.Abs((float)(npc.position.Y + (npc.height / 2) - (Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2)))) < 50.0 && (npc.direction > 0 && npc.velocity.X >= 1 || npc.direction < 0 && npc.velocity.X <= -1)))
         {
             npc.velocity.X = npc.velocity.X * 4f;
             if ((double)npc.velocity.X > 5)
             {
                 npc.velocity.X = 5f;
             }
             if ((double)npc.velocity.X < -5)
             {
                 npc.velocity.X = -5f;
             }
             npc.velocity.Y = -4f;
             npc.netUpdate  = true;
         }
     };
     NPCAI.FighterAI(npc.whoAmI, 5, 0.2F, null, action);
     return(false);
 }