fixed AI attack code