| 854 | } |
| 855 | |
| 856 | int Monster::SelectMeleeAttackAnimation() |
| 857 | { |
| 858 | int possible_animations[3]; |
| 859 | int possible_animation_count= 0u; |
| 860 | |
| 861 | const int left_hand_animation= GetAnimation( AnimationId::MeleeAttackLeftHand ); |
| 862 | const int right_hand_animation= GetAnimation( AnimationId::MeleeAttackRightHand ); |
| 863 | const int head_animation= GetAnimation( AnimationId::MeleeAttackHead ); |
| 864 | if( have_left_hand_ && left_hand_animation >= 0 ) |
| 865 | { |
| 866 | possible_animations[ possible_animation_count ]= left_hand_animation; |
| 867 | possible_animation_count++; |
| 868 | } |
| 869 | if( have_right_hand_ && right_hand_animation >= 0 ) |
| 870 | { |
| 871 | possible_animations[ possible_animation_count ]= right_hand_animation; |
| 872 | possible_animation_count++; |
| 873 | } |
| 874 | if( have_head_ && head_animation >= 0 ) |
| 875 | { |
| 876 | possible_animations[ possible_animation_count ]= head_animation; |
| 877 | possible_animation_count++; |
| 878 | } |
| 879 | |
| 880 | if( possible_animation_count == 0u ) |
| 881 | return -1; |
| 882 | |
| 883 | return possible_animations[ random_generator_->Rand() % possible_animation_count ]; |
| 884 | } |
| 885 | |
| 886 | void Monster::SpawnBodyPart( Map& map, const unsigned char part_id ) |
| 887 | { |