Function is working but doesnt return correct value - BuildShip