add entity factory and fix some bug on aff ship