more generalization of tool upgrade code and made tools do diamond sword damange, close #39