attack() function working now