Fix AI weapon switching

This commit is contained in:
Alexander Batalov 2022-08-31 19:53:12 +03:00
parent 7803378d82
commit 857d3902bb
1 changed files with 7 additions and 5 deletions

View File

@ -2522,13 +2522,15 @@ static int _ai_try_attack(Object* a1, Object* a2)
int actionPoints = a1->data.critter.combat.ap; int actionPoints = a1->data.critter.combat.ap;
int v31 = 0; int v31 = 0;
int v42 = 0; int v42 = 0;
if (weapon == NULL) { if (weapon != NULL
if (critterGetBodyType(a2) != BODY_TYPE_BIPED || (critterGetBodyType(a2) == BODY_TYPE_BIPED
|| ((a2->fid & 0xF000) >> 12 != 0) && ((a2->fid & 0xF000) >> 12 == 0)
|| !artExists(buildFid(OBJ_TYPE_CRITTER, a1->fid & 0xFFF, ANIM_THROW_PUNCH, 0, a1->rotation + 1)) && artExists(buildFid(OBJ_TYPE_CRITTER, a1->fid & 0xFFF, ANIM_THROW_PUNCH, 0, a1->rotation + 1)))) {
|| _combat_safety_invalidate_weapon(a1, weapon, HIT_MODE_RIGHT_WEAPON_PRIMARY, a2, &v31)) { if (_combat_safety_invalidate_weapon(a1, weapon, HIT_MODE_RIGHT_WEAPON_PRIMARY, a2, &v31)) {
_ai_switch_weapons(a1, &hitMode, &weapon, a2); _ai_switch_weapons(a1, &hitMode, &weapon, a2);
} }
} else {
_ai_switch_weapons(a1, &hitMode, &weapon, a2);
} }
unsigned char v30[800]; unsigned char v30[800];