Rename AI's callbacks to onXXX.

I'd like to implement some logic in client/ai/ai.cc. To ensure these callbacks
are called properly, I use the template method pattern here.