Fixed result instead of function-assign in attack function