optimiza is_attack
remove a redundant variable