Moved AI logic from NonPlayer to its own class.