Fix cppcheck issue "src/players/ai/default/default.cpp:54: The scope of the variable 'hasAttack' can be reduced.".