changed the condition check of attack