Maybe the if friend: cancels out the “attack” command above it, but it’s hard to be sure since the code isn’t formatted properly.
Please format your code properly by putting the proper back ticks or using the preformated text button. It’s explained in the FAQ that everyone should read “before posting.”