Looks like you simply need to replace 'base' with 'npc'.I'm doing a spin-off EOC boss, just playing around with vanilla AIs to get more comfortable with AI stuff.
Notably these lines:
if (base.Center.X > Main.player[npc.target].Center.X)
num277 *= -1f;
if (base.Center.Y > Main.player[npc.target].Center.Y)
num276 *= -1f;
The vanilla code was originally from the NPC calss (I assume) so 'base.' will refer to that NPC. When you have that code into your ModNPC class, 'base.' refers to that ModNPC class instead which is why you need to replace 'base' with 'npc'.