Refactored warrior code to seperate js file